client-superstaq icon indicating copy to clipboard operation
client-superstaq copied to clipboard

License header formatting

Open natibek opened this issue 7 months ago • 2 comments

There are inconsistencies in when license headers are added to source code (and whether the added ones are the same). This PR solves this with a checker that checks if the source code has a license header and if it does, whether it is the correct one. It accounts for shebang lines, comments at the beginning of files unrelated to license headers, and pylint and mypy disable lines. This check has been added to all_.py.

  • Like the other checks, it can be called with ./checks/license_header_format_.py from the root directory.
  • -i can be used to perform an incremental check. This is not enabled by default.
  • A specific file can be passed as an argument and just that will be checked. By default, it checks all the files matching *.py.
  • The --no-header flag is used to handle only cases where no header is found. By default, it is False.
  • The --bad-header flag is used to handle only cases where an incorrect header is found. By default, it is False.
  • The --apply flag is used to fix the header problems. By default, it only checks if the headers are correct and does not make any fixes.
    • It will remove bad headers and replace them with the correct ones.
    • If no license header is found, it will add one.

natibek avatar Jul 08 '24 17:07 natibek