tree: 2e3605fb10af8e3a1d55e537cf65684afac37562 [path history] [tgz]
  1. tests/
  2. ApacheIBMLicenseHeader.txt
  3. ASF-Release-v2.cfg
  4. ASF-Release.cfg
  5. ASFLicenseHeader.txt
  6. ASFLicenseHeaderBash.txt
  7. ASFLicenseHeaderHash.txt
  8. ASFLicenseHeaderLua.txt
  9. ASFMinifiedLicenseHashHeader.txt
  10. ASFMinifiedLicenseHeader.txt
  11. README.md
  12. scanCode.cfg
  13. scanCode.py
  14. test.sh
  15. travis.cfg
scancode/README.md

codescan

Simple configurable code scanner in Python.

Usage

scanCode.py [-h] [-v] [--config CONFIG] root_directory

Scans all source code under specified directory for project compliance using provided configuration.

positional arguments:

  • root_directory : starting directory for the scan

optional arguments:

  • -h, --help : show this help message and exit
  • -v, --verbose : enable verbose output
  • --config CONFIG : provide custom configuration file

Configuration file format

Supported sections

[Licenses]

List of filenames containing the text of valid license (headers). These files SHOULD be in the same directory path where scanCode.py resides.

[Includes]

Filters (path/filename) with wildcards and associated scan checks that are to be run against them. The checks are actual valid function names found in scanCode.py.

These include:

  • has_block_license
  • no_tabs
  • no_trailing_spaces
  • eol_at_eof
  • check_regex

[Excludes]

List of paths (inclusive of subdirectories) to exlude from code scanning.

[Regex]

List of regular expressions for forbidden strings, e.g. \w+@company.com

[Options]

List of additional key-value pair format options.

Currently, the following options are supported:

  • LICENSE_SLACK_LENGTH (apples to check ‘has_block_license’)
    • Not all code files allow licenses to appear starting at the first character of the file. This option tells the scan to allow licenses to appear starting within first ‘x’ characters of each code file (as provided by this option's value).