From 12e937c8a1e29a0f47adb89c8419fef9f03f903d Mon Sep 17 00:00:00 2001 From: Michael Jeronimo Date: Fri, 16 Feb 2024 06:39:45 -0800 Subject: [PATCH 1/3] Update maintainer list in package.xml files (#474) * Update maintainer list in package.xml files Signed-off-by: Michael Jeronimo Signed-off-by: Chris Lalancette Signed-off-by: Michael Carlstrom --- ament_clang_format/package.xml | 2 +- ament_clang_tidy/package.xml | 2 +- ament_cmake_clang_format/package.xml | 2 +- ament_cmake_clang_tidy/package.xml | 2 +- ament_cmake_copyright/package.xml | 2 +- ament_cmake_cppcheck/package.xml | 2 +- ament_cmake_cpplint/package.xml | 2 +- ament_cmake_flake8/package.xml | 2 +- ament_cmake_lint_cmake/package.xml | 2 +- ament_cmake_mypy/package.xml | 2 +- ament_cmake_pclint/package.xml | 2 +- ament_cmake_pep257/package.xml | 2 +- ament_cmake_pycodestyle/package.xml | 2 +- ament_cmake_pyflakes/package.xml | 2 +- ament_cmake_uncrustify/package.xml | 2 +- ament_cmake_xmllint/package.xml | 2 +- ament_copyright/package.xml | 2 +- ament_cppcheck/package.xml | 2 +- ament_cpplint/package.xml | 2 +- ament_flake8/package.xml | 2 +- ament_lint/package.xml | 2 +- ament_lint_auto/package.xml | 2 +- ament_lint_cmake/package.xml | 2 +- ament_lint_common/package.xml | 2 +- ament_mypy/package.xml | 2 +- ament_pclint/package.xml | 2 +- ament_pep257/package.xml | 2 +- ament_pycodestyle/package.xml | 2 +- ament_pyflakes/package.xml | 2 +- ament_uncrustify/package.xml | 2 +- ament_xmllint/package.xml | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ament_clang_format/package.xml b/ament_clang_format/package.xml index a2705796..1f126364 100644 --- a/ament_clang_format/package.xml +++ b/ament_clang_format/package.xml @@ -7,7 +7,7 @@ The ability to check code against style conventions using clang-format and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_clang_tidy/package.xml b/ament_clang_tidy/package.xml index fc41e29c..f0fdff4d 100644 --- a/ament_clang_tidy/package.xml +++ b/ament_clang_tidy/package.xml @@ -7,7 +7,7 @@ The ability to check code against style conventions using clang-tidy and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_clang_format/package.xml b/ament_cmake_clang_format/package.xml index efda7aea..00b2e85e 100644 --- a/ament_cmake_clang_format/package.xml +++ b/ament_cmake_clang_format/package.xml @@ -7,7 +7,7 @@ The CMake API for ament_clang_format to lint C / C++ code using clang format. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_clang_tidy/package.xml b/ament_cmake_clang_tidy/package.xml index 713f2f7e..f2be1370 100644 --- a/ament_cmake_clang_tidy/package.xml +++ b/ament_cmake_clang_tidy/package.xml @@ -7,7 +7,7 @@ The CMake API for ament_clang_tidy to lint C / C++ code using clang tidy. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_copyright/package.xml b/ament_cmake_copyright/package.xml index aa2aa85b..1d13a76a 100644 --- a/ament_cmake_copyright/package.xml +++ b/ament_cmake_copyright/package.xml @@ -5,7 +5,7 @@ 0.16.3 The CMake API for ament_copyright to check every source file contains copyright reference. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_cppcheck/package.xml b/ament_cmake_cppcheck/package.xml index e137511f..a725ea87 100644 --- a/ament_cmake_cppcheck/package.xml +++ b/ament_cmake_cppcheck/package.xml @@ -8,7 +8,7 @@ code using Cppcheck. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_cpplint/package.xml b/ament_cmake_cpplint/package.xml index 67fe738d..03064749 100644 --- a/ament_cmake_cpplint/package.xml +++ b/ament_cmake_cpplint/package.xml @@ -7,7 +7,7 @@ The CMake API for ament_cpplint to lint C / C++ code using cpplint. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_flake8/package.xml b/ament_cmake_flake8/package.xml index 87afbea3..fb2663ce 100644 --- a/ament_cmake_flake8/package.xml +++ b/ament_cmake_flake8/package.xml @@ -8,7 +8,7 @@ with flake8. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_lint_cmake/package.xml b/ament_cmake_lint_cmake/package.xml index 37c7fed0..7d9eaeab 100644 --- a/ament_cmake_lint_cmake/package.xml +++ b/ament_cmake_lint_cmake/package.xml @@ -7,7 +7,7 @@ The CMake API for ament_lint_cmake to lint CMake code using cmakelint. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_mypy/package.xml b/ament_cmake_mypy/package.xml index 08fb27f3..fccd1483 100644 --- a/ament_cmake_mypy/package.xml +++ b/ament_cmake_mypy/package.xml @@ -8,7 +8,7 @@ with mypy. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_pclint/package.xml b/ament_cmake_pclint/package.xml index 448cd002..0592ca8a 100644 --- a/ament_cmake_pclint/package.xml +++ b/ament_cmake_pclint/package.xml @@ -8,7 +8,7 @@ code using PC-lint. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_pep257/package.xml b/ament_cmake_pep257/package.xml index 0476be74..eb516cc3 100644 --- a/ament_cmake_pep257/package.xml +++ b/ament_cmake_pep257/package.xml @@ -8,7 +8,7 @@ PEP 257. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_pycodestyle/package.xml b/ament_cmake_pycodestyle/package.xml index c00c9df3..2cfdc78b 100644 --- a/ament_cmake_pycodestyle/package.xml +++ b/ament_cmake_pycodestyle/package.xml @@ -8,7 +8,7 @@ PEP 8. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_pyflakes/package.xml b/ament_cmake_pyflakes/package.xml index a990652c..bd4aa4ba 100644 --- a/ament_cmake_pyflakes/package.xml +++ b/ament_cmake_pyflakes/package.xml @@ -7,7 +7,7 @@ The CMake API for ament_pyflakes to check code using pyflakes. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_uncrustify/package.xml b/ament_cmake_uncrustify/package.xml index d7b648c3..49464360 100644 --- a/ament_cmake_uncrustify/package.xml +++ b/ament_cmake_uncrustify/package.xml @@ -8,7 +8,7 @@ using uncrustify. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cmake_xmllint/package.xml b/ament_cmake_xmllint/package.xml index 616a532f..1f5e01a1 100644 --- a/ament_cmake_xmllint/package.xml +++ b/ament_cmake_xmllint/package.xml @@ -7,7 +7,7 @@ The CMake API for ament_xmllint to check XML file using xmmlint. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_copyright/package.xml b/ament_copyright/package.xml index 8498035a..c69a2a30 100644 --- a/ament_copyright/package.xml +++ b/ament_copyright/package.xml @@ -8,7 +8,7 @@ information. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cppcheck/package.xml b/ament_cppcheck/package.xml index 1cc80290..8e8e3067 100644 --- a/ament_cppcheck/package.xml +++ b/ament_cppcheck/package.xml @@ -8,7 +8,7 @@ and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_cpplint/package.xml b/ament_cpplint/package.xml index b5ed94b8..23a54407 100644 --- a/ament_cpplint/package.xml +++ b/ament_cpplint/package.xml @@ -7,7 +7,7 @@ The ability to check code against the Google style conventions using cpplint and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 BSD diff --git a/ament_flake8/package.xml b/ament_flake8/package.xml index 1c2fd5a7..d7cd50ae 100644 --- a/ament_flake8/package.xml +++ b/ament_flake8/package.xml @@ -7,7 +7,7 @@ The ability to check code for style and syntax conventions with flake8. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_lint/package.xml b/ament_lint/package.xml index 63d9375c..b3d0f252 100644 --- a/ament_lint/package.xml +++ b/ament_lint/package.xml @@ -7,7 +7,7 @@ Providing common API for ament linter packages. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_lint_auto/package.xml b/ament_lint_auto/package.xml index 9a3a3240..df9a3c66 100644 --- a/ament_lint_auto/package.xml +++ b/ament_lint_auto/package.xml @@ -5,7 +5,7 @@ 0.16.3 The auto-magic functions for ease to use of the ament linters in CMake. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_lint_cmake/package.xml b/ament_lint_cmake/package.xml index 864d2217..4a388613 100644 --- a/ament_lint_cmake/package.xml +++ b/ament_lint_cmake/package.xml @@ -8,7 +8,7 @@ result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_lint_common/package.xml b/ament_lint_common/package.xml index b25b2f0a..41952545 100644 --- a/ament_lint_common/package.xml +++ b/ament_lint_common/package.xml @@ -5,7 +5,7 @@ 0.16.3 The list of commonly used linters in the ament build system in CMake. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_mypy/package.xml b/ament_mypy/package.xml index 72834900..df5c87be 100644 --- a/ament_mypy/package.xml +++ b/ament_mypy/package.xml @@ -5,7 +5,7 @@ 0.16.3 Support for mypy static type checking in ament. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_pclint/package.xml b/ament_pclint/package.xml index 949a5d54..cc1ddf65 100644 --- a/ament_pclint/package.xml +++ b/ament_pclint/package.xml @@ -8,7 +8,7 @@ and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_pep257/package.xml b/ament_pep257/package.xml index 26b1c2dc..0c824cf3 100644 --- a/ament_pep257/package.xml +++ b/ament_pep257/package.xml @@ -8,7 +8,7 @@ PEP 257 and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 MIT diff --git a/ament_pycodestyle/package.xml b/ament_pycodestyle/package.xml index 5c8f51bc..fb8b0530 100644 --- a/ament_pycodestyle/package.xml +++ b/ament_pycodestyle/package.xml @@ -8,7 +8,7 @@ generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_pyflakes/package.xml b/ament_pyflakes/package.xml index 49bf8a51..a5540e55 100644 --- a/ament_pyflakes/package.xml +++ b/ament_pyflakes/package.xml @@ -8,7 +8,7 @@ result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_uncrustify/package.xml b/ament_uncrustify/package.xml index 260280e3..c7046013 100644 --- a/ament_uncrustify/package.xml +++ b/ament_uncrustify/package.xml @@ -8,7 +8,7 @@ and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 diff --git a/ament_xmllint/package.xml b/ament_xmllint/package.xml index 130ae7f8..db2a3e92 100644 --- a/ament_xmllint/package.xml +++ b/ament_xmllint/package.xml @@ -8,7 +8,7 @@ and generate xUnit test result files. - Michael Jeronimo + Chris Lalancette Apache License 2.0 From 99f1429d51cd6c699607b3479dd62b70f85eac0e Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Wed, 21 Feb 2024 23:42:05 -0500 Subject: [PATCH 2/3] add config file support based on mypys Signed-off-by: Michael Carlstrom --- ament_pep257/ament_pep257/main.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ament_pep257/ament_pep257/main.py b/ament_pep257/ament_pep257/main.py index a8f43800..243489db 100755 --- a/ament_pep257/ament_pep257/main.py +++ b/ament_pep257/ament_pep257/main.py @@ -71,6 +71,12 @@ def main(argv=sys.argv[1:]): default=[], help='Choose the basic list of error codes for pydocstyle to check for.' ) + err_code_group.add_argument( + '--config', + metavar='path', + dest='config_file', + help='The config file' + ) err_code_group.add_argument( '--convention', choices=_conventions, @@ -114,16 +120,21 @@ def main(argv=sys.argv[1:]): if args.xunit_file: start_time = time.time() + if args.config_file and not os.path.exists(args.config_file): + print("Could not find config file '{}'".format(args.config_file), file=sys.stderr) + return 1 + args.ignore = ','.join(args.ignore) args.select = ','.join(args.select) args.add_select = ','.join(args.add_select) args.add_ignore = ','.join(args.add_ignore) - if not (args.ignore or args.select) and args.convention == 'ament': + if not (args.ignore or args.select or args.config_file) and args.convention == 'ament': args.ignore = ','.join(_ament_ignore) excludes = [os.path.abspath(e) for e in args.excludes] report = generate_pep257_report(args.paths, excludes, args.ignore, args.select, - args.convention, args.add_ignore, args.add_select) + args.convention, args.add_ignore, args.add_select, + args.config_file) error_count = sum(len(r[1]) for r in report) # print summary @@ -161,7 +172,8 @@ def _filename_in_excludes(filename, excludes): return any(os.path.commonpath([absname, e]) == e for e in excludes) -def generate_pep257_report(paths, excludes, ignore, select, convention, add_ignore, add_select): +def generate_pep257_report(paths, excludes, ignore, select, convention, add_ignore, add_select, + config_file): conf = ConfigurationParser() sys_argv = sys.argv sys.argv = [ @@ -173,12 +185,15 @@ def generate_pep257_report(paths, excludes, ignore, select, convention, add_igno sys.argv += ['--ignore', ignore] elif select: sys.argv += ['--select', select] + elif config_file: + sys.argv += ['--config', config_file] else: sys.argv += ['--convention', convention] if add_ignore: sys.argv += ['--add-ignore', add_ignore] if add_select: sys.argv += ['--add-select', add_select] + sys.argv += paths conf.parse() sys.argv = sys_argv From 74538d3b64db99c1f83b278502d7a93aa427b01c Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Thu, 22 Feb 2024 11:07:05 -0500 Subject: [PATCH 3/3] Fix test file Signed-off-by: Michael Carlstrom --- ament_pep257/test/test_generate_pep257_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ament_pep257/test/test_generate_pep257_report.py b/ament_pep257/test/test_generate_pep257_report.py index 1174c3ca..20c1a999 100644 --- a/ament_pep257/test/test_generate_pep257_report.py +++ b/ament_pep257/test/test_generate_pep257_report.py @@ -22,7 +22,7 @@ def test_invalid_file(): ignore = ','.join(_ament_ignore) - report = generate_pep257_report(['non_existent_file.py'], [], ignore, [], 'ament', [], []) + report = generate_pep257_report(['non_existent_file.py'], [], ignore, [], 'ament', [], [], []) assert len(report) == 1 filename, errors = report[0] assert filename == 'non_existent_file.py' @@ -40,7 +40,7 @@ def test_valid_file(): py_file = temp_dir / 'foobar.py' py_file.write_text('a = 1+2\n') - report = generate_pep257_report([str(temp_dir)], [], ignore, [], 'ament', [], []) + report = generate_pep257_report([str(temp_dir)], [], ignore, [], 'ament', [], [], []) assert len(report) == 1 filename, errors = report[0]