# Audit Rust crate source for suspicious files in the current directory, that
# shouldn't or can't be part of a Debian source package.
#
+# NOTE: this overwrites & deletes files in the current directory!!! Make a
+# backup before running this script.
+#
# Usage: $0 <whitelist> <filter_description> [<extra args to suspicious-source>]
set -e
echo "Checking for suspicious files..."
# Remove cargo metadata files
find . '(' -name '.cargo-checksum.json' -or -name '.cargo_vcs_info.json' ')' -delete
+# Strip comments & blank lines before testing rust source code -
+# some authors like to write really long comments
+find . -name '*.rs' -execdir sed -i -e '\,^\s*//,d' -e '/^\s*$/d' '{}' \;
# TODO: merge the -m stuff into suspicious-source(1).
suspicious-source -v "$@"