Rewrite lint.sh as check_lint.py (#3161)

* Rewrite lint.sh as check_lint.py

This makes several beneficial changes:

  * Runs in parallel: lint all now takes 5.5 seconds, down from 25.
  * Supports linting specific files, passed on the command-line.
  * Defaults to linting files changed since master, pass --all to lint
    everything.
  * Infers header language based on related files.
  * Lays the groundwork for linting more than just C++.
  * Adds support for linting python.

* Fix lint errors

* Use check_lint.py in check.sh

* Remove lint.sh

* Python lint configuration

* Enable python linting in travis
This commit is contained in:
Gil authored and GitHub committed 2019-06-14 09:22:55 -07:00
1 parent 64d8a40a70
commit 3e3bcb41f7
15 files changed
+923 -117

No files matched your search

+10 -6
View File
@@ -50,19 +50,22 @@ import os
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("input", help="Input file containing binary data to embed")
arg_parser.add_argument("input",
help="Input file containing binary data to embed")
arg_parser.add_argument("--output_source",
help="Output source file, defining the array data.")
help="Output source file, defining the array data.")
arg_parser.add_argument("--output_header",
help="Output header file, declaring the array data.")
help="Output header file, declaring the array data.")
arg_parser.add_argument("--array", help="Identifier for the array.")
arg_parser.add_argument("--array_size", help="Identifier for the array size.")
arg_parser.add_argument("--filename", help="Override file name in code.")
arg_parser.add_argument("--filename_identifier", help="Where to put the filename.")
arg_parser.add_argument("--filename_identifier",
help="Where to put the filename.")
arg_parser.add_argument("--header_guard",
help="Header guard to #define in the output header.")
help="Header guard to #define in the output header.")
arg_parser.add_argument("--cpp_namespace",
help="C++ namespace to use. If blank, will generate a C array.")
help="C++ namespace to use. "
"If blank, will generate a C array.")
# How many hex bytes to display in a line. Each "0x00, " takes 6 characters, so
# a width of 12 lets us fit within 80 characters.
@@ -278,5 +281,6 @@ def main():
src.write(source_text)
logging.debug("Wrote source file %s", output_source)
if __name__ == "__main__":
main()