From 277020f4bd19f3e459e4005dcb9b4620c0965fe6 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 23 Oct 2023 08:30:48 -0700 Subject: [PATCH 01/58] Have ruff example unit test file generate an error. - Line too long error not reported when upgrading ruff tool from 0.0.278 to 0.1.1. - Not running pycodestyle, pydocstyle, isort, or flake8 during tox run. Those tools are run in other parts of the Statick testing pipeline. --- .../plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py | 4 ++++ tox.ini | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py b/tests/plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py index 6635daaa..7ea00288 100644 --- a/tests/plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py +++ b/tests/plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py @@ -3,4 +3,8 @@ except ImportError: from django.utils import simplejson as json # NOQA +# Need to create an unused import to generate a ruff error. +import os + +# Line too long does not trigger going from ruff v0.0.278 to v0.1.1. some_long_variable = "make this string go past the allowed length of 88 characters by adding ridiculous redundancy" diff --git a/tox.ini b/tox.ini index f572342c..755131e7 100644 --- a/tox.ini +++ b/tox.ini @@ -48,9 +48,7 @@ deps = pytest-isort .[test] commands = - pydocstyle ../statick_tool/ - pycodestyle --ignore=E203,E501,W503 ../statick_tool/ - pytest --flake8 --isort \ + pytest \ --cov={toxinidir}/statick_tool \ --cov-report term-missing \ --doctest-modules \ From 98addb8c9c07daf3a837e98bf765a77af918aac8 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 21 Nov 2023 16:40:00 -0800 Subject: [PATCH 02/58] Switch to pyproject.toml project with src-based layout. --- .github/workflows/test.yml | 19 ++-- README.md | 8 +- clean.sh | 2 +- .../plugins/my_custom_tool_plugin.py | 4 +- pyproject.toml | 90 +++++++++++++++++++ requirements-docs.txt | 4 - requirements.txt | 25 ------ setup.py | 77 ---------------- .../statick_tool}/__init__.py | 2 - {statick_tool => src/statick_tool}/args.py | 0 {statick_tool => src/statick_tool}/config.py | 0 .../statick_tool}/discovery_plugin.py | 0 .../statick_tool}/exceptions.py | 0 {statick_tool => src/statick_tool}/issue.py | 0 {statick_tool => src/statick_tool}/package.py | 0 .../statick_tool}/plugin_context.py | 0 .../statick_tool}/plugins/__init__.py | 0 .../plugins/discovery/__init__.py | 0 .../plugins/discovery/c_discovery_plugin.py | 0 .../discovery/c_discovery_plugin.yapsy-plugin | 0 .../discovery/cmake_discovery_plugin.py | 0 .../cmake_discovery_plugin.yapsy-plugin | 0 .../discovery/groovy_discovery_plugin.py | 0 .../groovy_discovery_plugin.yapsy-plugin | 0 .../discovery/java_discovery_plugin.py | 0 .../java_discovery_plugin.yapsy-plugin | 0 .../discovery/maven_discovery_plugin.py | 0 .../maven_discovery_plugin.yapsy-plugin | 0 .../discovery/perl_discovery_plugin.py | 0 .../perl_discovery_plugin.yapsy-plugin | 0 .../discovery/python_discovery_plugin.py | 0 .../python_discovery_plugin.yapsy-plugin | 0 .../plugins/discovery/ros_discovery_plugin.py | 0 .../ros_discovery_plugin.yapsy-plugin | 0 .../discovery/shell_discovery_plugin.py | 0 .../shell_discovery_plugin.yapsy-plugin | 0 .../plugins/discovery/xml_discovery_plugin.py | 0 .../xml_discovery_plugin.yapsy-plugin | 0 .../discovery/yaml_discovery_plugin.py | 0 .../yaml_discovery_plugin.yapsy-plugin | 0 .../plugins/reporting/__init__.py | 0 .../code_climate_reporting_plugin.py | 0 ...code_climate_reporting_plugin.yapsy-plugin | 0 .../reporting/do_nothing_reporting_plugin.py | 0 .../do_nothing_reporting_plugin.yapsy-plugin | 0 .../reporting/json_reporting_plugin.py | 0 .../json_reporting_plugin.yapsy-plugin | 0 .../print_to_console_reporting_plugin.py | 0 ...t_to_console_reporting_plugin.yapsy-plugin | 0 ...te_jenkins_warnings_ng_reporting_plugin.py | 0 ..._warnings_ng_reporting_plugin.yapsy-plugin | 0 .../statick_tool}/plugins/tool/__init__.py | 0 .../plugins/tool/bandit_tool_plugin.py | 0 .../tool/bandit_tool_plugin.yapsy-plugin | 0 .../plugins/tool/black_tool_plugin.py | 0 .../tool/black_tool_plugin.yapsy-plugin | 0 .../plugins/tool/catkin_lint_tool_plugin.py | 0 .../tool/catkin_lint_tool_plugin.yapsy-plugin | 0 .../plugins/tool/cccc_tool_plugin.py | 0 .../tool/cccc_tool_plugin.yapsy-plugin | 0 .../plugins/tool/clang_format_parser.py | 0 .../plugins/tool/clang_format_tool_plugin.py | 0 .../clang_format_tool_plugin.yapsy-plugin | 0 .../plugins/tool/clang_tidy_tool_plugin.py | 0 .../tool/clang_tidy_tool_plugin.yapsy-plugin | 0 .../plugins/tool/cmakelint_tool_plugin.py | 0 .../tool/cmakelint_tool_plugin.yapsy-plugin | 0 .../plugins/tool/cppcheck_tool_plugin.py | 0 .../tool/cppcheck_tool_plugin.yapsy-plugin | 0 .../plugins/tool/cpplint_tool_plugin.py | 0 .../tool/cpplint_tool_plugin.yapsy-plugin | 0 .../plugins/tool/do_nothing_tool_plugin.py | 0 .../tool/do_nothing_tool_plugin.yapsy-plugin | 0 .../plugins/tool/docformatter_tool_plugin.py | 0 .../docformatter_tool_plugin.yapsy-plugin | 0 .../plugins/tool/flawfinder_tool_plugin.py | 0 .../tool/flawfinder_tool_plugin.yapsy-plugin | 0 .../plugins/tool/groovylint_tool_plugin.py | 0 .../tool/groovylint_tool_plugin.yapsy-plugin | 0 .../plugins/tool/isort_tool_plugin.py | 0 .../tool/isort_tool_plugin.yapsy-plugin | 0 .../plugins/tool/lizard_tool_plugin.py | 0 .../tool/lizard_tool_plugin.yapsy-plugin | 0 .../plugins/tool/make_tool_plugin.py | 0 .../tool/make_tool_plugin.yapsy-plugin | 0 .../plugins/tool/mypy_tool_plugin.py | 0 .../tool/mypy_tool_plugin.yapsy-plugin | 0 .../plugins/tool/perlcritic_tool_plugin.py | 0 .../tool/perlcritic_tool_plugin.yapsy-plugin | 0 .../plugins/tool/pycodestyle_tool_plugin.py | 0 .../tool/pycodestyle_tool_plugin.yapsy-plugin | 0 .../plugins/tool/pydocstyle_tool_plugin.py | 0 .../tool/pydocstyle_tool_plugin.yapsy-plugin | 0 .../plugins/tool/pyflakes_tool_plugin.py | 0 .../tool/pyflakes_tool_plugin.yapsy-plugin | 0 .../plugins/tool/pylint_tool_plugin.py | 0 .../tool/pylint_tool_plugin.yapsy-plugin | 0 .../plugins/tool/ruff_tool_plugin.py | 0 .../tool/ruff_tool_plugin.yapsy-plugin | 0 .../plugins/tool/shellcheck_tool_plugin.py | 0 .../tool/shellcheck_tool_plugin.yapsy-plugin | 0 .../plugins/tool/spotbugs_tool_plugin.py | 0 .../tool/spotbugs_tool_plugin.yapsy-plugin | 0 .../plugins/tool/uncrustify_tool_plugin.py | 0 .../tool/uncrustify_tool_plugin.yapsy-plugin | 0 .../plugins/tool/xmllint_tool_plugin.py | 0 .../tool/xmllint_tool_plugin.yapsy-plugin | 0 .../plugins/tool/yamllint_tool_plugin.py | 0 .../tool/yamllint_tool_plugin.yapsy-plugin | 0 {statick_tool => src/statick_tool}/profile.py | 0 .../statick_tool}/reporting_plugin.py | 0 .../statick_tool}/resources.py | 0 .../statick_tool}/rsc/.clang-format | 0 .../statick_tool}/rsc/.groovylintrc.json | 0 .../statick_tool}/rsc/CMakeLists.txt.in | 0 .../statick_tool}/rsc/_clang-format | 0 .../statick_tool}/rsc/cccc.opt | 0 .../statick_tool}/rsc/config.yaml | 0 .../statick_tool}/rsc/discovery_only.yaml | 0 .../statick_tool}/rsc/documentation.yaml | 0 .../statick_tool}/rsc/exceptions.yaml | 0 .../statick_tool}/rsc/gauntlet_ignore.yaml | 0 .../rsc/plugin_mapping/clang-tidy.txt | 0 .../rsc/plugin_mapping/code_climate.txt | 0 .../rsc/plugin_mapping/cppcheck.txt | 0 .../statick_tool}/rsc/plugin_mapping/make.txt | 0 .../rsc/plugin_mapping/perlcritic.txt | 0 .../rsc/plugin_mapping/spotbugs.txt | 0 .../statick_tool}/rsc/profile.yaml | 0 .../statick_tool}/rsc/sei_cert.yaml | 0 .../statick_tool}/rsc/self_check.yaml | 0 .../statick_tool}/rsc/spotbugs-security.xml | 0 .../statick_tool}/rsc/ultimate.yaml | 0 .../statick_tool}/rsc/uncrustify.cfg | 0 statick => src/statick_tool/statick.py | 16 ++-- .../statick_tool/statick_tool.py | 4 +- {statick_tool => src/statick_tool}/timing.py | 0 .../statick_tool}/tool_plugin.py | 0 .../rsc/config-discovery-dependency.yaml | 0 .../rsc/config-enabled-dependency.yaml | 0 .../rsc/config-invalid-reporting-plugins.yaml | 0 .../rsc/config-missing-tool-dependency.yaml | 0 .../rsc/config-missing-tool.yaml | 0 .../rsc/config-no-reporting-plugins.yaml | 0 .../rsc/config-test.yaml | 0 .../{statick => statick_tool}/rsc/config.yaml | 0 .../rsc/exceptions-test.yaml | 0 .../rsc/exceptions.yaml | 0 .../rsc/packages-file-test.txt | 0 .../rsc/profile-custom.yaml | 0 .../rsc/profile-missing-reporting-plugin.yaml | 0 .../rsc/profile-missing-tool.yaml | 0 .../rsc/profile-test.yaml | 0 .../test_package/hello | 0 .../test_statick_tool.py} | 36 ++++---- .../ignore_package/AMENT_IGNORE | 0 .../test_workspace/ignore_package/package.xml | 0 .../test_workspace/test_package/hello | 0 .../test_workspace/test_package/package.xml | 0 .../test_workspace/test_package2/hello | 0 .../test_workspace/test_package2/package.xml | 0 tox.ini | 31 +------ 162 files changed, 136 insertions(+), 182 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements-docs.txt delete mode 100644 requirements.txt delete mode 100644 setup.py rename {statick_tool => src/statick_tool}/__init__.py (59%) rename {statick_tool => src/statick_tool}/args.py (100%) rename {statick_tool => src/statick_tool}/config.py (100%) rename {statick_tool => src/statick_tool}/discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/exceptions.py (100%) rename {statick_tool => src/statick_tool}/issue.py (100%) rename {statick_tool => src/statick_tool}/package.py (100%) rename {statick_tool => src/statick_tool}/plugin_context.py (100%) rename {statick_tool => src/statick_tool}/plugins/__init__.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/__init__.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/c_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/c_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/cmake_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/cmake_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/groovy_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/groovy_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/java_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/java_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/maven_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/maven_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/perl_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/perl_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/python_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/python_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/ros_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/ros_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/shell_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/shell_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/xml_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/xml_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/yaml_discovery_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/discovery/yaml_discovery_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/__init__.py (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/code_climate_reporting_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/do_nothing_reporting_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/json_reporting_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/json_reporting_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/print_to_console_reporting_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/__init__.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/bandit_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/bandit_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/black_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/black_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/catkin_lint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cccc_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cccc_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/clang_format_parser.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/clang_format_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/clang_format_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/clang_tidy_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cmakelint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cmakelint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cppcheck_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cppcheck_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cpplint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/cpplint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/do_nothing_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/do_nothing_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/docformatter_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/docformatter_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/flawfinder_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/flawfinder_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/groovylint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/groovylint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/isort_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/isort_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/lizard_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/lizard_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/make_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/make_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/mypy_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/mypy_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/perlcritic_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/perlcritic_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pycodestyle_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pydocstyle_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pyflakes_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pyflakes_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pylint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/pylint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/ruff_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/ruff_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/shellcheck_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/shellcheck_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/spotbugs_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/spotbugs_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/uncrustify_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/uncrustify_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/xmllint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/xmllint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/plugins/tool/yamllint_tool_plugin.py (100%) rename {statick_tool => src/statick_tool}/plugins/tool/yamllint_tool_plugin.yapsy-plugin (100%) rename {statick_tool => src/statick_tool}/profile.py (100%) rename {statick_tool => src/statick_tool}/reporting_plugin.py (100%) rename {statick_tool => src/statick_tool}/resources.py (100%) rename {statick_tool => src/statick_tool}/rsc/.clang-format (100%) rename {statick_tool => src/statick_tool}/rsc/.groovylintrc.json (100%) rename {statick_tool => src/statick_tool}/rsc/CMakeLists.txt.in (100%) rename {statick_tool => src/statick_tool}/rsc/_clang-format (100%) rename {statick_tool => src/statick_tool}/rsc/cccc.opt (100%) rename {statick_tool => src/statick_tool}/rsc/config.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/discovery_only.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/documentation.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/exceptions.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/gauntlet_ignore.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/plugin_mapping/clang-tidy.txt (100%) rename {statick_tool => src/statick_tool}/rsc/plugin_mapping/code_climate.txt (100%) rename {statick_tool => src/statick_tool}/rsc/plugin_mapping/cppcheck.txt (100%) rename {statick_tool => src/statick_tool}/rsc/plugin_mapping/make.txt (100%) rename {statick_tool => src/statick_tool}/rsc/plugin_mapping/perlcritic.txt (100%) rename {statick_tool => src/statick_tool}/rsc/plugin_mapping/spotbugs.txt (100%) rename {statick_tool => src/statick_tool}/rsc/profile.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/sei_cert.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/self_check.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/spotbugs-security.xml (100%) rename {statick_tool => src/statick_tool}/rsc/ultimate.yaml (100%) rename {statick_tool => src/statick_tool}/rsc/uncrustify.cfg (100%) rename statick => src/statick_tool/statick.py (76%) rename statick_tool/statick.py => src/statick_tool/statick_tool.py (99%) rename {statick_tool => src/statick_tool}/timing.py (100%) rename {statick_tool => src/statick_tool}/tool_plugin.py (100%) rename tests/{statick => statick_tool}/rsc/config-discovery-dependency.yaml (100%) rename tests/{statick => statick_tool}/rsc/config-enabled-dependency.yaml (100%) rename tests/{statick => statick_tool}/rsc/config-invalid-reporting-plugins.yaml (100%) rename tests/{statick => statick_tool}/rsc/config-missing-tool-dependency.yaml (100%) rename tests/{statick => statick_tool}/rsc/config-missing-tool.yaml (100%) rename tests/{statick => statick_tool}/rsc/config-no-reporting-plugins.yaml (100%) rename tests/{statick => statick_tool}/rsc/config-test.yaml (100%) rename tests/{statick => statick_tool}/rsc/config.yaml (100%) rename tests/{statick => statick_tool}/rsc/exceptions-test.yaml (100%) rename tests/{statick => statick_tool}/rsc/exceptions.yaml (100%) rename tests/{statick => statick_tool}/rsc/packages-file-test.txt (100%) rename tests/{statick => statick_tool}/rsc/profile-custom.yaml (100%) rename tests/{statick => statick_tool}/rsc/profile-missing-reporting-plugin.yaml (100%) rename tests/{statick => statick_tool}/rsc/profile-missing-tool.yaml (100%) rename tests/{statick => statick_tool}/rsc/profile-test.yaml (100%) rename tests/{statick => statick_tool}/test_package/hello (100%) rename tests/{statick/test_statick.py => statick_tool/test_statick_tool.py} (98%) rename tests/{statick => statick_tool}/test_workspace/ignore_package/AMENT_IGNORE (100%) rename tests/{statick => statick_tool}/test_workspace/ignore_package/package.xml (100%) rename tests/{statick => statick_tool}/test_workspace/test_package/hello (100%) rename tests/{statick => statick_tool}/test_workspace/test_package/package.xml (100%) rename tests/{statick => statick_tool}/test_workspace/test_package2/hello (100%) rename tests/{statick => statick_tool}/test_workspace/test_package2/package.xml (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c293fed..7e5bc243 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,16 +55,10 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade mypy - python -m pip install --upgrade setuptools - python -m pip install --upgrade tox - python -m pip install --upgrade tox-gh-actions - python -m pip install --upgrade types-deprecated - python -m pip install --upgrade types-PyYAML - python -m pip install --upgrade types-tabulate - python -m pip install --upgrade wheel + pip install --upgrade pip + pip install . + pip install .[test] + pip install .[docs] # Remove apt repos that are known to break from time to time. # See https://github.com/actions/virtual-environments/issues/323 @@ -107,11 +101,12 @@ jobs: - name: Test with mypy run: | - mypy --ignore-missing-imports --strict statick statick_tool/ + mypy --ignore-missing-imports --strict src/statick_tool/ - name: Statick markdown if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' run: | + pip install statick-md statick . --check --profile documentation.yaml - name: Sphinx lint @@ -133,4 +128,4 @@ jobs: if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' run: | mkdir statick-output - ./statick . --output-directory statick-output --check --profile self_check.yaml --log INFO + statick . --output-directory statick-output --check --profile self_check.yaml --log INFO diff --git a/README.md b/README.md index 6c20fc4a..500f5317 100644 --- a/README.md +++ b/README.md @@ -399,10 +399,14 @@ $ statick . --output-directory /tmp/x --timings ## Advanced Installation -To install Statick from source on your system and make it part of your `$PATH`: +To install from source best practices is to use a virtual environment. +These instructions are for Linux, activating a virtual environment on Mac/Windows is similar. +To install Statick from source on your system: ```shell -sudo python3 setup.py install +python3 -m venv venv +. venv/bin/activate +pip install . ``` ## Existing Plugins diff --git a/clean.sh b/clean.sh index ce8442b6..c5a89140 100644 --- a/clean.sh +++ b/clean.sh @@ -1,6 +1,6 @@ #!/bin/bash -rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache statick.egg-info/ statick_output/* .tox/ ./*.log +rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log find . -type d -name .mypy_cache -exec rm -rf {} \; find . -type d -name .pytest_cache -exec rm -rf {} \; find . -type d -name .ruff_cache -exec rm -rf {} \; diff --git a/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.py b/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.py index 6b044480..dd55e366 100644 --- a/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.py +++ b/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.py @@ -6,8 +6,8 @@ import subprocess from statick_tool.issue import Issue # pylint: disable=import-error -from statick_tool.tool_plugin import ( - ToolPlugin, # pylint: disable=import-error,no-name-in-module,syntax-error +from statick_tool.tool_plugin import ( # pylint: disable=import-error,no-name-in-module,syntax-error + ToolPlugin, ) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..a26f3829 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,90 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "statick" +authors = [{name = "NIWC Pacific"}] +description="Making code quality easier." +version = "0.9.4" +readme = "README.md" +requires-python = ">=3.8" +license = {text = "CC0-1.0"} +classifiers = [ + "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Software Development :: Testing", +] +dependencies = [ + "PyYAML", + "bandit", + "black", + "cmakelint", + "cpplint", + "deprecated", + "docformatter", + "flawfinder", + "isort", + "lizard", + "mypy", + "pycodestyle", + "pydocstyle", + "pyflakes", + "pylint", + "ruff", + "tabulate", + "types-PyYAML", + "types-deprecated", + "types-setuptools", + "types-tabulate", + "xmltodict", + "yamllint", + "yapsy", +] + +[project.scripts] +statick = "statick_tool.statick:main" + +[tool.setuptools.package-data] +statick_tool = [ + "plugins/discovery/*.yapsy-plugin", + "plugins/reporting/*.yapsy-plugin", + "plugins/tool/*.yapsy-plugin", + "rsc/*", + "rsc/.*", + "rsc/plugin_mapping/*", +] + +[project.urls] +"Homepage" = "https://github.com/sscpac/statick" +"Bug Tracker" = "https://github.com/sscpac/statick/issues" + +[project.optional-dependencies] +test = [ + "backports.tempfile", + "flake8-pep3101", + "flake8<5", # Pin until https://github.com/tholo/pytest-flake8/issues/87 is fixed. + "mock", + "pycodestyle", + "pydocstyle", + "pylint-django", + "pytest", + "pytest-cov", + "pytest-flake8", + "pytest-isort", + "tox", + "tox-gh-actions", +] +docs = [ + "sphinx==1.7.9", + "travis-sphinx==2.2.1", + "yaml-1.3", + "yapsy", +] + +[tool.isort] +profile = "black" diff --git a/requirements-docs.txt b/requirements-docs.txt deleted file mode 100644 index 94521be5..00000000 --- a/requirements-docs.txt +++ /dev/null @@ -1,4 +0,0 @@ -sphinx==1.7.9 -travis-sphinx==2.2.1 -yaml-1.3 -yapsy diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4f859984..00000000 --- a/requirements.txt +++ /dev/null @@ -1,25 +0,0 @@ -PyYAML -bandit -black -cmakelint -cpplint -deprecated -# Pin due to formatting conflict with black. -# https://github.com/PyCQA/docformatter/issues/94 -docformatter==1.5.1 -flawfinder -isort -lizard -mypy -pycodestyle -pydocstyle -pyflakes -pylint -pylint-django<2.0 -ruff -statick -statick-md -tabulate -xmltodict -yamllint -yapsy diff --git a/setup.py b/setup.py deleted file mode 100644 index ef5a7e3f..00000000 --- a/setup.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Setup.""" - - -from setuptools import setup # NOLINT - -import statick_tool - -with open("README.md", encoding="utf8") as f: - LONG_DESCRIPTION = f.read() - -TEST_DEPS = [ - "backports.tempfile", - "pylint-django", - "pytest", - "mock", - "tox", -] - -EXTRAS = { - "test": TEST_DEPS, -} - -setup( - name="statick", - description="Making code quality easier.", - author="SSC Pacific", - version=statick_tool.__version__, - packages=["statick_tool"], - package_data={ - "statick_tool": [ - "rsc/.*", - "rsc/*", - "rsc/plugin_mapping/*", - "plugins/*.py", - "plugins/discovery/*", - "plugins/tool/*", - "plugins/reporting/*", - ] - }, - scripts=["statick"], - long_description=LONG_DESCRIPTION, - long_description_content_type="text/markdown", - install_requires=[ - "bandit", - "black", - "cmakelint", - "cpplint", - "deprecated", - "docformatter", - "flawfinder", - "isort", - "lizard", - "mypy", - "pycodestyle", - "pydocstyle", - "pyflakes", - "pylint", - "PyYAML", - "ruff", - "tabulate", - "xmltodict", - "yamllint", - "yapsy", - ], - tests_require=TEST_DEPS, - extras_require=EXTRAS, - url="https://github.com/sscpac/statick", - classifiers=[ - "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Software Development :: Testing", - ], -) diff --git a/statick_tool/__init__.py b/src/statick_tool/__init__.py similarity index 59% rename from statick_tool/__init__.py rename to src/statick_tool/__init__.py index 115e6edb..c91ed51e 100644 --- a/statick_tool/__init__.py +++ b/src/statick_tool/__init__.py @@ -1,3 +1 @@ """Making code quality easier.""" - -__version__ = "0.9.4" diff --git a/statick_tool/args.py b/src/statick_tool/args.py similarity index 100% rename from statick_tool/args.py rename to src/statick_tool/args.py diff --git a/statick_tool/config.py b/src/statick_tool/config.py similarity index 100% rename from statick_tool/config.py rename to src/statick_tool/config.py diff --git a/statick_tool/discovery_plugin.py b/src/statick_tool/discovery_plugin.py similarity index 100% rename from statick_tool/discovery_plugin.py rename to src/statick_tool/discovery_plugin.py diff --git a/statick_tool/exceptions.py b/src/statick_tool/exceptions.py similarity index 100% rename from statick_tool/exceptions.py rename to src/statick_tool/exceptions.py diff --git a/statick_tool/issue.py b/src/statick_tool/issue.py similarity index 100% rename from statick_tool/issue.py rename to src/statick_tool/issue.py diff --git a/statick_tool/package.py b/src/statick_tool/package.py similarity index 100% rename from statick_tool/package.py rename to src/statick_tool/package.py diff --git a/statick_tool/plugin_context.py b/src/statick_tool/plugin_context.py similarity index 100% rename from statick_tool/plugin_context.py rename to src/statick_tool/plugin_context.py diff --git a/statick_tool/plugins/__init__.py b/src/statick_tool/plugins/__init__.py similarity index 100% rename from statick_tool/plugins/__init__.py rename to src/statick_tool/plugins/__init__.py diff --git a/statick_tool/plugins/discovery/__init__.py b/src/statick_tool/plugins/discovery/__init__.py similarity index 100% rename from statick_tool/plugins/discovery/__init__.py rename to src/statick_tool/plugins/discovery/__init__.py diff --git a/statick_tool/plugins/discovery/c_discovery_plugin.py b/src/statick_tool/plugins/discovery/c_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/c_discovery_plugin.py rename to src/statick_tool/plugins/discovery/c_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/cmake_discovery_plugin.py b/src/statick_tool/plugins/discovery/cmake_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/cmake_discovery_plugin.py rename to src/statick_tool/plugins/discovery/cmake_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/groovy_discovery_plugin.py b/src/statick_tool/plugins/discovery/groovy_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/groovy_discovery_plugin.py rename to src/statick_tool/plugins/discovery/groovy_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/java_discovery_plugin.py b/src/statick_tool/plugins/discovery/java_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/java_discovery_plugin.py rename to src/statick_tool/plugins/discovery/java_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/maven_discovery_plugin.py b/src/statick_tool/plugins/discovery/maven_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/maven_discovery_plugin.py rename to src/statick_tool/plugins/discovery/maven_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/perl_discovery_plugin.py b/src/statick_tool/plugins/discovery/perl_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/perl_discovery_plugin.py rename to src/statick_tool/plugins/discovery/perl_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/python_discovery_plugin.py b/src/statick_tool/plugins/discovery/python_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/python_discovery_plugin.py rename to src/statick_tool/plugins/discovery/python_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/ros_discovery_plugin.py b/src/statick_tool/plugins/discovery/ros_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/ros_discovery_plugin.py rename to src/statick_tool/plugins/discovery/ros_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/shell_discovery_plugin.py b/src/statick_tool/plugins/discovery/shell_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/shell_discovery_plugin.py rename to src/statick_tool/plugins/discovery/shell_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/xml_discovery_plugin.py b/src/statick_tool/plugins/discovery/xml_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/xml_discovery_plugin.py rename to src/statick_tool/plugins/discovery/xml_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/discovery/yaml_discovery_plugin.py b/src/statick_tool/plugins/discovery/yaml_discovery_plugin.py similarity index 100% rename from statick_tool/plugins/discovery/yaml_discovery_plugin.py rename to src/statick_tool/plugins/discovery/yaml_discovery_plugin.py diff --git a/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin rename to src/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin diff --git a/statick_tool/plugins/reporting/__init__.py b/src/statick_tool/plugins/reporting/__init__.py similarity index 100% rename from statick_tool/plugins/reporting/__init__.py rename to src/statick_tool/plugins/reporting/__init__.py diff --git a/statick_tool/plugins/reporting/code_climate_reporting_plugin.py b/src/statick_tool/plugins/reporting/code_climate_reporting_plugin.py similarity index 100% rename from statick_tool/plugins/reporting/code_climate_reporting_plugin.py rename to src/statick_tool/plugins/reporting/code_climate_reporting_plugin.py diff --git a/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin rename to src/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin diff --git a/statick_tool/plugins/reporting/do_nothing_reporting_plugin.py b/src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.py similarity index 100% rename from statick_tool/plugins/reporting/do_nothing_reporting_plugin.py rename to src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.py diff --git a/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin rename to src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin diff --git a/statick_tool/plugins/reporting/json_reporting_plugin.py b/src/statick_tool/plugins/reporting/json_reporting_plugin.py similarity index 100% rename from statick_tool/plugins/reporting/json_reporting_plugin.py rename to src/statick_tool/plugins/reporting/json_reporting_plugin.py diff --git a/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin rename to src/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin diff --git a/statick_tool/plugins/reporting/print_to_console_reporting_plugin.py b/src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.py similarity index 100% rename from statick_tool/plugins/reporting/print_to_console_reporting_plugin.py rename to src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.py diff --git a/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin rename to src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin diff --git a/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py b/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py similarity index 100% rename from statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py rename to src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py diff --git a/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin rename to src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/__init__.py b/src/statick_tool/plugins/tool/__init__.py similarity index 100% rename from statick_tool/plugins/tool/__init__.py rename to src/statick_tool/plugins/tool/__init__.py diff --git a/statick_tool/plugins/tool/bandit_tool_plugin.py b/src/statick_tool/plugins/tool/bandit_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/bandit_tool_plugin.py rename to src/statick_tool/plugins/tool/bandit_tool_plugin.py diff --git a/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/black_tool_plugin.py b/src/statick_tool/plugins/tool/black_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/black_tool_plugin.py rename to src/statick_tool/plugins/tool/black_tool_plugin.py diff --git a/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/catkin_lint_tool_plugin.py b/src/statick_tool/plugins/tool/catkin_lint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/catkin_lint_tool_plugin.py rename to src/statick_tool/plugins/tool/catkin_lint_tool_plugin.py diff --git a/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/cccc_tool_plugin.py b/src/statick_tool/plugins/tool/cccc_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/cccc_tool_plugin.py rename to src/statick_tool/plugins/tool/cccc_tool_plugin.py diff --git a/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/clang_format_parser.py b/src/statick_tool/plugins/tool/clang_format_parser.py similarity index 100% rename from statick_tool/plugins/tool/clang_format_parser.py rename to src/statick_tool/plugins/tool/clang_format_parser.py diff --git a/statick_tool/plugins/tool/clang_format_tool_plugin.py b/src/statick_tool/plugins/tool/clang_format_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/clang_format_tool_plugin.py rename to src/statick_tool/plugins/tool/clang_format_tool_plugin.py diff --git a/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/clang_tidy_tool_plugin.py b/src/statick_tool/plugins/tool/clang_tidy_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/clang_tidy_tool_plugin.py rename to src/statick_tool/plugins/tool/clang_tidy_tool_plugin.py diff --git a/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/cmakelint_tool_plugin.py b/src/statick_tool/plugins/tool/cmakelint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/cmakelint_tool_plugin.py rename to src/statick_tool/plugins/tool/cmakelint_tool_plugin.py diff --git a/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/cppcheck_tool_plugin.py b/src/statick_tool/plugins/tool/cppcheck_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/cppcheck_tool_plugin.py rename to src/statick_tool/plugins/tool/cppcheck_tool_plugin.py diff --git a/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/cpplint_tool_plugin.py b/src/statick_tool/plugins/tool/cpplint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/cpplint_tool_plugin.py rename to src/statick_tool/plugins/tool/cpplint_tool_plugin.py diff --git a/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/do_nothing_tool_plugin.py b/src/statick_tool/plugins/tool/do_nothing_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/do_nothing_tool_plugin.py rename to src/statick_tool/plugins/tool/do_nothing_tool_plugin.py diff --git a/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/docformatter_tool_plugin.py b/src/statick_tool/plugins/tool/docformatter_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/docformatter_tool_plugin.py rename to src/statick_tool/plugins/tool/docformatter_tool_plugin.py diff --git a/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/flawfinder_tool_plugin.py b/src/statick_tool/plugins/tool/flawfinder_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/flawfinder_tool_plugin.py rename to src/statick_tool/plugins/tool/flawfinder_tool_plugin.py diff --git a/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/groovylint_tool_plugin.py b/src/statick_tool/plugins/tool/groovylint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/groovylint_tool_plugin.py rename to src/statick_tool/plugins/tool/groovylint_tool_plugin.py diff --git a/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/isort_tool_plugin.py b/src/statick_tool/plugins/tool/isort_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/isort_tool_plugin.py rename to src/statick_tool/plugins/tool/isort_tool_plugin.py diff --git a/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/lizard_tool_plugin.py b/src/statick_tool/plugins/tool/lizard_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/lizard_tool_plugin.py rename to src/statick_tool/plugins/tool/lizard_tool_plugin.py diff --git a/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/make_tool_plugin.py b/src/statick_tool/plugins/tool/make_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/make_tool_plugin.py rename to src/statick_tool/plugins/tool/make_tool_plugin.py diff --git a/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/mypy_tool_plugin.py b/src/statick_tool/plugins/tool/mypy_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/mypy_tool_plugin.py rename to src/statick_tool/plugins/tool/mypy_tool_plugin.py diff --git a/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/perlcritic_tool_plugin.py b/src/statick_tool/plugins/tool/perlcritic_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/perlcritic_tool_plugin.py rename to src/statick_tool/plugins/tool/perlcritic_tool_plugin.py diff --git a/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/pycodestyle_tool_plugin.py b/src/statick_tool/plugins/tool/pycodestyle_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/pycodestyle_tool_plugin.py rename to src/statick_tool/plugins/tool/pycodestyle_tool_plugin.py diff --git a/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/pydocstyle_tool_plugin.py b/src/statick_tool/plugins/tool/pydocstyle_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/pydocstyle_tool_plugin.py rename to src/statick_tool/plugins/tool/pydocstyle_tool_plugin.py diff --git a/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/pyflakes_tool_plugin.py b/src/statick_tool/plugins/tool/pyflakes_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/pyflakes_tool_plugin.py rename to src/statick_tool/plugins/tool/pyflakes_tool_plugin.py diff --git a/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/pylint_tool_plugin.py b/src/statick_tool/plugins/tool/pylint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/pylint_tool_plugin.py rename to src/statick_tool/plugins/tool/pylint_tool_plugin.py diff --git a/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/ruff_tool_plugin.py b/src/statick_tool/plugins/tool/ruff_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/ruff_tool_plugin.py rename to src/statick_tool/plugins/tool/ruff_tool_plugin.py diff --git a/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/shellcheck_tool_plugin.py b/src/statick_tool/plugins/tool/shellcheck_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/shellcheck_tool_plugin.py rename to src/statick_tool/plugins/tool/shellcheck_tool_plugin.py diff --git a/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/spotbugs_tool_plugin.py b/src/statick_tool/plugins/tool/spotbugs_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/spotbugs_tool_plugin.py rename to src/statick_tool/plugins/tool/spotbugs_tool_plugin.py diff --git a/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/uncrustify_tool_plugin.py b/src/statick_tool/plugins/tool/uncrustify_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/uncrustify_tool_plugin.py rename to src/statick_tool/plugins/tool/uncrustify_tool_plugin.py diff --git a/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/xmllint_tool_plugin.py b/src/statick_tool/plugins/tool/xmllint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/xmllint_tool_plugin.py rename to src/statick_tool/plugins/tool/xmllint_tool_plugin.py diff --git a/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin diff --git a/statick_tool/plugins/tool/yamllint_tool_plugin.py b/src/statick_tool/plugins/tool/yamllint_tool_plugin.py similarity index 100% rename from statick_tool/plugins/tool/yamllint_tool_plugin.py rename to src/statick_tool/plugins/tool/yamllint_tool_plugin.py diff --git a/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin similarity index 100% rename from statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin rename to src/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin diff --git a/statick_tool/profile.py b/src/statick_tool/profile.py similarity index 100% rename from statick_tool/profile.py rename to src/statick_tool/profile.py diff --git a/statick_tool/reporting_plugin.py b/src/statick_tool/reporting_plugin.py similarity index 100% rename from statick_tool/reporting_plugin.py rename to src/statick_tool/reporting_plugin.py diff --git a/statick_tool/resources.py b/src/statick_tool/resources.py similarity index 100% rename from statick_tool/resources.py rename to src/statick_tool/resources.py diff --git a/statick_tool/rsc/.clang-format b/src/statick_tool/rsc/.clang-format similarity index 100% rename from statick_tool/rsc/.clang-format rename to src/statick_tool/rsc/.clang-format diff --git a/statick_tool/rsc/.groovylintrc.json b/src/statick_tool/rsc/.groovylintrc.json similarity index 100% rename from statick_tool/rsc/.groovylintrc.json rename to src/statick_tool/rsc/.groovylintrc.json diff --git a/statick_tool/rsc/CMakeLists.txt.in b/src/statick_tool/rsc/CMakeLists.txt.in similarity index 100% rename from statick_tool/rsc/CMakeLists.txt.in rename to src/statick_tool/rsc/CMakeLists.txt.in diff --git a/statick_tool/rsc/_clang-format b/src/statick_tool/rsc/_clang-format similarity index 100% rename from statick_tool/rsc/_clang-format rename to src/statick_tool/rsc/_clang-format diff --git a/statick_tool/rsc/cccc.opt b/src/statick_tool/rsc/cccc.opt similarity index 100% rename from statick_tool/rsc/cccc.opt rename to src/statick_tool/rsc/cccc.opt diff --git a/statick_tool/rsc/config.yaml b/src/statick_tool/rsc/config.yaml similarity index 100% rename from statick_tool/rsc/config.yaml rename to src/statick_tool/rsc/config.yaml diff --git a/statick_tool/rsc/discovery_only.yaml b/src/statick_tool/rsc/discovery_only.yaml similarity index 100% rename from statick_tool/rsc/discovery_only.yaml rename to src/statick_tool/rsc/discovery_only.yaml diff --git a/statick_tool/rsc/documentation.yaml b/src/statick_tool/rsc/documentation.yaml similarity index 100% rename from statick_tool/rsc/documentation.yaml rename to src/statick_tool/rsc/documentation.yaml diff --git a/statick_tool/rsc/exceptions.yaml b/src/statick_tool/rsc/exceptions.yaml similarity index 100% rename from statick_tool/rsc/exceptions.yaml rename to src/statick_tool/rsc/exceptions.yaml diff --git a/statick_tool/rsc/gauntlet_ignore.yaml b/src/statick_tool/rsc/gauntlet_ignore.yaml similarity index 100% rename from statick_tool/rsc/gauntlet_ignore.yaml rename to src/statick_tool/rsc/gauntlet_ignore.yaml diff --git a/statick_tool/rsc/plugin_mapping/clang-tidy.txt b/src/statick_tool/rsc/plugin_mapping/clang-tidy.txt similarity index 100% rename from statick_tool/rsc/plugin_mapping/clang-tidy.txt rename to src/statick_tool/rsc/plugin_mapping/clang-tidy.txt diff --git a/statick_tool/rsc/plugin_mapping/code_climate.txt b/src/statick_tool/rsc/plugin_mapping/code_climate.txt similarity index 100% rename from statick_tool/rsc/plugin_mapping/code_climate.txt rename to src/statick_tool/rsc/plugin_mapping/code_climate.txt diff --git a/statick_tool/rsc/plugin_mapping/cppcheck.txt b/src/statick_tool/rsc/plugin_mapping/cppcheck.txt similarity index 100% rename from statick_tool/rsc/plugin_mapping/cppcheck.txt rename to src/statick_tool/rsc/plugin_mapping/cppcheck.txt diff --git a/statick_tool/rsc/plugin_mapping/make.txt b/src/statick_tool/rsc/plugin_mapping/make.txt similarity index 100% rename from statick_tool/rsc/plugin_mapping/make.txt rename to src/statick_tool/rsc/plugin_mapping/make.txt diff --git a/statick_tool/rsc/plugin_mapping/perlcritic.txt b/src/statick_tool/rsc/plugin_mapping/perlcritic.txt similarity index 100% rename from statick_tool/rsc/plugin_mapping/perlcritic.txt rename to src/statick_tool/rsc/plugin_mapping/perlcritic.txt diff --git a/statick_tool/rsc/plugin_mapping/spotbugs.txt b/src/statick_tool/rsc/plugin_mapping/spotbugs.txt similarity index 100% rename from statick_tool/rsc/plugin_mapping/spotbugs.txt rename to src/statick_tool/rsc/plugin_mapping/spotbugs.txt diff --git a/statick_tool/rsc/profile.yaml b/src/statick_tool/rsc/profile.yaml similarity index 100% rename from statick_tool/rsc/profile.yaml rename to src/statick_tool/rsc/profile.yaml diff --git a/statick_tool/rsc/sei_cert.yaml b/src/statick_tool/rsc/sei_cert.yaml similarity index 100% rename from statick_tool/rsc/sei_cert.yaml rename to src/statick_tool/rsc/sei_cert.yaml diff --git a/statick_tool/rsc/self_check.yaml b/src/statick_tool/rsc/self_check.yaml similarity index 100% rename from statick_tool/rsc/self_check.yaml rename to src/statick_tool/rsc/self_check.yaml diff --git a/statick_tool/rsc/spotbugs-security.xml b/src/statick_tool/rsc/spotbugs-security.xml similarity index 100% rename from statick_tool/rsc/spotbugs-security.xml rename to src/statick_tool/rsc/spotbugs-security.xml diff --git a/statick_tool/rsc/ultimate.yaml b/src/statick_tool/rsc/ultimate.yaml similarity index 100% rename from statick_tool/rsc/ultimate.yaml rename to src/statick_tool/rsc/ultimate.yaml diff --git a/statick_tool/rsc/uncrustify.cfg b/src/statick_tool/rsc/uncrustify.cfg similarity index 100% rename from statick_tool/rsc/uncrustify.cfg rename to src/statick_tool/rsc/uncrustify.cfg diff --git a/statick b/src/statick_tool/statick.py similarity index 76% rename from statick rename to src/statick_tool/statick.py index ee1f10ca..9a2279c3 100755 --- a/statick +++ b/src/statick_tool/statick.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Executable script for running statick against a single package.""" +"""Executable script for running Statick against one or more packages.""" import argparse import sys @@ -8,11 +8,13 @@ from tabulate import tabulate from statick_tool.args import Args -from statick_tool.statick import Statick +from statick_tool.statick_tool import Statick -def run(statick: Statick, parsed_args: argparse.Namespace, start_time: float) -> bool: - """Run statick on a single package.""" +def run( + statick: Statick, parsed_args: argparse.Namespace, start_time: float +) -> bool: # pragma: no cover + """Run Statick on a single package.""" path = parsed_args.path issues, success = statick.run(path, parsed_args, start_time) if issues is None: @@ -24,8 +26,8 @@ def run(statick: Statick, parsed_args: argparse.Namespace, start_time: float) -> return success -def main() -> None: - """Run statick.""" +def main() -> None: # pragma: no cover + """Run Statick.""" start_time: float = time.time() args = Args("Statick tool") args.parser.add_argument("path", help="Path of package or workspace to scan") @@ -54,5 +56,5 @@ def main() -> None: sys.exit(0) -if __name__ == "__main__": +if __name__ == "__main__": # pragma: no cover main() diff --git a/statick_tool/statick.py b/src/statick_tool/statick_tool.py similarity index 99% rename from statick_tool/statick.py rename to src/statick_tool/statick_tool.py index edc41ac4..3a34b855 100644 --- a/statick_tool/statick.py +++ b/src/statick_tool/statick_tool.py @@ -10,9 +10,9 @@ from logging.handlers import MemoryHandler from typing import Any, Dict, List, Optional, Tuple +import pkg_resources from yapsy.PluginManager import PluginManager -from statick_tool import __version__ from statick_tool.config import Config from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions @@ -193,7 +193,7 @@ def gather_args(self, args: argparse.ArgumentParser) -> None: args.add_argument( "--version", action="version", - version=f"%(prog)s {__version__}", + version=f"%(prog)s {pkg_resources.get_distribution('statick').version}", ) args.add_argument( "--mapping-file-suffix", diff --git a/statick_tool/timing.py b/src/statick_tool/timing.py similarity index 100% rename from statick_tool/timing.py rename to src/statick_tool/timing.py diff --git a/statick_tool/tool_plugin.py b/src/statick_tool/tool_plugin.py similarity index 100% rename from statick_tool/tool_plugin.py rename to src/statick_tool/tool_plugin.py diff --git a/tests/statick/rsc/config-discovery-dependency.yaml b/tests/statick_tool/rsc/config-discovery-dependency.yaml similarity index 100% rename from tests/statick/rsc/config-discovery-dependency.yaml rename to tests/statick_tool/rsc/config-discovery-dependency.yaml diff --git a/tests/statick/rsc/config-enabled-dependency.yaml b/tests/statick_tool/rsc/config-enabled-dependency.yaml similarity index 100% rename from tests/statick/rsc/config-enabled-dependency.yaml rename to tests/statick_tool/rsc/config-enabled-dependency.yaml diff --git a/tests/statick/rsc/config-invalid-reporting-plugins.yaml b/tests/statick_tool/rsc/config-invalid-reporting-plugins.yaml similarity index 100% rename from tests/statick/rsc/config-invalid-reporting-plugins.yaml rename to tests/statick_tool/rsc/config-invalid-reporting-plugins.yaml diff --git a/tests/statick/rsc/config-missing-tool-dependency.yaml b/tests/statick_tool/rsc/config-missing-tool-dependency.yaml similarity index 100% rename from tests/statick/rsc/config-missing-tool-dependency.yaml rename to tests/statick_tool/rsc/config-missing-tool-dependency.yaml diff --git a/tests/statick/rsc/config-missing-tool.yaml b/tests/statick_tool/rsc/config-missing-tool.yaml similarity index 100% rename from tests/statick/rsc/config-missing-tool.yaml rename to tests/statick_tool/rsc/config-missing-tool.yaml diff --git a/tests/statick/rsc/config-no-reporting-plugins.yaml b/tests/statick_tool/rsc/config-no-reporting-plugins.yaml similarity index 100% rename from tests/statick/rsc/config-no-reporting-plugins.yaml rename to tests/statick_tool/rsc/config-no-reporting-plugins.yaml diff --git a/tests/statick/rsc/config-test.yaml b/tests/statick_tool/rsc/config-test.yaml similarity index 100% rename from tests/statick/rsc/config-test.yaml rename to tests/statick_tool/rsc/config-test.yaml diff --git a/tests/statick/rsc/config.yaml b/tests/statick_tool/rsc/config.yaml similarity index 100% rename from tests/statick/rsc/config.yaml rename to tests/statick_tool/rsc/config.yaml diff --git a/tests/statick/rsc/exceptions-test.yaml b/tests/statick_tool/rsc/exceptions-test.yaml similarity index 100% rename from tests/statick/rsc/exceptions-test.yaml rename to tests/statick_tool/rsc/exceptions-test.yaml diff --git a/tests/statick/rsc/exceptions.yaml b/tests/statick_tool/rsc/exceptions.yaml similarity index 100% rename from tests/statick/rsc/exceptions.yaml rename to tests/statick_tool/rsc/exceptions.yaml diff --git a/tests/statick/rsc/packages-file-test.txt b/tests/statick_tool/rsc/packages-file-test.txt similarity index 100% rename from tests/statick/rsc/packages-file-test.txt rename to tests/statick_tool/rsc/packages-file-test.txt diff --git a/tests/statick/rsc/profile-custom.yaml b/tests/statick_tool/rsc/profile-custom.yaml similarity index 100% rename from tests/statick/rsc/profile-custom.yaml rename to tests/statick_tool/rsc/profile-custom.yaml diff --git a/tests/statick/rsc/profile-missing-reporting-plugin.yaml b/tests/statick_tool/rsc/profile-missing-reporting-plugin.yaml similarity index 100% rename from tests/statick/rsc/profile-missing-reporting-plugin.yaml rename to tests/statick_tool/rsc/profile-missing-reporting-plugin.yaml diff --git a/tests/statick/rsc/profile-missing-tool.yaml b/tests/statick_tool/rsc/profile-missing-tool.yaml similarity index 100% rename from tests/statick/rsc/profile-missing-tool.yaml rename to tests/statick_tool/rsc/profile-missing-tool.yaml diff --git a/tests/statick/rsc/profile-test.yaml b/tests/statick_tool/rsc/profile-test.yaml similarity index 100% rename from tests/statick/rsc/profile-test.yaml rename to tests/statick_tool/rsc/profile-test.yaml diff --git a/tests/statick/test_package/hello b/tests/statick_tool/test_package/hello similarity index 100% rename from tests/statick/test_package/hello rename to tests/statick_tool/test_package/hello diff --git a/tests/statick/test_statick.py b/tests/statick_tool/test_statick_tool.py similarity index 98% rename from tests/statick/test_statick.py rename to tests/statick_tool/test_statick_tool.py index 60a81442..dfd7d583 100644 --- a/tests/statick/test_statick.py +++ b/tests/statick_tool/test_statick_tool.py @@ -1,4 +1,4 @@ -"""Unit tests of statick.py.""" +"""Unit tests of statick_tool.py.""" import contextlib import logging @@ -16,7 +16,7 @@ from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.package import Package from statick_tool.plugins.tool.clang_tidy_tool_plugin import ClangTidyToolPlugin -from statick_tool.statick import Statick +from statick_tool.statick_tool import Statick LOGGER = logging.getLogger(__name__) @@ -160,7 +160,7 @@ def test_get_level_nonexistent_file(init_statick): assert level is None -@mock.patch("statick_tool.statick.Profile") +@mock.patch("statick_tool.statick_tool.Profile") def test_get_level_ioerror(mocked_profile_constructor, init_statick): """Test the behavior when Profile throws an OSError. @@ -176,7 +176,7 @@ def test_get_level_ioerror(mocked_profile_constructor, init_statick): assert level is None -@mock.patch("statick_tool.statick.Profile") +@mock.patch("statick_tool.statick_tool.Profile") def test_get_level_valueerror(mocked_profile_constructor, init_statick): """Test the behavior when Profile throws a ValueError.""" mocked_profile_constructor.side_effect = ValueError("error") @@ -226,7 +226,7 @@ def test_custom_config_file(init_statick): assert has_level -@mock.patch("statick_tool.statick.Config") +@mock.patch("statick_tool.statick_tool.Config") def test_get_config_valueerror(mocked_config_constructor, init_statick): """Test the behavior when Config throws a ValueError.""" mocked_config_constructor.side_effect = ValueError("error") @@ -238,7 +238,7 @@ def test_get_config_valueerror(mocked_config_constructor, init_statick): assert init_statick.config is None -@mock.patch("statick_tool.statick.Config") +@mock.patch("statick_tool.statick_tool.Config") def test_get_config_oserror(mocked_config_constructor, init_statick): """Test the behavior when Config throws a OSError.""" mocked_config_constructor.side_effect = OSError("error") @@ -250,7 +250,7 @@ def test_get_config_oserror(mocked_config_constructor, init_statick): assert init_statick.config is None -@mock.patch("statick_tool.statick.Exceptions") +@mock.patch("statick_tool.statick_tool.Exceptions") def test_get_exceptions_valueerror(mocked_exceptions_constructor, init_statick): """Test the behavior when Exceptions throws a ValueError.""" mocked_exceptions_constructor.side_effect = ValueError("error") @@ -262,7 +262,7 @@ def test_get_exceptions_valueerror(mocked_exceptions_constructor, init_statick): assert init_statick.exceptions is None -@mock.patch("statick_tool.statick.Exceptions") +@mock.patch("statick_tool.statick_tool.Exceptions") def test_get_exceptions_oserror(mocked_exceptions_constructor, init_statick): """Test the behavior when Exceptions throws a OSError.""" mocked_exceptions_constructor.side_effect = OSError("error") @@ -296,7 +296,7 @@ def test_run(): for tool in issues: assert not issues[tool] try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -315,7 +315,7 @@ def test_run_missing_path(init_statick): assert issues is None assert not success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -341,7 +341,7 @@ def test_run_missing_config(init_statick): assert issues is None assert not success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default_value")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -369,7 +369,7 @@ def test_run_output_is_not_directory(mocked_mkdir, init_statick): assert issues is None assert not success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -392,7 +392,7 @@ def test_run_force_tool_list(init_statick): assert not issues[tool] assert success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -421,7 +421,7 @@ def test_run_package_is_ignored(init_statick): assert not issues assert success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -734,7 +734,7 @@ def test_run_invalid_level(init_statick): assert issues is None assert not success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -765,7 +765,7 @@ def test_run_mkdir_oserror(mocked_mkdir, init_statick): assert issues is None assert not success try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -832,7 +832,7 @@ def test_run_called_process_error(mock_subprocess_check_output): for tool in issues: assert not issues[tool] try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") @@ -1338,7 +1338,7 @@ def test_scan_package(init_statick_ws): assert issues is None try: - shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick-default")) + shutil.rmtree(os.path.join(os.path.dirname(__file__), "statick_tool-default")) except OSError as ex: print(f"Error: {ex}") diff --git a/tests/statick/test_workspace/ignore_package/AMENT_IGNORE b/tests/statick_tool/test_workspace/ignore_package/AMENT_IGNORE similarity index 100% rename from tests/statick/test_workspace/ignore_package/AMENT_IGNORE rename to tests/statick_tool/test_workspace/ignore_package/AMENT_IGNORE diff --git a/tests/statick/test_workspace/ignore_package/package.xml b/tests/statick_tool/test_workspace/ignore_package/package.xml similarity index 100% rename from tests/statick/test_workspace/ignore_package/package.xml rename to tests/statick_tool/test_workspace/ignore_package/package.xml diff --git a/tests/statick/test_workspace/test_package/hello b/tests/statick_tool/test_workspace/test_package/hello similarity index 100% rename from tests/statick/test_workspace/test_package/hello rename to tests/statick_tool/test_workspace/test_package/hello diff --git a/tests/statick/test_workspace/test_package/package.xml b/tests/statick_tool/test_workspace/test_package/package.xml similarity index 100% rename from tests/statick/test_workspace/test_package/package.xml rename to tests/statick_tool/test_workspace/test_package/package.xml diff --git a/tests/statick/test_workspace/test_package2/hello b/tests/statick_tool/test_workspace/test_package2/hello similarity index 100% rename from tests/statick/test_workspace/test_package2/hello rename to tests/statick_tool/test_workspace/test_package2/hello diff --git a/tests/statick/test_workspace/test_package2/package.xml b/tests/statick_tool/test_workspace/test_package2/package.xml similarity index 100% rename from tests/statick/test_workspace/test_package2/package.xml rename to tests/statick_tool/test_workspace/test_package2/package.xml diff --git a/tox.ini b/tox.ini index 755131e7..2c1a2fa9 100644 --- a/tox.ini +++ b/tox.ini @@ -5,26 +5,6 @@ skip_missing_interpreters = true [pytest] norecursedirs = .tox build docs examples -# To work with black some items must be ignored. -# https://github.com/psf/black#how-black-wraps-lines -# We also set a HUGE maximum line length so that black is in charge of our line lengths, not flake8. -[flake8] -exclude = .tox,tests/plugins/tool/black_tool_plugin/valid_package/format_errors.py,tests/plugins/tool/isort_tool_plugin/valid_package/*.py -ignore = E126, E203, E231, E241, W503, W504 -max-line-length = 9000 - -# To work with black a specific configuration is required. -# https://github.com/psf/black#how-black-wraps-lines -[isort] -known_first_party = statick_tool -multi_line_output = 3 -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -line_length = 88 -honor_noqa = True -skip_glob = **/tests/plugins/tool/isort_tool_plugin/valid_package/*.py - [gh-actions] python = 3.8: py38 @@ -37,19 +17,10 @@ changedir = {toxinidir}/output-{envname} passenv = CI setenv = PY_IGNORE_IMPORTMISMATCH = 1 deps = - deprecated - flake8<5 # Pin until https://github.com/tholo/pytest-flake8/issues/87 is fixed. - flake8-pep3101 - pycodestyle - pydocstyle - pytest - pytest-cov - pytest-flake8 - pytest-isort .[test] commands = pytest \ - --cov={toxinidir}/statick_tool \ + --cov={toxinidir}/src/statick_tool \ --cov-report term-missing \ --doctest-modules \ --junit-xml=statick-{envname}-junit.xml \ From d0487e4ecb276f277fdc038271e128307bbc0d5d Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 21 Nov 2023 20:58:46 -0800 Subject: [PATCH 03/58] Switch from yapsy to standard Python plugins. --- README.md | 54 +++++++++++-------- pyproject.toml | 54 +++++++++++++++++-- src/statick_tool/discovery_plugin.py | 4 +- .../discovery/{c_discovery_plugin.py => c.py} | 0 .../discovery/c_discovery_plugin.yapsy-plugin | 3 -- .../{cmake_discovery_plugin.py => cmake.py} | 0 .../cmake_discovery_plugin.yapsy-plugin | 3 -- .../{groovy_discovery_plugin.py => groovy.py} | 0 .../groovy_discovery_plugin.yapsy-plugin | 3 -- .../{java_discovery_plugin.py => java.py} | 0 .../java_discovery_plugin.yapsy-plugin | 3 -- .../{maven_discovery_plugin.py => maven.py} | 0 .../maven_discovery_plugin.yapsy-plugin | 3 -- .../{perl_discovery_plugin.py => perl.py} | 0 .../perl_discovery_plugin.yapsy-plugin | 3 -- .../{python_discovery_plugin.py => python.py} | 0 .../python_discovery_plugin.yapsy-plugin | 3 -- .../{ros_discovery_plugin.py => ros.py} | 0 .../ros_discovery_plugin.yapsy-plugin | 3 -- .../{shell_discovery_plugin.py => shell.py} | 0 .../shell_discovery_plugin.yapsy-plugin | 3 -- .../{xml_discovery_plugin.py => xml.py} | 0 .../xml_discovery_plugin.yapsy-plugin | 3 -- .../{yaml_discovery_plugin.py => yaml.py} | 0 .../yaml_discovery_plugin.yapsy-plugin | 3 -- ...te_reporting_plugin.py => code_climate.py} | 0 ...code_climate_reporting_plugin.yapsy-plugin | 3 -- ...hing_reporting_plugin.py => do_nothing.py} | 0 .../do_nothing_reporting_plugin.yapsy-plugin | 3 -- .../{json_reporting_plugin.py => json.py} | 0 .../json_reporting_plugin.yapsy-plugin | 3 -- ...eporting_plugin.py => print_to_console.py} | 0 ...t_to_console_reporting_plugin.yapsy-plugin | 3 -- ...plugin.py => write_jenkins_warnings_ng.py} | 0 ..._warnings_ng_reporting_plugin.yapsy-plugin | 3 -- .../tool/{bandit_tool_plugin.py => bandit.py} | 0 .../tool/bandit_tool_plugin.yapsy-plugin | 3 -- .../tool/{black_tool_plugin.py => black.py} | 0 .../tool/black_tool_plugin.yapsy-plugin | 3 -- ...kin_lint_tool_plugin.py => catkin_lint.py} | 0 .../tool/catkin_lint_tool_plugin.yapsy-plugin | 3 -- .../tool/{cccc_tool_plugin.py => cccc.py} | 0 .../tool/cccc_tool_plugin.yapsy-plugin | 3 -- ..._format_tool_plugin.py => clang_format.py} | 0 .../clang_format_tool_plugin.yapsy-plugin | 3 -- ...lang_tidy_tool_plugin.py => clang_tidy.py} | 0 .../tool/clang_tidy_tool_plugin.yapsy-plugin | 3 -- ...{cmakelint_tool_plugin.py => cmakelint.py} | 0 .../tool/cmakelint_tool_plugin.yapsy-plugin | 3 -- .../{cppcheck_tool_plugin.py => cppcheck.py} | 0 .../tool/cppcheck_tool_plugin.yapsy-plugin | 3 -- .../{cpplint_tool_plugin.py => cpplint.py} | 0 .../tool/cpplint_tool_plugin.yapsy-plugin | 3 -- ...o_nothing_tool_plugin.py => do_nothing.py} | 0 .../tool/do_nothing_tool_plugin.yapsy-plugin | 3 -- ...rmatter_tool_plugin.py => docformatter.py} | 0 .../docformatter_tool_plugin.yapsy-plugin | 3 -- ...lawfinder_tool_plugin.py => flawfinder.py} | 0 .../tool/flawfinder_tool_plugin.yapsy-plugin | 3 -- ...roovylint_tool_plugin.py => groovylint.py} | 0 .../tool/groovylint_tool_plugin.yapsy-plugin | 3 -- .../tool/{isort_tool_plugin.py => isort.py} | 0 .../tool/isort_tool_plugin.yapsy-plugin | 3 -- .../tool/{lizard_tool_plugin.py => lizard.py} | 0 .../tool/lizard_tool_plugin.yapsy-plugin | 3 -- .../tool/{make_tool_plugin.py => make.py} | 0 .../tool/make_tool_plugin.yapsy-plugin | 3 -- .../tool/{mypy_tool_plugin.py => mypy.py} | 0 .../tool/mypy_tool_plugin.yapsy-plugin | 3 -- ...erlcritic_tool_plugin.py => perlcritic.py} | 0 .../tool/perlcritic_tool_plugin.yapsy-plugin | 3 -- ...odestyle_tool_plugin.py => pycodestyle.py} | 0 .../tool/pycodestyle_tool_plugin.yapsy-plugin | 3 -- ...ydocstyle_tool_plugin.py => pydocstyle.py} | 0 .../tool/pydocstyle_tool_plugin.yapsy-plugin | 3 -- .../{pyflakes_tool_plugin.py => pyflakes.py} | 0 .../tool/pyflakes_tool_plugin.yapsy-plugin | 3 -- .../tool/{pylint_tool_plugin.py => pylint.py} | 0 .../tool/pylint_tool_plugin.yapsy-plugin | 3 -- .../tool/{ruff_tool_plugin.py => ruff.py} | 0 .../tool/ruff_tool_plugin.yapsy-plugin | 3 -- ...hellcheck_tool_plugin.py => shellcheck.py} | 0 .../tool/shellcheck_tool_plugin.yapsy-plugin | 3 -- .../{spotbugs_tool_plugin.py => spotbugs.py} | 0 .../tool/spotbugs_tool_plugin.yapsy-plugin | 3 -- ...ncrustify_tool_plugin.py => uncrustify.py} | 0 .../tool/uncrustify_tool_plugin.yapsy-plugin | 3 -- .../{xmllint_tool_plugin.py => xmllint.py} | 0 .../tool/xmllint_tool_plugin.yapsy-plugin | 3 -- .../{yamllint_tool_plugin.py => yamllint.py} | 0 .../tool/yamllint_tool_plugin.yapsy-plugin | 3 -- src/statick_tool/reporting_plugin.py | 4 +- src/statick_tool/statick_tool.py | 51 ++++++++---------- src/statick_tool/tool_plugin.py | 4 +- 94 files changed, 107 insertions(+), 196 deletions(-) rename src/statick_tool/plugins/discovery/{c_discovery_plugin.py => c.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{cmake_discovery_plugin.py => cmake.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{groovy_discovery_plugin.py => groovy.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{java_discovery_plugin.py => java.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{maven_discovery_plugin.py => maven.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{perl_discovery_plugin.py => perl.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{python_discovery_plugin.py => python.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{ros_discovery_plugin.py => ros.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{shell_discovery_plugin.py => shell.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{xml_discovery_plugin.py => xml.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/discovery/{yaml_discovery_plugin.py => yaml.py} (100%) delete mode 100644 src/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin rename src/statick_tool/plugins/reporting/{code_climate_reporting_plugin.py => code_climate.py} (100%) delete mode 100644 src/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin rename src/statick_tool/plugins/reporting/{do_nothing_reporting_plugin.py => do_nothing.py} (100%) delete mode 100644 src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin rename src/statick_tool/plugins/reporting/{json_reporting_plugin.py => json.py} (100%) delete mode 100644 src/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin rename src/statick_tool/plugins/reporting/{print_to_console_reporting_plugin.py => print_to_console.py} (100%) delete mode 100644 src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin rename src/statick_tool/plugins/reporting/{write_jenkins_warnings_ng_reporting_plugin.py => write_jenkins_warnings_ng.py} (100%) delete mode 100644 src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{bandit_tool_plugin.py => bandit.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{black_tool_plugin.py => black.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{catkin_lint_tool_plugin.py => catkin_lint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{cccc_tool_plugin.py => cccc.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{clang_format_tool_plugin.py => clang_format.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{clang_tidy_tool_plugin.py => clang_tidy.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{cmakelint_tool_plugin.py => cmakelint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{cppcheck_tool_plugin.py => cppcheck.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{cpplint_tool_plugin.py => cpplint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{do_nothing_tool_plugin.py => do_nothing.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{docformatter_tool_plugin.py => docformatter.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{flawfinder_tool_plugin.py => flawfinder.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{groovylint_tool_plugin.py => groovylint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{isort_tool_plugin.py => isort.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{lizard_tool_plugin.py => lizard.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{make_tool_plugin.py => make.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{mypy_tool_plugin.py => mypy.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{perlcritic_tool_plugin.py => perlcritic.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{pycodestyle_tool_plugin.py => pycodestyle.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{pydocstyle_tool_plugin.py => pydocstyle.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{pyflakes_tool_plugin.py => pyflakes.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{pylint_tool_plugin.py => pylint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{ruff_tool_plugin.py => ruff.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{shellcheck_tool_plugin.py => shellcheck.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{spotbugs_tool_plugin.py => spotbugs.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{uncrustify_tool_plugin.py => uncrustify.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{xmllint_tool_plugin.py => xmllint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin rename src/statick_tool/plugins/tool/{yamllint_tool_plugin.py => yamllint.py} (100%) delete mode 100644 src/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin diff --git a/README.md b/README.md index 500f5317..72407e3e 100644 --- a/README.md +++ b/README.md @@ -633,34 +633,43 @@ The resource file (in your _user path_) must be named `_clang-format`. If you have the need to support any type of _discovery_, _tool_, or _reporting_ plugin that does not come built-in with Statick then you can write a custom plugin. +Declare the plugin module as a [module entry point] in `pyproject.toml` and provide the path according to plugin type +(_discovery_, _tool_, _reporting_). -Plugins consist of both a Python file and a `yapsy` file. -For a description of how yapsy works, check out the [yapsy documentation](http://yapsy.sourceforge.net/). - -A _user path_ with some custom plugins may look like +A _user path_ with custom plugins and configuration files may look like ```shell -my_custom_config - setup.py - |- plugins - |- my_discovery_plugin - |- my_discovery_plugin.py - |- my_discovery_plugin.yapsy - |- my_tool_plugins - |- my_tool_plugin.py - |- my_tool_plugin.yapsy - |- my_other_tool_plugin.py - |- my_other_tool_plugin.yapsy - |- rsc - |- config.yaml - |- exceptions.yaml +my-custom-project + pyproject.toml + |- src + |- statick_tool + |- plugins + |- discovery + |- my_discovery_plugin.py + |- tool + |- my_tool_plugin.py + |- my_other_tool_plugin.py + |- rsc + |- config.yaml + |- exceptions.yaml +``` + +In `pyproject.toml` declare the plugins as entry points. + +```toml +[project.entry-points."statick_tool.plugins.discovery"] +my_discovery_name = "statick_tool.plugins.discovery.my_discovery_plugin:MyDiscoveryPlugin" + +[project.entry-points."statick_tool.plugins.tool"] +my_tool_name = "statick_tool.plugins.tool.my_tool_plugin:MyToolPlugin" +my_other_tool_name = "statick_tool.plugins.tool.my_other_tool_plugin:MyOtherToolPlugin" ``` For the actual implementation of a plugin, it is recommended to copy a suitable default plugin provided by Statick and modify as needed. -For the contents of `setup.py`, it is recommended to copy a working external plugin. -Some examples are [statick-fortify](https://github.com/soartech/statick-fortify) and [statick-tex](https://github.com/tdenewiler/statick-tex). +For the contents of `pyproject.toml`, it is recommended to copy a working external plugin. +Some examples are [statick-md] and [statick-tex]. Those plugins are set up in such a way that they work with Statick when released on PyPI. ## Examples @@ -878,6 +887,7 @@ His commits were scrubbed from git history upon the initial public release. [lizard]: https://github.com/terryyin/lizard [logging]: https://docs.python.org/3/howto/logging.html [make]: https://gcc.gnu.org/onlinedocs/libstdc++/index.html +[module entry point]: https://setuptools.pypa.io/en/latest/userguide/entry_point.html#entry-points-syntax [mypy]: https://github.com/python/mypy [npm-groovy-lint]: https://nvuillam.github.io/npm-groovy-lint/ [perlcritic]: http://perlcritic.com/ @@ -887,10 +897,12 @@ His commits were scrubbed from git history upon the initial public release. [pydocstyle]: http://www.pydocstyle.org/en/stable/ [pyflakes]: https://github.com/PyCQA/pyflakes [pylint]: https://pylint.org/ -[ruff]: https://github.com/charliermarsh/ruff [ros]: https://www.ros.org/ +[ruff]: https://github.com/charliermarsh/ruff [shellcheck]: https://github.com/koalaman/shellcheck [spotbugs]: https://github.com/spotbugs/spotbugs +[statick-md]: https://github.com/sscpac/statick-md +[statick-tex]: https://github.com/tdenewiler/statick-tex [uncrustify]: https://github.com/uncrustify/uncrustify [xmllint]: http://xmlsoft.org/ [yamllint]: https://yamllint.readthedocs.io/en/stable/ diff --git a/pyproject.toml b/pyproject.toml index a26f3829..0d16dede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,6 @@ dependencies = [ "types-tabulate", "xmltodict", "yamllint", - "yapsy", ] [project.scripts] @@ -51,14 +50,61 @@ statick = "statick_tool.statick:main" [tool.setuptools.package-data] statick_tool = [ - "plugins/discovery/*.yapsy-plugin", - "plugins/reporting/*.yapsy-plugin", - "plugins/tool/*.yapsy-plugin", "rsc/*", "rsc/.*", "rsc/plugin_mapping/*", ] +[project.entry-points."statick_tool.plugins.discovery"] +c = "statick_tool.plugins.discovery.c:CDiscoveryPlugin" +cmake = "statick_tool.plugins.discovery.cmake:CMakeDiscoveryPlugin" +groovy = "statick_tool.plugins.discovery.groovy:GroovyDiscoveryPlugin" +java = "statick_tool.plugins.discovery.java:JavaDiscoveryPlugin" +maven = "statick_tool.plugins.discovery.maven:MavenDiscoveryPlugin" +perl = "statick_tool.plugins.discovery.perl:PerlDiscoveryPlugin" +python = "statick_tool.plugins.discovery.python:PythonDiscoveryPlugin" +ros = "statick_tool.plugins.discovery.ros:RosDiscoveryPlugin" +shell = "statick_tool.plugins.discovery.shell:ShellDiscoveryPlugin" +xml = "statick_tool.plugins.discovery.xml:XMLDiscoveryPlugin" +yaml = "statick_tool.plugins.discovery.yaml:YAMLDiscoveryPlugin" + +[project.entry-points."statick_tool.plugins.reporting"] +code_climate = "statick_tool.plugins.reporting.code_climate:CodeClimateReportingPlugin" +do_nothing = "statick_tool.plugins.reporting.do_nothing:DoNothingReportingPlugin" +json = "statick_tool.plugins.reporting.json:JsonReportingPlugin" +print_to_console = "statick_tool.plugins.reporting.print_to_console:PrintToConsoleReportingPlugin" +write_jenkins_warnings_ng = "statick_tool.plugins.reporting.write_jenkins_warnings_ng:WriteJenkinsWarningsNGReportingPlugin" + +[project.entry-points."statick_tool.plugins.tool"] +bandit = "statick_tool.plugins.tool.bandit:BanditToolPlugin" +black = "statick_tool.plugins.tool.black:BlackToolPlugin" +catkin_lint = "statick_tool.plugins.tool.catkin_lint:CatkinLintToolPlugin" +cccc = "statick_tool.plugins.tool.cccc:CCCCToolPlugin" +clang_format = "statick_tool.plugins.tool.clang_format:ClangFormatToolPlugin" +clang_tidy = "statick_tool.plugins.tool.clang_tidy:ClangTidyToolPlugin" +cmakelint = "statick_tool.plugins.tool.cmakelint:CMakelintToolPlugin" +cppcheck = "statick_tool.plugins.tool.cppcheck:CppcheckToolPlugin" +cpplint = "statick_tool.plugins.tool.cpplint:CpplintToolPlugin" +docformatter = "statick_tool.plugins.tool.docformatter:DocformatterToolPlugin" +do_nothing = "statick_tool.plugins.tool.do_nothing:DoNothingToolPlugin" +flawfinder = "statick_tool.plugins.tool.flawfinder:FlawfinderToolPlugin" +groovylint = "statick_tool.plugins.tool.groovylint:GroovyLintToolPlugin" +isort = "statick_tool.plugins.tool.isort:IsortToolPlugin" +lizard = "statick_tool.plugins.tool.lizard:LizardToolPlugin" +make = "statick_tool.plugins.tool.make:MakeToolPlugin" +mypy = "statick_tool.plugins.tool.mypy:MypyToolPlugin" +perlcritic = "statick_tool.plugins.tool.perlcritic:PerlCriticToolPlugin" +pycodestyle = "statick_tool.plugins.tool.pycodestyle:PycodestyleToolPlugin" +pydocstyle = "statick_tool.plugins.tool.pydocstyle:PydocstyleToolPlugin" +pyflakes = "statick_tool.plugins.tool.pyflakes:PyflakesToolPlugin" +pylint = "statick_tool.plugins.tool.pylint:PylintToolPlugin" +ruff = "statick_tool.plugins.tool.ruff:RuffToolPlugin" +shellcheck = "statick_tool.plugins.tool.shellcheck:ShellcheckToolPlugin" +spotbugs = "statick_tool.plugins.tool.spotbugs:SpotbugsToolPlugin" +uncrustify = "statick_tool.plugins.tool.uncrustify:UncrustifyToolPlugin" +xmllint = "statick_tool.plugins.tool.xmllint:XmllintToolPlugin" +yamllint = "statick_tool.plugins.tool.yamllint:YamllintToolPlugin" + [project.urls] "Homepage" = "https://github.com/sscpac/statick" "Bug Tracker" = "https://github.com/sscpac/statick/issues" diff --git a/src/statick_tool/discovery_plugin.py b/src/statick_tool/discovery_plugin.py index 5051429d..47727c90 100644 --- a/src/statick_tool/discovery_plugin.py +++ b/src/statick_tool/discovery_plugin.py @@ -5,14 +5,12 @@ import sys from typing import Any, List, Optional, Union -from yapsy.IPlugin import IPlugin - from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -class DiscoveryPlugin(IPlugin): # type: ignore +class DiscoveryPlugin: """Default implementation of discovery plugin.""" plugin_context = None diff --git a/src/statick_tool/plugins/discovery/c_discovery_plugin.py b/src/statick_tool/plugins/discovery/c.py similarity index 100% rename from src/statick_tool/plugins/discovery/c_discovery_plugin.py rename to src/statick_tool/plugins/discovery/c.py diff --git a/src/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin deleted file mode 100644 index a1869c10..00000000 --- a/src/statick_tool/plugins/discovery/c_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = C/C++ Discovery Plugin -Module = c_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/cmake_discovery_plugin.py b/src/statick_tool/plugins/discovery/cmake.py similarity index 100% rename from src/statick_tool/plugins/discovery/cmake_discovery_plugin.py rename to src/statick_tool/plugins/discovery/cmake.py diff --git a/src/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin deleted file mode 100644 index 7b7f12a5..00000000 --- a/src/statick_tool/plugins/discovery/cmake_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = CMake Discovery Plugin -Module = cmake_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/groovy_discovery_plugin.py b/src/statick_tool/plugins/discovery/groovy.py similarity index 100% rename from src/statick_tool/plugins/discovery/groovy_discovery_plugin.py rename to src/statick_tool/plugins/discovery/groovy.py diff --git a/src/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin deleted file mode 100644 index 481ac040..00000000 --- a/src/statick_tool/plugins/discovery/groovy_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Groovy Discovery Plugin -Module = groovy_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/java_discovery_plugin.py b/src/statick_tool/plugins/discovery/java.py similarity index 100% rename from src/statick_tool/plugins/discovery/java_discovery_plugin.py rename to src/statick_tool/plugins/discovery/java.py diff --git a/src/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin deleted file mode 100644 index c45e9cf6..00000000 --- a/src/statick_tool/plugins/discovery/java_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Java Discovery Plugin -Module = java_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/maven_discovery_plugin.py b/src/statick_tool/plugins/discovery/maven.py similarity index 100% rename from src/statick_tool/plugins/discovery/maven_discovery_plugin.py rename to src/statick_tool/plugins/discovery/maven.py diff --git a/src/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin deleted file mode 100644 index 3f16d904..00000000 --- a/src/statick_tool/plugins/discovery/maven_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Maven Discovery Plugin -Module = maven_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/perl_discovery_plugin.py b/src/statick_tool/plugins/discovery/perl.py similarity index 100% rename from src/statick_tool/plugins/discovery/perl_discovery_plugin.py rename to src/statick_tool/plugins/discovery/perl.py diff --git a/src/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin deleted file mode 100644 index 2611bb9b..00000000 --- a/src/statick_tool/plugins/discovery/perl_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Perl Discovery Plugin -Module = perl_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/python_discovery_plugin.py b/src/statick_tool/plugins/discovery/python.py similarity index 100% rename from src/statick_tool/plugins/discovery/python_discovery_plugin.py rename to src/statick_tool/plugins/discovery/python.py diff --git a/src/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin deleted file mode 100644 index 4e46dad3..00000000 --- a/src/statick_tool/plugins/discovery/python_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Python Discovery Plugin -Module = python_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/ros_discovery_plugin.py b/src/statick_tool/plugins/discovery/ros.py similarity index 100% rename from src/statick_tool/plugins/discovery/ros_discovery_plugin.py rename to src/statick_tool/plugins/discovery/ros.py diff --git a/src/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin deleted file mode 100644 index 6ac392b7..00000000 --- a/src/statick_tool/plugins/discovery/ros_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = ROS Discovery Plugin -Module = ros_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/shell_discovery_plugin.py b/src/statick_tool/plugins/discovery/shell.py similarity index 100% rename from src/statick_tool/plugins/discovery/shell_discovery_plugin.py rename to src/statick_tool/plugins/discovery/shell.py diff --git a/src/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin deleted file mode 100644 index a5381d89..00000000 --- a/src/statick_tool/plugins/discovery/shell_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Shell Discovery Plugin -Module = shell_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/xml_discovery_plugin.py b/src/statick_tool/plugins/discovery/xml.py similarity index 100% rename from src/statick_tool/plugins/discovery/xml_discovery_plugin.py rename to src/statick_tool/plugins/discovery/xml.py diff --git a/src/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin deleted file mode 100644 index c8c944a4..00000000 --- a/src/statick_tool/plugins/discovery/xml_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = XML Discovery Plugin -Module = xml_discovery_plugin diff --git a/src/statick_tool/plugins/discovery/yaml_discovery_plugin.py b/src/statick_tool/plugins/discovery/yaml.py similarity index 100% rename from src/statick_tool/plugins/discovery/yaml_discovery_plugin.py rename to src/statick_tool/plugins/discovery/yaml.py diff --git a/src/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin b/src/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin deleted file mode 100644 index ac3ef60d..00000000 --- a/src/statick_tool/plugins/discovery/yaml_discovery_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = YAML Discovery Plugin -Module = yaml_discovery_plugin diff --git a/src/statick_tool/plugins/reporting/code_climate_reporting_plugin.py b/src/statick_tool/plugins/reporting/code_climate.py similarity index 100% rename from src/statick_tool/plugins/reporting/code_climate_reporting_plugin.py rename to src/statick_tool/plugins/reporting/code_climate.py diff --git a/src/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin deleted file mode 100644 index 914607a1..00000000 --- a/src/statick_tool/plugins/reporting/code_climate_reporting_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Code Climate Reporting Plugin -Module = code_climate_reporting_plugin diff --git a/src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.py b/src/statick_tool/plugins/reporting/do_nothing.py similarity index 100% rename from src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.py rename to src/statick_tool/plugins/reporting/do_nothing.py diff --git a/src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin deleted file mode 100644 index 3003f2dd..00000000 --- a/src/statick_tool/plugins/reporting/do_nothing_reporting_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Do Nothing Reporting Plugin -Module = do_nothing_reporting_plugin diff --git a/src/statick_tool/plugins/reporting/json_reporting_plugin.py b/src/statick_tool/plugins/reporting/json.py similarity index 100% rename from src/statick_tool/plugins/reporting/json_reporting_plugin.py rename to src/statick_tool/plugins/reporting/json.py diff --git a/src/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin deleted file mode 100644 index c45fecc0..00000000 --- a/src/statick_tool/plugins/reporting/json_reporting_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = JSON Reporting Plugin -Module = json_reporting_plugin diff --git a/src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.py b/src/statick_tool/plugins/reporting/print_to_console.py similarity index 100% rename from src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.py rename to src/statick_tool/plugins/reporting/print_to_console.py diff --git a/src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin deleted file mode 100644 index 4d8faac8..00000000 --- a/src/statick_tool/plugins/reporting/print_to_console_reporting_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Print To Console Reporting Plugin -Module = print_to_console_reporting_plugin diff --git a/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py b/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng.py similarity index 100% rename from src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.py rename to src/statick_tool/plugins/reporting/write_jenkins_warnings_ng.py diff --git a/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin b/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin deleted file mode 100644 index 9b487415..00000000 --- a/src/statick_tool/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Write Jenkins Warnings NG Reporting Plugin -Module = write_jenkins_warnings_ng_reporting_plugin diff --git a/src/statick_tool/plugins/tool/bandit_tool_plugin.py b/src/statick_tool/plugins/tool/bandit.py similarity index 100% rename from src/statick_tool/plugins/tool/bandit_tool_plugin.py rename to src/statick_tool/plugins/tool/bandit.py diff --git a/src/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin deleted file mode 100644 index 69e4e298..00000000 --- a/src/statick_tool/plugins/tool/bandit_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Bandit Tool Plugin -Module = bandit_tool_plugin diff --git a/src/statick_tool/plugins/tool/black_tool_plugin.py b/src/statick_tool/plugins/tool/black.py similarity index 100% rename from src/statick_tool/plugins/tool/black_tool_plugin.py rename to src/statick_tool/plugins/tool/black.py diff --git a/src/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin deleted file mode 100644 index 62dcc66d..00000000 --- a/src/statick_tool/plugins/tool/black_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Black Tool Plugin -Module = black_tool_plugin diff --git a/src/statick_tool/plugins/tool/catkin_lint_tool_plugin.py b/src/statick_tool/plugins/tool/catkin_lint.py similarity index 100% rename from src/statick_tool/plugins/tool/catkin_lint_tool_plugin.py rename to src/statick_tool/plugins/tool/catkin_lint.py diff --git a/src/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin deleted file mode 100644 index 5cd36a71..00000000 --- a/src/statick_tool/plugins/tool/catkin_lint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Catkin Lint Tool Plugin -Module = catkin_lint_tool_plugin diff --git a/src/statick_tool/plugins/tool/cccc_tool_plugin.py b/src/statick_tool/plugins/tool/cccc.py similarity index 100% rename from src/statick_tool/plugins/tool/cccc_tool_plugin.py rename to src/statick_tool/plugins/tool/cccc.py diff --git a/src/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin deleted file mode 100644 index 4174ef70..00000000 --- a/src/statick_tool/plugins/tool/cccc_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = CCCC Tool Plugin -Module = cccc_tool_plugin diff --git a/src/statick_tool/plugins/tool/clang_format_tool_plugin.py b/src/statick_tool/plugins/tool/clang_format.py similarity index 100% rename from src/statick_tool/plugins/tool/clang_format_tool_plugin.py rename to src/statick_tool/plugins/tool/clang_format.py diff --git a/src/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin deleted file mode 100644 index bb6a03a8..00000000 --- a/src/statick_tool/plugins/tool/clang_format_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = clang-format Tool Plugin -Module = clang_format_tool_plugin diff --git a/src/statick_tool/plugins/tool/clang_tidy_tool_plugin.py b/src/statick_tool/plugins/tool/clang_tidy.py similarity index 100% rename from src/statick_tool/plugins/tool/clang_tidy_tool_plugin.py rename to src/statick_tool/plugins/tool/clang_tidy.py diff --git a/src/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin deleted file mode 100644 index c196c142..00000000 --- a/src/statick_tool/plugins/tool/clang_tidy_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = clang-tidy Tool Plugin -Module = clang_tidy_tool_plugin diff --git a/src/statick_tool/plugins/tool/cmakelint_tool_plugin.py b/src/statick_tool/plugins/tool/cmakelint.py similarity index 100% rename from src/statick_tool/plugins/tool/cmakelint_tool_plugin.py rename to src/statick_tool/plugins/tool/cmakelint.py diff --git a/src/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin deleted file mode 100644 index 3053ea9d..00000000 --- a/src/statick_tool/plugins/tool/cmakelint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = cmakelint Tool Plugin -Module = cmakelint_tool_plugin diff --git a/src/statick_tool/plugins/tool/cppcheck_tool_plugin.py b/src/statick_tool/plugins/tool/cppcheck.py similarity index 100% rename from src/statick_tool/plugins/tool/cppcheck_tool_plugin.py rename to src/statick_tool/plugins/tool/cppcheck.py diff --git a/src/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin deleted file mode 100644 index 3a8a151e..00000000 --- a/src/statick_tool/plugins/tool/cppcheck_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Cppcheck Tool Plugin -Module = cppcheck_tool_plugin diff --git a/src/statick_tool/plugins/tool/cpplint_tool_plugin.py b/src/statick_tool/plugins/tool/cpplint.py similarity index 100% rename from src/statick_tool/plugins/tool/cpplint_tool_plugin.py rename to src/statick_tool/plugins/tool/cpplint.py diff --git a/src/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin deleted file mode 100644 index ff5a3cfe..00000000 --- a/src/statick_tool/plugins/tool/cpplint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Cpplint Tool Plugin -Module = cpplint_tool_plugin diff --git a/src/statick_tool/plugins/tool/do_nothing_tool_plugin.py b/src/statick_tool/plugins/tool/do_nothing.py similarity index 100% rename from src/statick_tool/plugins/tool/do_nothing_tool_plugin.py rename to src/statick_tool/plugins/tool/do_nothing.py diff --git a/src/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin deleted file mode 100644 index fc4d4b4d..00000000 --- a/src/statick_tool/plugins/tool/do_nothing_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Do Nothing Tool Plugin -Module = do_nothing_tool_plugin diff --git a/src/statick_tool/plugins/tool/docformatter_tool_plugin.py b/src/statick_tool/plugins/tool/docformatter.py similarity index 100% rename from src/statick_tool/plugins/tool/docformatter_tool_plugin.py rename to src/statick_tool/plugins/tool/docformatter.py diff --git a/src/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin deleted file mode 100644 index faf174b6..00000000 --- a/src/statick_tool/plugins/tool/docformatter_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Docformatter Tool Plugin -Module = docformatter_tool_plugin diff --git a/src/statick_tool/plugins/tool/flawfinder_tool_plugin.py b/src/statick_tool/plugins/tool/flawfinder.py similarity index 100% rename from src/statick_tool/plugins/tool/flawfinder_tool_plugin.py rename to src/statick_tool/plugins/tool/flawfinder.py diff --git a/src/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin deleted file mode 100644 index 6a0222e9..00000000 --- a/src/statick_tool/plugins/tool/flawfinder_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Flawfinder Tool Plugin -Module = flawfinder_tool_plugin diff --git a/src/statick_tool/plugins/tool/groovylint_tool_plugin.py b/src/statick_tool/plugins/tool/groovylint.py similarity index 100% rename from src/statick_tool/plugins/tool/groovylint_tool_plugin.py rename to src/statick_tool/plugins/tool/groovylint.py diff --git a/src/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin deleted file mode 100644 index 016b8e5a..00000000 --- a/src/statick_tool/plugins/tool/groovylint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = NPM Groovy Lint Tool Plugin -Module = groovylint_tool_plugin diff --git a/src/statick_tool/plugins/tool/isort_tool_plugin.py b/src/statick_tool/plugins/tool/isort.py similarity index 100% rename from src/statick_tool/plugins/tool/isort_tool_plugin.py rename to src/statick_tool/plugins/tool/isort.py diff --git a/src/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin deleted file mode 100644 index 1b101b83..00000000 --- a/src/statick_tool/plugins/tool/isort_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Isort Tool Plugin -Module = isort_tool_plugin diff --git a/src/statick_tool/plugins/tool/lizard_tool_plugin.py b/src/statick_tool/plugins/tool/lizard.py similarity index 100% rename from src/statick_tool/plugins/tool/lizard_tool_plugin.py rename to src/statick_tool/plugins/tool/lizard.py diff --git a/src/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin deleted file mode 100644 index da21452c..00000000 --- a/src/statick_tool/plugins/tool/lizard_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Lizard Tool Plugin -Module = lizard_tool_plugin diff --git a/src/statick_tool/plugins/tool/make_tool_plugin.py b/src/statick_tool/plugins/tool/make.py similarity index 100% rename from src/statick_tool/plugins/tool/make_tool_plugin.py rename to src/statick_tool/plugins/tool/make.py diff --git a/src/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin deleted file mode 100644 index 07357ff1..00000000 --- a/src/statick_tool/plugins/tool/make_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Make Tool Plugin -Module = make_tool_plugin diff --git a/src/statick_tool/plugins/tool/mypy_tool_plugin.py b/src/statick_tool/plugins/tool/mypy.py similarity index 100% rename from src/statick_tool/plugins/tool/mypy_tool_plugin.py rename to src/statick_tool/plugins/tool/mypy.py diff --git a/src/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin deleted file mode 100644 index 68fdbfd2..00000000 --- a/src/statick_tool/plugins/tool/mypy_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Mypy Tool Plugin -Module = mypy_tool_plugin diff --git a/src/statick_tool/plugins/tool/perlcritic_tool_plugin.py b/src/statick_tool/plugins/tool/perlcritic.py similarity index 100% rename from src/statick_tool/plugins/tool/perlcritic_tool_plugin.py rename to src/statick_tool/plugins/tool/perlcritic.py diff --git a/src/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin deleted file mode 100644 index 2da9e4da..00000000 --- a/src/statick_tool/plugins/tool/perlcritic_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Perl::Critic Tool Plugin -Module = perlcritic_tool_plugin diff --git a/src/statick_tool/plugins/tool/pycodestyle_tool_plugin.py b/src/statick_tool/plugins/tool/pycodestyle.py similarity index 100% rename from src/statick_tool/plugins/tool/pycodestyle_tool_plugin.py rename to src/statick_tool/plugins/tool/pycodestyle.py diff --git a/src/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin deleted file mode 100644 index 415a0480..00000000 --- a/src/statick_tool/plugins/tool/pycodestyle_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Pycodestyle Tool Plugin -Module = pycodestyle_tool_plugin diff --git a/src/statick_tool/plugins/tool/pydocstyle_tool_plugin.py b/src/statick_tool/plugins/tool/pydocstyle.py similarity index 100% rename from src/statick_tool/plugins/tool/pydocstyle_tool_plugin.py rename to src/statick_tool/plugins/tool/pydocstyle.py diff --git a/src/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin deleted file mode 100644 index 88e36e3f..00000000 --- a/src/statick_tool/plugins/tool/pydocstyle_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Pydocstyle Tool Plugin -Module = pydocstyle_tool_plugin diff --git a/src/statick_tool/plugins/tool/pyflakes_tool_plugin.py b/src/statick_tool/plugins/tool/pyflakes.py similarity index 100% rename from src/statick_tool/plugins/tool/pyflakes_tool_plugin.py rename to src/statick_tool/plugins/tool/pyflakes.py diff --git a/src/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin deleted file mode 100644 index de888a3d..00000000 --- a/src/statick_tool/plugins/tool/pyflakes_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Pyflakes Tool Plugin -Module = pyflakes_tool_plugin diff --git a/src/statick_tool/plugins/tool/pylint_tool_plugin.py b/src/statick_tool/plugins/tool/pylint.py similarity index 100% rename from src/statick_tool/plugins/tool/pylint_tool_plugin.py rename to src/statick_tool/plugins/tool/pylint.py diff --git a/src/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin deleted file mode 100644 index ac507ca2..00000000 --- a/src/statick_tool/plugins/tool/pylint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Pylint Tool Plugin -Module = pylint_tool_plugin diff --git a/src/statick_tool/plugins/tool/ruff_tool_plugin.py b/src/statick_tool/plugins/tool/ruff.py similarity index 100% rename from src/statick_tool/plugins/tool/ruff_tool_plugin.py rename to src/statick_tool/plugins/tool/ruff.py diff --git a/src/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin deleted file mode 100644 index adb167f6..00000000 --- a/src/statick_tool/plugins/tool/ruff_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Ruff Tool Plugin -Module = ruff_tool_plugin diff --git a/src/statick_tool/plugins/tool/shellcheck_tool_plugin.py b/src/statick_tool/plugins/tool/shellcheck.py similarity index 100% rename from src/statick_tool/plugins/tool/shellcheck_tool_plugin.py rename to src/statick_tool/plugins/tool/shellcheck.py diff --git a/src/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin deleted file mode 100644 index ffa620be..00000000 --- a/src/statick_tool/plugins/tool/shellcheck_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Shellcheck Tool Plugin -Module = shellcheck_tool_plugin diff --git a/src/statick_tool/plugins/tool/spotbugs_tool_plugin.py b/src/statick_tool/plugins/tool/spotbugs.py similarity index 100% rename from src/statick_tool/plugins/tool/spotbugs_tool_plugin.py rename to src/statick_tool/plugins/tool/spotbugs.py diff --git a/src/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin deleted file mode 100644 index 60b70837..00000000 --- a/src/statick_tool/plugins/tool/spotbugs_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Spotbugs Tool Plugin -Module = spotbugs_tool_plugin diff --git a/src/statick_tool/plugins/tool/uncrustify_tool_plugin.py b/src/statick_tool/plugins/tool/uncrustify.py similarity index 100% rename from src/statick_tool/plugins/tool/uncrustify_tool_plugin.py rename to src/statick_tool/plugins/tool/uncrustify.py diff --git a/src/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin deleted file mode 100644 index 06b813b2..00000000 --- a/src/statick_tool/plugins/tool/uncrustify_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = Uncrustify Tool Plugin -Module = uncrustify_tool_plugin diff --git a/src/statick_tool/plugins/tool/xmllint_tool_plugin.py b/src/statick_tool/plugins/tool/xmllint.py similarity index 100% rename from src/statick_tool/plugins/tool/xmllint_tool_plugin.py rename to src/statick_tool/plugins/tool/xmllint.py diff --git a/src/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin deleted file mode 100644 index 0cc0dc7c..00000000 --- a/src/statick_tool/plugins/tool/xmllint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = xmllint Tool Plugin -Module = xmllint_tool_plugin diff --git a/src/statick_tool/plugins/tool/yamllint_tool_plugin.py b/src/statick_tool/plugins/tool/yamllint.py similarity index 100% rename from src/statick_tool/plugins/tool/yamllint_tool_plugin.py rename to src/statick_tool/plugins/tool/yamllint.py diff --git a/src/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin b/src/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin deleted file mode 100644 index ccdaec5a..00000000 --- a/src/statick_tool/plugins/tool/yamllint_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = yamllint Tool Plugin -Module = yamllint_tool_plugin diff --git a/src/statick_tool/reporting_plugin.py b/src/statick_tool/reporting_plugin.py index cb29d8fe..56f8d492 100644 --- a/src/statick_tool/reporting_plugin.py +++ b/src/statick_tool/reporting_plugin.py @@ -3,14 +3,12 @@ import logging from typing import Any, Dict, List, Optional, Tuple, Union -from yapsy.IPlugin import IPlugin - from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -class ReportingPlugin(IPlugin): # type: ignore +class ReportingPlugin: """Default implementation of reporting plugin.""" plugin_context = None diff --git a/src/statick_tool/statick_tool.py b/src/statick_tool/statick_tool.py index 3a34b855..6e44e4e9 100644 --- a/src/statick_tool/statick_tool.py +++ b/src/statick_tool/statick_tool.py @@ -11,7 +11,6 @@ from typing import Any, Dict, List, Optional, Tuple import pkg_resources -from yapsy.PluginManager import PluginManager from statick_tool.config import Config from statick_tool.discovery_plugin import DiscoveryPlugin @@ -20,10 +19,13 @@ from statick_tool.package import Package from statick_tool.plugin_context import PluginContext from statick_tool.profile import Profile -from statick_tool.reporting_plugin import ReportingPlugin from statick_tool.resources import Resources from statick_tool.timing import Timing -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points class Statick: # pylint: disable=too-many-instance-attributes @@ -34,34 +36,23 @@ def __init__(self, user_paths: List[str]) -> None: self.default_level = "default" self.resources = Resources(user_paths) - self.manager = PluginManager() - self.manager.setPluginPlaces(self.resources.get_plugin_paths()) - self.manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - "Tool": ToolPlugin, - "Reporting": ReportingPlugin, - } - ) - self.manager.collectPlugins() - self.discovery_plugins: Dict[str, Any] = {} - for plugin_info in self.manager.getPluginsOfCategory("Discovery"): - self.discovery_plugins[ - plugin_info.plugin_object.get_name() - ] = plugin_info.plugin_object - - self.tool_plugins: Dict[str, Any] = {} - for plugin_info in self.manager.getPluginsOfCategory("Tool"): - self.tool_plugins[ - plugin_info.plugin_object.get_name() - ] = plugin_info.plugin_object + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + self.discovery_plugins[plugin_type.name] = plugin() self.reporting_plugins: Dict[str, Any] = {} - for plugin_info in self.manager.getPluginsOfCategory("Reporting"): - self.reporting_plugins[ - plugin_info.plugin_object.get_name() - ] = plugin_info.plugin_object + plugins = entry_points(group="statick_tool.plugins.reporting") + for plugin_type in plugins: + plugin = plugin_type.load() + self.reporting_plugins[plugin_type.name] = plugin() + + self.tool_plugins: Dict[str, Any] = {} + plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in plugins: + plugin = plugin_type.load() + self.tool_plugins[plugin_type.name] = plugin() self.config: Optional[Config] = None self.exceptions: Optional[Exceptions] = None @@ -240,10 +231,10 @@ def gather_args(self, args: argparse.ArgumentParser) -> None: for _, plugin in list(self.discovery_plugins.items()): plugin.gather_args(args) - for _, plugin in list(self.tool_plugins.items()): + for _, plugin in list(self.reporting_plugins.items()): plugin.gather_args(args) - for _, plugin in list(self.reporting_plugins.items()): + for _, plugin in list(self.tool_plugins.items()): plugin.gather_args(args) def get_level(self, path: str, args: argparse.Namespace) -> Optional[str]: diff --git a/src/statick_tool/tool_plugin.py b/src/statick_tool/tool_plugin.py index ae2a8bc1..5fa9364c 100644 --- a/src/statick_tool/tool_plugin.py +++ b/src/statick_tool/tool_plugin.py @@ -5,15 +5,13 @@ import shlex from typing import Any, Dict, List, Optional, Union -from yapsy.IPlugin import IPlugin - from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugin_context import PluginContext # No stubs available for IPlugin so ignoring type. -class ToolPlugin(IPlugin): # type: ignore +class ToolPlugin: """Default implementation of tool plugin.""" plugin_context = None From 812ded61b21c16f5199d6997fbbc81558ebf06e0 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 21 Nov 2023 22:28:36 -0800 Subject: [PATCH 04/58] Update unit tests to support built-in plugins approach. --- pyproject.toml | 5 +- .../test_c_discovery_plugin.py | 38 +++++-------- .../test_cmake_discovery_plugin.py | 40 ++++++-------- .../test_groovy_discovery_plugin.py | 39 +++++--------- .../test_java_discovery_plugin.py | 38 +++++-------- .../test_maven_discovery_plugin.py | 38 +++++-------- .../test_perl_discovery_plugin.py | 38 +++++-------- .../test_python_discovery_plugin.py | 38 +++++-------- .../test_ros_discovery_plugin.py | 38 +++++-------- .../test_shell_discovery_plugin.py | 38 +++++-------- .../test_xml_discovery_plugin.py | 38 +++++-------- .../test_yaml_discovery_plugin.py | 38 +++++-------- .../test_code_climate_reporting_plugin.py | 40 +++++--------- .../test_do_nothing_reporting_plugin.py | 40 +++++--------- .../test_json_reporting_plugin.py | 38 +++++-------- .../test_print_to_console_reporting_plugin.py | 38 +++++-------- ...te_jenkins_warnings_ng_reporting_plugin.py | 37 +++++-------- .../test_bandit_tool_plugin.py | 43 ++++++--------- .../test_black_tool_plugin.py | 47 +++++++--------- .../test_catkin-lint_tool_plugin.py | 45 ++++++---------- .../cccc_tool_plugin/test_cccc_tool_plugin.py | 48 +++++++---------- .../test_clang-format_tool_plugin.py | 49 +++++++---------- .../test_clang-tidy_tool_plugin.py | 53 +++++++------------ .../test_cmakelint_tool_plugin.py | 43 ++++++--------- .../test_cppcheck_tool_plugin.py | 47 +++++++--------- .../test_cpplint_tool_plugin.py | 51 ++++++------------ .../test_do_nothing_tool_plugin.py | 35 +++++------- .../test_docformatter_tool_plugin.py | 45 ++++++---------- .../test_flawfinder_tool_plugin.py | 44 ++++++--------- .../test_groovylint_tool_plugin.py | 45 ++++++---------- .../test_isort_tool_plugin.py | 46 ++++++---------- .../test_lizard_tool_plugin.py | 39 +++++--------- .../make_tool_plugin/test_make_tool_plugin.py | 45 ++++++---------- .../mypy_tool_plugin/test_mypy_tool_plugin.py | 45 ++++++---------- .../test_perlcritic_tool_plugin.py | 45 ++++++---------- .../test_pycodestyle_tool_plugin.py | 43 ++++++--------- .../test_pydocstyle_tool_plugin.py | 43 ++++++--------- .../test_pyflakes_tool_plugin.py | 43 ++++++--------- .../test_pylint_tool_plugin.py | 43 ++++++--------- .../ruff_tool_plugin/test_ruff_tool_plugin.py | 43 ++++++--------- .../test_shellcheck_tool_plugin.py | 44 ++++++--------- .../test_spotbugs_tool_plugin.py | 46 ++++++---------- .../test_uncrustify_tool_plugin.py | 45 ++++++---------- .../test_xmllint_tool_plugin.py | 45 ++++++---------- .../test_yamllint_tool_plugin.py | 42 ++++++--------- tests/statick_tool/test_statick_tool.py | 4 +- 46 files changed, 678 insertions(+), 1197 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0d16dede..9423ce78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,8 +80,8 @@ bandit = "statick_tool.plugins.tool.bandit:BanditToolPlugin" black = "statick_tool.plugins.tool.black:BlackToolPlugin" catkin_lint = "statick_tool.plugins.tool.catkin_lint:CatkinLintToolPlugin" cccc = "statick_tool.plugins.tool.cccc:CCCCToolPlugin" -clang_format = "statick_tool.plugins.tool.clang_format:ClangFormatToolPlugin" -clang_tidy = "statick_tool.plugins.tool.clang_tidy:ClangTidyToolPlugin" +clang-format = "statick_tool.plugins.tool.clang_format:ClangFormatToolPlugin" +clang-tidy = "statick_tool.plugins.tool.clang_tidy:ClangTidyToolPlugin" cmakelint = "statick_tool.plugins.tool.cmakelint:CMakelintToolPlugin" cppcheck = "statick_tool.plugins.tool.cppcheck:CppcheckToolPlugin" cpplint = "statick_tool.plugins.tool.cpplint:CpplintToolPlugin" @@ -114,6 +114,7 @@ test = [ "backports.tempfile", "flake8-pep3101", "flake8<5", # Pin until https://github.com/tholo/pytest-flake8/issues/87 is fixed. + "lark", "mock", "pycodestyle", "pydocstyle", diff --git a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py b/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py index ea0f394c..c2bff110 100644 --- a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py +++ b/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py @@ -1,14 +1,16 @@ """Unit tests for the C discovery plugin.""" import contextlib import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.c_discovery_plugin import CDiscoveryPlugin +from statick_tool.plugins.discovery.c import CDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @@ -43,27 +45,13 @@ def modified_environ(*remove, **update): def test_c_discovery_plugin_found(): """Test that the plugin manager finds the C discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "c" - assert any( - plugin_info.plugin_object.get_name() == "C" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named C Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "C/C++ Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "C" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py b/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py index 15aad88a..875e567c 100644 --- a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py +++ b/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py @@ -2,18 +2,22 @@ import argparse import os import subprocess +import sys import mock -from yapsy.PluginManager import PluginManager import statick_tool from statick_tool.config import Config -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.discovery.cmake_discovery_plugin import CMakeDiscoveryPlugin +from statick_tool.plugins.discovery.cmake import CMakeDiscoveryPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_cmake_discovery_plugin(add_plugin_context=True, cmake_flags=""): """Create an instance of the CMake discovery plugin.""" @@ -34,27 +38,13 @@ def setup_cmake_discovery_plugin(add_plugin_context=True, cmake_flags=""): def test_cmake_discovery_plugin_found(): """Test that the plugin manager finds the CMake discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "cmake" - assert any( - plugin_info.plugin_object.get_name() == "cmake" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named CMake Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "CMake Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "cmake" for _, plugin in list(discovery_plugins.items()) ) @@ -217,7 +207,7 @@ def test_cmake_discovery_plugin_check_output_cpplint_with_roslint_installed( @mock.patch( - "statick_tool.plugins.discovery.cmake_discovery_plugin.subprocess.check_output" + "statick_tool.plugins.discovery.cmake.subprocess.check_output" ) def test_cmake_discovery_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means CMake hit an @@ -237,7 +227,7 @@ def test_cmake_discovery_plugin_scan_calledprocesserror(mock_subprocess_check_ou @mock.patch( - "statick_tool.plugins.discovery.cmake_discovery_plugin.subprocess.check_output" + "statick_tool.plugins.discovery.cmake.subprocess.check_output" ) def test_cmake_discovery_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means CMake is not diff --git a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py b/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py index c91e0908..5b8ec4da 100644 --- a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py +++ b/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py @@ -1,39 +1,26 @@ """Unit tests for the Groovy discovery plugin.""" - import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.groovy_discovery_plugin import GroovyDiscoveryPlugin +from statick_tool.plugins.discovery.groovy import GroovyDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_groovy_plugin_found(): """Test that the plugin manager finds the Groovy discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "Groovy" - assert any( - plugin_info.plugin_object.get_name() == "groovy" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named Groovy Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Groovy Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "groovy" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py b/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py index e1604c5a..bf86101c 100644 --- a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py +++ b/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py @@ -1,38 +1,26 @@ """Unit tests for the Java discovery plugin.""" import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.java_discovery_plugin import JavaDiscoveryPlugin +from statick_tool.plugins.discovery.java import JavaDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_java_discovery_plugin_found(): """Test that the plugin manager finds the Java discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "java" - assert any( - plugin_info.plugin_object.get_name() == "java" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named Java Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Java Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "java" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py b/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py index 861a037d..b2afe9f7 100644 --- a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py +++ b/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py @@ -1,38 +1,26 @@ """Unit tests for the Maven discovery plugin.""" import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.maven_discovery_plugin import MavenDiscoveryPlugin +from statick_tool.plugins.discovery.maven import MavenDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_maven_discovery_plugin_found(): """Test that the plugin manager finds the Maven discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "java" - assert any( - plugin_info.plugin_object.get_name() == "maven" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named Maven Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Maven Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "maven" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py b/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py index 334ab131..22b7a006 100644 --- a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py +++ b/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py @@ -1,15 +1,17 @@ """Unit tests for the Perl discovery plugin.""" import contextlib import os - import pytest -from yapsy.PluginManager import PluginManager +import sys -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.perl_discovery_plugin import PerlDiscoveryPlugin +from statick_tool.plugins.discovery.perl import PerlDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @@ -44,27 +46,13 @@ def modified_environ(*remove, **update): def test_perl_discovery_plugin_found(): """Test that the plugin manager finds the Perl discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "perl" - assert any( - plugin_info.plugin_object.get_name() == "perl" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named Perl Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Perl Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "perl" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py b/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py index 37a3dd1d..5a10cb69 100644 --- a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py +++ b/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py @@ -1,15 +1,17 @@ """Unit tests for the Python discovery plugin.""" import contextlib import os - import pytest -from yapsy.PluginManager import PluginManager +import sys -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.python_discovery_plugin import PythonDiscoveryPlugin +from statick_tool.plugins.discovery.python import PythonDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @@ -44,27 +46,13 @@ def modified_environ(*remove, **update): def test_python_discovery_plugin_found(): """Test that the plugin manager finds the Python discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "python" - assert any( - plugin_info.plugin_object.get_name() == "python" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named Python Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Python Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "python" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py b/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py index 2fabe589..f12103f3 100644 --- a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py +++ b/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py @@ -1,13 +1,15 @@ """Unit tests for the ROS discovery plugin.""" import contextlib import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.package import Package -from statick_tool.plugins.discovery.ros_discovery_plugin import RosDiscoveryPlugin +from statick_tool.plugins.discovery.ros import RosDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @@ -42,27 +44,13 @@ def modified_environ(*remove, **update): def test_ros_discovery_plugin_found(): """Test that the plugin manager can find the ROS plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "ros" - assert any( - plugin_info.plugin_object.get_name() == "ros" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named ROS Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "ROS Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "ros" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py b/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py index 0044c628..ee2a88ec 100644 --- a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py +++ b/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py @@ -1,15 +1,17 @@ """Unit tests for the Shell discovery plugin.""" import contextlib import os - import pytest -from yapsy.PluginManager import PluginManager +import sys -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.shell_discovery_plugin import ShellDiscoveryPlugin +from statick_tool.plugins.discovery.shell import ShellDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points # From https://stackoverflow.com/questions/2059482/shell-temporarily-modify-the-current-processs-environment @@ -44,27 +46,13 @@ def modified_environ(*remove, **update): def test_shell_discovery_plugin_found(): """Test that the plugin manager finds the Shell discovery plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "shell" - assert any( - plugin_info.plugin_object.get_name() == "shell" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named Shell Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Shell Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "shell" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py b/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py index b5bff334..daa823f0 100644 --- a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py +++ b/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py @@ -1,38 +1,26 @@ """Unit tests for the XML discovery plugin.""" import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.xml_discovery_plugin import XMLDiscoveryPlugin +from statick_tool.plugins.discovery.xml import XMLDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_xml_discovery_plugin_found(): """Test that the XML discovery plugin is detected by the plugin system.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "xml" - assert any( - plugin_info.plugin_object.get_name() == "xml" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named XML Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "XML Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "xml" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py b/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py index 8f5b6dff..5c33ec9e 100644 --- a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py +++ b/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py @@ -1,38 +1,26 @@ """Unit tests for the YAML discovery plugin.""" import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool -from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions from statick_tool.package import Package -from statick_tool.plugins.discovery.yaml_discovery_plugin import YAMLDiscoveryPlugin +from statick_tool.plugins.discovery.yaml import YAMLDiscoveryPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_yaml_discovery_plugin_found(): """Test that the YAML discovery plugin is detected by the plugin system.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Discovery": DiscoveryPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "yaml" - assert any( - plugin_info.plugin_object.get_name() == "yaml" - for plugin_info in manager.getPluginsOfCategory("Discovery") - ) - # While we're at it, verify that a plugin is named YAML Discovery Plugin + discovery_plugins = {} + plugins = entry_points(group="statick_tool.plugins.discovery") + for plugin_type in plugins: + plugin = plugin_type.load() + discovery_plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "YAML Discovery Plugin" - for plugin_info in manager.getPluginsOfCategory("Discovery") + plugin.get_name() == "yaml" for _, plugin in list(discovery_plugins.items()) ) diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py index b25bcf31..f664eecb 100644 --- a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py +++ b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py @@ -2,20 +2,20 @@ import argparse import json import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool from statick_tool.config import Config from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.reporting.code_climate_reporting_plugin import ( - CodeClimateReportingPlugin, -) -from statick_tool.reporting_plugin import ReportingPlugin +from statick_tool.plugins.reporting.code_climate import CodeClimateReportingPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + try: from tempfile import TemporaryDirectory except: # pylint: disable=bare-except # noqa: E722 # NOLINT @@ -50,27 +50,13 @@ def setup_code_climate_reporting_plugin( def test_code_climate_reporting_plugin_found(): """Test that the plugin manager finds the plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Reporting": ReportingPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "code_climate" - assert any( - plugin_info.plugin_object.get_name() == "code_climate" - for plugin_info in manager.getPluginsOfCategory("Reporting") - ) - # While we're at it, verify that a plugin is named Code Climate Discovery Plugin + plugins = {} + reporting_plugins = entry_points(group="statick_tool.plugins.reporting") + for plugin_type in reporting_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Code Climate Reporting Plugin" - for plugin_info in manager.getPluginsOfCategory("Reporting") + plugin.get_name() == "code_climate" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py b/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py index a381bb91..2aa5b6c6 100644 --- a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py +++ b/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py @@ -1,40 +1,26 @@ """Unit tests for the do nothing reporting plugin.""" import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool from statick_tool.issue import Issue from statick_tool.package import Package -from statick_tool.plugins.reporting.do_nothing_reporting_plugin import ( - DoNothingReportingPlugin, -) -from statick_tool.reporting_plugin import ReportingPlugin +from statick_tool.plugins.reporting.do_nothing import DoNothingReportingPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_do_nothing_reporting_plugin_found(): """Test that the plugin manager finds the do nothing reporting plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Reporting": ReportingPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "c" - assert any( - plugin_info.plugin_object.get_name() == "do_nothing" - for plugin_info in manager.getPluginsOfCategory("Reporting") - ) - # While we're at it, verify that a plugin is named C Discovery Plugin + plugins = {} + reporting_plugins = entry_points(group="statick_tool.plugins.reporting") + for plugin_type in reporting_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Do Nothing Reporting Plugin" - for plugin_info in manager.getPluginsOfCategory("Reporting") + plugin.get_name() == "do_nothing" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py index eec905f8..2ad2d7bd 100644 --- a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py +++ b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py @@ -1,18 +1,20 @@ """Unit tests for the JSON reporting plugin.""" import argparse import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool from statick_tool.config import Config from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.reporting.json_reporting_plugin import JsonReportingPlugin -from statick_tool.reporting_plugin import ReportingPlugin +from statick_tool.plugins.reporting.json import JsonReportingPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + try: from tempfile import TemporaryDirectory except: # pylint: disable=bare-except # noqa: E722 # NOLINT @@ -39,27 +41,13 @@ def setup_json_reporting_plugin(file_path, use_plugin_context=True): def test_json_reporting_plugin_found(): """Test that the plugin manager finds the plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Reporting": ReportingPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "c" - assert any( - plugin_info.plugin_object.get_name() == "json" - for plugin_info in manager.getPluginsOfCategory("Reporting") - ) - # While we're at it, verify that a plugin is named C Discovery Plugin + plugins = {} + reporting_plugins = entry_points(group="statick_tool.plugins.reporting") + for plugin_type in reporting_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "JSON Reporting Plugin" - for plugin_info in manager.getPluginsOfCategory("Reporting") + plugin.get_name() == "json" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py b/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py index 3371078b..a9878403 100644 --- a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py +++ b/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py @@ -1,40 +1,28 @@ """Unit tests for the console reporting plugin.""" import os +import sys -from yapsy.PluginManager import PluginManager - -import statick_tool from statick_tool.issue import Issue from statick_tool.package import Package -from statick_tool.plugins.reporting.print_to_console_reporting_plugin import ( +from statick_tool.plugins.reporting.print_to_console import ( PrintToConsoleReportingPlugin, ) -from statick_tool.reporting_plugin import ReportingPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def test_console_reporting_plugin_found(): """Test that the plugin manager finds the console reporting plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Reporting": ReportingPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "c" - assert any( - plugin_info.plugin_object.get_name() == "print_to_console" - for plugin_info in manager.getPluginsOfCategory("Reporting") - ) - # While we're at it, verify that a plugin is named C Discovery Plugin + plugins = {} + reporting_plugins = entry_points(group="statick_tool.plugins.reporting") + for plugin_type in reporting_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Print To Console Reporting Plugin" - for plugin_info in manager.getPluginsOfCategory("Reporting") + plugin.get_name() == "print_to_console" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py index 82cbe38e..ec406d78 100644 --- a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py +++ b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py @@ -3,20 +3,23 @@ import json import os import re - -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.reporting.write_jenkins_warnings_ng_reporting_plugin import ( +from statick_tool.plugins.reporting.write_jenkins_warnings_ng import ( WriteJenkinsWarningsNGReportingPlugin, ) -from statick_tool.reporting_plugin import ReportingPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + try: from tempfile import TemporaryDirectory except: # pylint: disable=bare-except # noqa: E722 # NOLINT @@ -49,27 +52,13 @@ def setup_write_jenkins_warnings_ng_reporting_plugin( def test_write_jenkins_warnings_ng_reporting_plugin_found(): """Test that the plugin manager finds the file writing plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Reporting": ReportingPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "c" - assert any( - plugin_info.plugin_object.get_name() == "write_jenkins_warnings_ng" - for plugin_info in manager.getPluginsOfCategory("Reporting") - ) - # While we're at it, verify that a plugin is named C Discovery Plugin + plugins = {} + reporting_plugins = entry_points(group="statick_tool.plugins.reporting") + for plugin_type in reporting_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Write Jenkins Warnings NG Reporting Plugin" - for plugin_info in manager.getPluginsOfCategory("Reporting") + plugin.get_name() == "write_jenkins_warnings_ng" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py b/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py index c2b48e52..204f2431 100644 --- a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py +++ b/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py @@ -1,18 +1,21 @@ """Unit tests for the bandit tool module.""" import argparse +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.bandit_tool_plugin import BanditToolPlugin +from statick_tool.plugins.tool.bandit import BanditToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_bandit_tool_plugin(binary=None): @@ -38,27 +41,13 @@ def setup_bandit_tool_plugin(binary=None): def test_bandit_tool_plugin_found(): """Test that the bandit tool plugin is detected by the plugin system.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "bandit" - assert any( - plugin_info.plugin_object.get_name() == "bandit" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Bandit Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Bandit Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "bandit" for _, plugin in list(plugins.items()) ) @@ -118,7 +107,7 @@ def test_bandit_tool_plugin_scan_wrong_binary(): assert issues is None -@mock.patch("statick_tool.plugins.tool.bandit_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.bandit.subprocess.check_output") def test_bandit_tool_plugin_scan_empty_oserror(mock_subprocess_check_output): """Test what happens an OSError is hit (such as if bandit doesn't exist). @@ -136,7 +125,7 @@ def test_bandit_tool_plugin_scan_empty_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.bandit_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.bandit.subprocess.check_output") def test_bandit_tool_plugin_scan_empty_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is hit (such as if bandit encounters an error). diff --git a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py b/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py index cb089b49..3d9c86b1 100644 --- a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py +++ b/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the black plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.black_tool_plugin import BlackToolPlugin +from statick_tool.plugins.tool.black import BlackToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_black_tool_plugin(): @@ -33,27 +36,13 @@ def setup_black_tool_plugin(): def test_black_tool_plugin_found(): """Test that the plugin manager can find the PyCodeStyle plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "black" - assert any( - plugin_info.plugin_object.get_name() == "black" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Pycodestyle Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Pycodestyle Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "black" for _, plugin in list(plugins.items()) ) @@ -114,7 +103,7 @@ def test_black_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.black_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.black.subprocess.check_output") def test_black_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means black doesn't exist). @@ -132,7 +121,7 @@ def test_black_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.black_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.black.subprocess.check_output") def test_black_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means black hit an error). @@ -153,7 +142,7 @@ def test_black_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output) assert issues is None -@mock.patch("statick_tool.plugins.tool.black_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.black.subprocess.check_output") def test_black_tool_plugin_scan_internal_error(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised due to an internal error. diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py b/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py index 46aca6ac..9d678d18 100644 --- a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py +++ b/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the catkin_lint tool plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.catkin_lint_tool_plugin import CatkinLintToolPlugin +from statick_tool.plugins.tool.catkin_lint import CatkinLintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_catkin_lint_tool_plugin(): @@ -33,27 +36,13 @@ def setup_catkin_lint_tool_plugin(): def test_catkin_lint_tool_plugin_found(): """Test that the plugin manager finds the CatkinLint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "catkin_lint" - assert any( - plugin_info.plugin_object.get_name() == "catkin_lint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Yamllint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Catkin Lint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "catkin_lint" for _, plugin in list(plugins.items()) ) @@ -257,7 +246,7 @@ def test_catkin_lint_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.catkin_lint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.catkin_lint.subprocess.check_output") def test_catkin_lint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means catkin_lint hit an error). @@ -282,7 +271,7 @@ def test_catkin_lint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_o assert issues is None -@mock.patch("statick_tool.plugins.tool.catkin_lint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.catkin_lint.subprocess.check_output") def test_catkin_lint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means catkin_lint doesn't exist). diff --git a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py b/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py index 8e5aded0..393d054f 100644 --- a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py +++ b/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py @@ -1,24 +1,26 @@ """Unit tests for the CCCC tool module.""" - from __future__ import print_function import argparse +import mock import os +import pytest import shutil import subprocess - -import mock -import pytest +import sys import xmltodict -from yapsy.PluginManager import PluginManager import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.cccc_tool_plugin import CCCCToolPlugin +from statick_tool.plugins.tool.cccc import CCCCToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_cccc_tool_plugin(use_plugin_context=True, binary=None, cccc_config=None): @@ -45,27 +47,13 @@ def setup_cccc_tool_plugin(use_plugin_context=True, binary=None, cccc_config=Non def test_cccc_tool_plugin_found(): """Test that the CCCC tool plugin is detected by the plugin system.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "cccc" - assert any( - plugin_info.plugin_object.get_name() == "cccc" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named CCCC Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "CCCC Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "cccc" for _, plugin in list(plugins.items()) ) @@ -245,7 +233,7 @@ def test_cccc_tool_plugin_parse_config_none(): assert not config -@mock.patch("statick_tool.plugins.tool.cccc_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cccc.subprocess.check_output") def test_cccc_tool_plugin_scan_empty_oserror(mock_subprocess_check_output): """Test what happens an OSError is hit (such as if cccc doesn't exist) @@ -263,7 +251,7 @@ def test_cccc_tool_plugin_scan_empty_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.cccc_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cccc.subprocess.check_output") def test_cccc_tool_plugin_scan_empty_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is hit (such as if cccc encounters an error). @@ -292,7 +280,7 @@ def test_cccc_tool_plugin_scan_empty_calledprocesserror(mock_subprocess_check_ou assert not issues -@mock.patch("statick_tool.plugins.tool.cccc_tool_plugin.xmltodict.parse") +@mock.patch("statick_tool.plugins.tool.cccc.xmltodict.parse") def test_cccc_tool_plugin_scan_filenotfound(mock_xmltodict_parse): """Test what happens when a FileNotFoundError is hit (such as if cccc has no output for a file). diff --git a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py b/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py index 9d2c5104..2d71c255 100644 --- a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py +++ b/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py @@ -1,22 +1,25 @@ """Unit tests for the clang-format plugin.""" import argparse +import mock import os +import pytest import shutil import subprocess +import sys from xml.etree import ElementTree -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext from statick_tool.plugins.tool.clang_format_parser import ClangFormatXMLParser -from statick_tool.plugins.tool.clang_format_tool_plugin import ClangFormatToolPlugin +from statick_tool.plugins.tool.clang_format import ClangFormatToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_clang_format_tool_plugin( @@ -67,27 +70,13 @@ def setup_clang_format_tool_plugin( def test_clang_format_tool_plugin_found(): """Test that the plugin manager can find the clang-format plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "clang_format" - assert any( - plugin_info.plugin_object.get_name() == "clang-format" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named clang-format Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "clang-format Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "clang-format" for _, plugin in list(plugins.items()) ) @@ -348,7 +337,7 @@ def test_clang_format_tool_plugin_custom_config_diff(): @mock.patch( - "statick_tool.plugins.tool.clang_format_tool_plugin.subprocess.check_output" + "statick_tool.plugins.tool.clang_format.subprocess.check_output" ) def test_clang_format_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means clang-format @@ -384,7 +373,7 @@ def test_clang_format_tool_plugin_scan_calledprocesserror(mock_subprocess_check_ os.remove(os.path.join(os.path.expanduser("~"), "_clang-format")) -@mock.patch("statick_tool.plugins.tool.clang_format_tool_plugin.open") +@mock.patch("statick_tool.plugins.tool.clang_format.open") def test_clang_format_tool_plugin_scan_oserror_open(mock_open): """Test what happens when OSError is raised (usually means clang-format configuration is missing). @@ -411,7 +400,7 @@ def test_clang_format_tool_plugin_scan_oserror_open(mock_open): @mock.patch( - "statick_tool.plugins.tool.clang_format_tool_plugin.subprocess.check_output" + "statick_tool.plugins.tool.clang_format.subprocess.check_output" ) def test_clang_format_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means clang-format doesn't @@ -447,7 +436,7 @@ def test_clang_format_tool_plugin_scan_oserror(mock_subprocess_check_output): os.remove(os.path.join(os.path.expanduser("~"), "_clang-format")) -@mock.patch("statick_tool.plugins.tool.clang_format_tool_plugin.open") +@mock.patch("statick_tool.plugins.tool.clang_format.open") def test_clang_format_tool_plugin_check_configuration_oserror(mock_open): """Test what happens when an OSError is raised (usually means diff files don't exist). diff --git a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py b/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py index 182b5f1a..839a5e02 100644 --- a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py +++ b/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py @@ -1,27 +1,24 @@ """Unit tests for the clang-tidy plugin.""" import argparse +import mock import os +import pytest import subprocess import sys -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.clang_tidy_tool_plugin import ClangTidyToolPlugin +from statick_tool.plugins.tool.clang_tidy import ClangTidyToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory def setup_clang_tidy_tool_plugin(use_plugin_context=True, binary=None): @@ -48,27 +45,13 @@ def setup_clang_tidy_tool_plugin(use_plugin_context=True, binary=None): def test_clang_tidy_tool_plugin_found(): """Test that the plugin manager can find the clang-tidy plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "clang_tidy" - assert any( - plugin_info.plugin_object.get_name() == "clang-tidy" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named ClangTidy Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "clang-tidy Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "clang-tidy" for _, plugin in list(plugins.items()) ) @@ -288,7 +271,7 @@ def test_clang_tidy_tool_plugin_scan_missing_fields(): assert not issues -@mock.patch("statick_tool.plugins.tool.clang_tidy_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.clang_tidy.subprocess.check_output") def test_clang_tidy_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means clang-tidy doesn't exist). @@ -312,7 +295,7 @@ def test_clang_tidy_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.clang_tidy_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.clang_tidy.subprocess.check_output") def test_clang_tidy_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means clang-tidy hit an error). @@ -338,7 +321,7 @@ def test_clang_tidy_tool_plugin_scan_calledprocesserror(mock_subprocess_check_ou assert issues is None -@mock.patch("statick_tool.plugins.tool.clang_tidy_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.clang_tidy.subprocess.check_output") def test_clang_tidy_tool_plugin_scan_diagnosticerror(mock_subprocess_check_output): """Test that a CalledProcessError is raised when subprocess's output contains 'clang-diagnostic-error'. diff --git a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py b/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py index 3bcc166e..d4989fdf 100644 --- a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py +++ b/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py @@ -1,18 +1,21 @@ """Unit tests for cmakelint plugin.""" import argparse +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.cmakelint_tool_plugin import CMakelintToolPlugin +from statick_tool.plugins.tool.cmakelint import CMakelintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_cmakelint_tool_plugin(): @@ -32,27 +35,13 @@ def setup_cmakelint_tool_plugin(): def test_cmakelint_tool_plugin_found(): """Test that the plugin manager finds the cmakelint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "cmakelint" - assert any( - plugin_info.plugin_object.get_name() == "cmakelint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named cmakelint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "cmakelint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "cmakelint" for _, plugin in list(plugins.items()) ) @@ -138,7 +127,7 @@ def test_cmakelint_tool_plugin_nonexistent_file(): assert not issues -@mock.patch("statick_tool.plugins.tool.cmakelint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cmakelint.subprocess.check_output") def test_cmakelint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means cmakelint hit an error). @@ -165,7 +154,7 @@ def test_cmakelint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_out assert issues is None -@mock.patch("statick_tool.plugins.tool.cmakelint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cmakelint.subprocess.check_output") def test_cmakelint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means cmakelint doesn't exist). diff --git a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py b/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py index ade63fa9..5dfb9e02 100644 --- a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py +++ b/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the cppcheck plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.cppcheck_tool_plugin import CppcheckToolPlugin +from statick_tool.plugins.tool.cppcheck import CppcheckToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_cppcheck_tool_plugin(use_plugin_context=True, binary=None): @@ -40,27 +43,13 @@ def setup_cppcheck_tool_plugin(use_plugin_context=True, binary=None): def test_cppcheck_tool_plugin_found(): """Test that the plugin manager can find the cppcheck plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "cppcheck" - assert any( - plugin_info.plugin_object.get_name() == "cppcheck" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Cppcheck Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Cppcheck Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "cppcheck" for _, plugin in list(plugins.items()) ) @@ -199,7 +188,7 @@ def test_cppcheck_tool_plugin_scan_missing_fields(): assert not issues -@mock.patch("statick_tool.plugins.tool.cppcheck_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cppcheck.subprocess.check_output") def test_cppcheck_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means cppcheck doesn't exist). @@ -233,7 +222,7 @@ def calledprocesserror_helper(*popenargs, **kwargs): raise subprocess.CalledProcessError(2, "", output="mocked error") -@mock.patch("statick_tool.plugins.tool.cppcheck_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cppcheck.subprocess.check_output") def test_cppcheck_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means cppcheck hit an error). @@ -273,7 +262,7 @@ def test_checkforexceptions_false(): assert not CppcheckToolPlugin.check_for_exceptions(mm) -@mock.patch("statick_tool.plugins.tool.cppcheck_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cppcheck.subprocess.check_output") def test_cppcheck_tool_plugin_version_match(mock_subprocess_check_output): """Test the result of passing a requested version to the plugin when that version isn't available.""" diff --git a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py b/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py index c7a035b2..55081bfb 100644 --- a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py +++ b/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py @@ -1,27 +1,24 @@ """Unit tests for the cpplint plugin.""" import argparse +import mock import os +import pytest import subprocess import sys -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.cpplint_tool_plugin import CpplintToolPlugin +from statick_tool.plugins.tool.cpplint import CpplintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory def setup_cpplint_tool_plugin(): @@ -41,27 +38,13 @@ def setup_cpplint_tool_plugin(): def test_cpplint_tool_plugin_found(): """Test that the plugin manager can find the cpplint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "cpplint" - assert any( - plugin_info.plugin_object.get_name() == "cpplint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Cpplint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Cpplint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "cpplint" for _, plugin in list(plugins.items()) ) @@ -181,7 +164,7 @@ def test_cpplint_tool_plugin_scan_missing_fields(): assert not issues -@mock.patch("statick_tool.plugins.tool.cpplint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cpplint.subprocess.check_output") def test_cpplint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means cpplint doesn't exist). @@ -204,7 +187,7 @@ def test_cpplint_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.cpplint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.cpplint.subprocess.check_output") def test_cpplint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means cpplint hit an error). diff --git a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py b/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py index 0d349b4c..683780fb 100644 --- a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py +++ b/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py @@ -1,12 +1,15 @@ """Unit tests for the do nothing tool plugin.""" import os - -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.package import Package -from statick_tool.plugins.tool.do_nothing_tool_plugin import DoNothingToolPlugin -from statick_tool.tool_plugin import ToolPlugin +from statick_tool.plugins.tool.do_nothing import DoNothingToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_do_nothing_tool_plugin(): @@ -17,25 +20,13 @@ def setup_do_nothing_tool_plugin(): def test_do_nothing_tool_plugin_found(): """Test that the plugin manager finds the do nothing tool plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - assert any( - plugin_info.plugin_object.get_name() == "do_nothing" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Do Nothing Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "do_nothing" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py index 17a2277a..fe3c67c5 100644 --- a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py +++ b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the docformatter plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.docformatter_tool_plugin import DocformatterToolPlugin +from statick_tool.plugins.tool.docformatter import DocformatterToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_docformatter_tool_plugin(): @@ -33,27 +36,13 @@ def setup_docformatter_tool_plugin(): def test_docformatter_tool_plugin_found(): """Test that the plugin manager can find the Docformatter plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "docformatter" - assert any( - plugin_info.plugin_object.get_name() == "docformatter" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Docformatter Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Docformatter Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "docformatter" for _, plugin in list(plugins.items()) ) @@ -107,7 +96,7 @@ def test_docformatter_tool_plugin_parse_invalid(): @mock.patch( - "statick_tool.plugins.tool.docformatter_tool_plugin.subprocess.check_output" + "statick_tool.plugins.tool.docformatter.subprocess.check_output" ) def test_docformatter_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means docformatter doesn't @@ -128,7 +117,7 @@ def test_docformatter_tool_plugin_scan_oserror(mock_subprocess_check_output): @mock.patch( - "statick_tool.plugins.tool.docformatter_tool_plugin.subprocess.check_output" + "statick_tool.plugins.tool.docformatter.subprocess.check_output" ) def test_docformatter_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means docformatter diff --git a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py b/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py index 2231af17..f8453333 100644 --- a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py +++ b/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py @@ -1,20 +1,22 @@ """Unit tests for the flawfinder plugin.""" import argparse +import mock import os +import pytest import subprocess import sys -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.flawfinder_tool_plugin import FlawfinderToolPlugin +from statick_tool.plugins.tool.flawfinder import FlawfinderToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_flawfinder_tool_plugin(): @@ -38,27 +40,13 @@ def setup_flawfinder_tool_plugin(): def test_flawfinder_tool_plugin_found(): """Test that the plugin manager can find the flawfinder plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "flawfinder" - assert any( - plugin_info.plugin_object.get_name() == "flawfinder" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Flawfinder Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Flawfinder Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "flawfinder" for _, plugin in list(plugins.items()) ) @@ -91,7 +79,7 @@ def test_flawfinder_tool_plugin_scan_missing_c_src(): assert not issues -@mock.patch("statick_tool.plugins.tool.flawfinder_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.flawfinder.subprocess.check_output") def test_flawfinder_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means flawfinder doesn't exist). @@ -108,7 +96,7 @@ def test_flawfinder_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.flawfinder_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.flawfinder.subprocess.check_output") def test_flawfinder_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means flawfinder hit an error). diff --git a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py b/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py index f68c1fd6..b0ac0129 100644 --- a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py +++ b/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the groovylint plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.groovylint_tool_plugin import GroovyLintToolPlugin +from statick_tool.plugins.tool.groovylint import GroovyLintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_groovylint_tool_plugin(): @@ -42,27 +45,13 @@ def setup_groovylint_tool_plugin(): def test_groovylint_tool_plugin_found(): """Test that the plugin manager can find the groovylint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "groovylint" - assert any( - plugin_info.plugin_object.get_name() == "groovylint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named NPM Groovy Lint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "NPM Groovy Lint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "groovylint" for _, plugin in list(plugins.items()) ) @@ -125,7 +114,7 @@ def test_groovylint_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.groovylint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.groovylint.subprocess.check_output") def test_groovylint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means groovylint hit an error). @@ -152,7 +141,7 @@ def test_groovylint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_ou assert not issues -@mock.patch("statick_tool.plugins.tool.groovylint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.groovylint.subprocess.check_output") def test_groovylint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means groovylint doesn't exist). diff --git a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py b/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py index 985e3e53..316c2278 100644 --- a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py +++ b/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py @@ -1,20 +1,22 @@ """Unit tests for the isort plugin.""" import argparse +import mock import os +import pytest import subprocess import sys -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.isort_tool_plugin import IsortToolPlugin +from statick_tool.plugins.tool.isort import IsortToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_isort_tool_plugin(custom_rsc_path=None): @@ -37,29 +39,13 @@ def setup_isort_tool_plugin(custom_rsc_path=None): def test_isort_tool_plugin_found(): """Test that the plugin manager can find the Isort plugin.""" - if sys.version_info.major == 3 and sys.version_info.minor < 6: - pytest.skip("isort is only available for Python 3.6+, unable to test") - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "isort" - assert any( - plugin_info.plugin_object.get_name() == "isort" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Isort Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Isort Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "isort" for _, plugin in list(plugins.items()) ) @@ -109,7 +95,7 @@ def test_isort_tool_plugin_parse_valid(): assert issues[1].filename == "/tmp/y.py" -@mock.patch("statick_tool.plugins.tool.isort_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.isort.subprocess.check_output") def test_isort_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means isort doesn't exist). @@ -127,7 +113,7 @@ def test_isort_tool_plugin_scan_oserror(mock_subprocess_check_output): assert not issues -@mock.patch("statick_tool.plugins.tool.isort_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.isort.subprocess.check_output") def test_isort_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means isort hit an error). diff --git a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py b/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py index e2b75592..f067af88 100644 --- a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py +++ b/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py @@ -1,17 +1,20 @@ """Unit tests for the lizard plugin.""" import argparse -import os - import pytest -from yapsy.PluginManager import PluginManager +import os +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.lizard_tool_plugin import LizardToolPlugin +from statick_tool.plugins.tool.lizard import LizardToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_lizard_tool_plugin(custom_rsc_path=None): @@ -34,27 +37,13 @@ def setup_lizard_tool_plugin(custom_rsc_path=None): def test_lizard_tool_plugin_found(): """Test that the plugin manager can find the lizard plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "lizard" - assert any( - plugin_info.plugin_object.get_name() == "lizard" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Lizard Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Lizard Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "lizard" for _, plugin in list(plugins.items()) ) diff --git a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py b/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py index cb04ec38..19a9a2e7 100644 --- a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py +++ b/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the make tool plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.make_tool_plugin import MakeToolPlugin +from statick_tool.plugins.tool.make import MakeToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_make_tool_plugin(): @@ -36,27 +39,13 @@ def setup_make_tool_plugin(): def test_make_tool_plugin_found(): """Test that the plugin manager finds the Make plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "make" - assert any( - plugin_info.plugin_object.get_name() == "make" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Yamllint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Make Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "make" for _, plugin in list(plugins.items()) ) @@ -194,7 +183,7 @@ def test_make_tool_plugin_parse_warnings_mapping(): assert issues[0].cert_reference == "OOP53-CPP" -@mock.patch("statick_tool.plugins.tool.make_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.make.subprocess.check_output") def test_make_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means make hit an error). @@ -213,7 +202,7 @@ def test_make_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): assert not issues -@mock.patch("statick_tool.plugins.tool.make_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.make.subprocess.check_output") def test_make_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means make doesn't exist). diff --git a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py b/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py index d734cf74..135a7fa4 100644 --- a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py +++ b/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the mypy plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.mypy_tool_plugin import MypyToolPlugin +from statick_tool.plugins.tool.mypy import MypyToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_mypy_tool_plugin(): @@ -33,27 +36,13 @@ def setup_mypy_tool_plugin(): def test_mypy_tool_plugin_found(): """Test that the plugin manager can find the Mypy plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "mypy" - assert any( - plugin_info.plugin_object.get_name() == "mypy" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Mypy Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Mypy Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "mypy" for _, plugin in list(plugins.items()) ) @@ -109,7 +98,7 @@ def test_mypy_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.mypy_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.mypy.subprocess.check_output") def test_mypy_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means mypy doesn't exist). @@ -127,7 +116,7 @@ def test_mypy_tool_plugin_scan_oserror(mock_subprocess_check_output): assert not issues -@mock.patch("statick_tool.plugins.tool.mypy_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.mypy.subprocess.check_output") def test_mypy_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means mypy hit an error). diff --git a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py b/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py index 5bf02b6d..dec6249c 100644 --- a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py +++ b/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the perlcritic plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.perlcritic_tool_plugin import PerlCriticToolPlugin +from statick_tool.plugins.tool.perlcritic import PerlCriticToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_perlcritic_tool_plugin(binary=None): @@ -39,27 +42,13 @@ def setup_perlcritic_tool_plugin(binary=None): def test_perlcritic_tool_plugin_found(): """Test that the plugin manager can find the perlcritic plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "perlcritic" - assert any( - plugin_info.plugin_object.get_name() == "perlcritic" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named PerlCritic Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Perl::Critic Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "perlcritic" for _, plugin in list(plugins.items()) ) @@ -148,7 +137,7 @@ def test_perlcritic_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.perlcritic_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.perlcritic.subprocess.check_output") def test_perlcritic_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means perlcritic doesn't exist). @@ -167,7 +156,7 @@ def test_perlcritic_tool_plugin_scan_oserror(mock_subprocess_check_output): assert not issues -@mock.patch("statick_tool.plugins.tool.perlcritic_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.perlcritic.subprocess.check_output") def test_perlcritic_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means perlcritic hit an error). diff --git a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py b/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py index 043470f7..4fa98011 100644 --- a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py +++ b/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py @@ -1,18 +1,21 @@ """Unit tests for the pycodestyle plugin.""" import argparse +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.pycodestyle_tool_plugin import PycodestyleToolPlugin +from statick_tool.plugins.tool.pycodestyle import PycodestyleToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_pycodestyle_tool_plugin(): @@ -32,27 +35,13 @@ def setup_pycodestyle_tool_plugin(): def test_pycodestyle_tool_plugin_found(): """Test that the plugin manager can find the PyCodeStyle plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "pycodestyle" - assert any( - plugin_info.plugin_object.get_name() == "pycodestyle" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Pycodestyle Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Pycodestyle Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "pycodestyle" for _, plugin in list(plugins.items()) ) @@ -105,7 +94,7 @@ def test_pycodestyle_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.pycodestyle_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pycodestyle.subprocess.check_output") def test_pycodestyle_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means pycodestyle doesn't exist). @@ -124,7 +113,7 @@ def test_pycodestyle_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.pycodestyle_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pycodestyle.subprocess.check_output") def test_pycodestyle_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means pycodestyle hit an error). diff --git a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py b/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py index 4c611af0..65c49d1a 100644 --- a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py +++ b/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py @@ -1,18 +1,21 @@ """Unit tests for the PyCodeStyle plugin.""" import argparse +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.pydocstyle_tool_plugin import PydocstyleToolPlugin +from statick_tool.plugins.tool.pydocstyle import PydocstyleToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_pydocstyle_tool_plugin(): @@ -32,27 +35,13 @@ def setup_pydocstyle_tool_plugin(): def test_pydocstyle_tool_plugin_found(): """Test that the plugin manager can find the PyDocStyle plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "pydocstyle" - assert any( - plugin_info.plugin_object.get_name() == "pydocstyle" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Pydocstyle Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Pydocstyle Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "pydocstyle" for _, plugin in list(plugins.items()) ) @@ -92,7 +81,7 @@ def test_pydocstyle_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.pydocstyle_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pydocstyle.subprocess.check_output") def test_pydocstyle_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means tool hit an error). @@ -119,7 +108,7 @@ def test_pydocstyle_tool_plugin_scan_calledprocesserror(mock_subprocess_check_ou assert not issues -@mock.patch("statick_tool.plugins.tool.pydocstyle_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pydocstyle.subprocess.check_output") def test_pydocstyle_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means tool doesn't exist). diff --git a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py b/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py index a71c58ef..9845c31c 100644 --- a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py +++ b/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py @@ -1,18 +1,21 @@ """Unit tests for the Pyflakes plugin.""" import argparse +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.pyflakes_tool_plugin import PyflakesToolPlugin +from statick_tool.plugins.tool.pyflakes import PyflakesToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_pyflakes_tool_plugin(): @@ -32,27 +35,13 @@ def setup_pyflakes_tool_plugin(): def test_pyflakes_tool_plugin_found(): """Test that the plugin manager can find the Pyflakes plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "pyflakes" - assert any( - plugin_info.plugin_object.get_name() == "pyflakes" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Pyflakes Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Pyflakes Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "pyflakes" for _, plugin in list(plugins.items()) ) @@ -114,7 +103,7 @@ def test_pyflakes_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.pyflakes_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pyflakes.subprocess.check_output") def test_pyflakes_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means pyflakes hit an error). @@ -141,7 +130,7 @@ def test_pyflakes_tool_plugin_scan_calledprocesserror(mock_subprocess_check_outp assert issues is None -@mock.patch("statick_tool.plugins.tool.pyflakes_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pyflakes.subprocess.check_output") def test_pyflakes_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means pyflakes doesn't exist). diff --git a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py b/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py index f66847a2..31c9654d 100644 --- a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py +++ b/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the Pylint tool plugin.""" import argparse import multiprocessing +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.pylint_tool_plugin import PylintToolPlugin +from statick_tool.plugins.tool.pylint import PylintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_pylint_tool_plugin(max_procs=1): @@ -34,27 +37,13 @@ def setup_pylint_tool_plugin(max_procs=1): def test_pylint_tool_plugin_found(): """Test that the plugin manager finds the Pylint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "pylint" - assert any( - plugin_info.plugin_object.get_name() == "pylint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Pylint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Pylint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "pylint" for _, plugin in list(plugins.items()) ) @@ -118,7 +107,7 @@ def test_pylint_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.pylint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pylint.subprocess.check_output") def test_pylint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means pylint hit an error). @@ -145,7 +134,7 @@ def test_pylint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output assert issues is None -@mock.patch("statick_tool.plugins.tool.pylint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.pylint.subprocess.check_output") def test_pylint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means pylint doesn't exist). diff --git a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py b/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py index fa62f859..5b7034f3 100644 --- a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py +++ b/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py @@ -1,18 +1,21 @@ """Unit tests for the ruff plugin.""" import argparse +import mock import os import subprocess - -import mock -from yapsy.PluginManager import PluginManager +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.ruff_tool_plugin import RuffToolPlugin +from statick_tool.plugins.tool.ruff import RuffToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_ruff_tool_plugin(): @@ -32,27 +35,13 @@ def setup_ruff_tool_plugin(): def test_ruff_tool_plugin_found(): """Test that the plugin manager can find the ruff plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "ruff" - assert any( - plugin_info.plugin_object.get_name() == "ruff" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named ruff Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Ruff Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "ruff" for _, plugin in list(plugins.items()) ) @@ -101,7 +90,7 @@ def test_ruff_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.ruff_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.ruff.subprocess.check_output") def test_ruff_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means ruff hit an error). @@ -128,7 +117,7 @@ def test_ruff_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): assert not issues -@mock.patch("statick_tool.plugins.tool.ruff_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.ruff.subprocess.check_output") def test_ruff_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means ruff doesn't exist). diff --git a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py b/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py index 31f7fcfc..3c156c4a 100644 --- a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py +++ b/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py @@ -1,20 +1,22 @@ """Unit tests for the Shellcheck tool plugin.""" import argparse +import mock import os +import pytest import subprocess import sys -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.shellcheck_tool_plugin import ShellcheckToolPlugin +from statick_tool.plugins.tool.shellcheck import ShellcheckToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_shellcheck_tool_plugin(binary=None): @@ -37,27 +39,13 @@ def setup_shellcheck_tool_plugin(binary=None): def test_shellcheck_tool_plugin_found(): """Test that the plugin manager finds the Shellcheck plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "shellcheck" - assert any( - plugin_info.plugin_object.get_name() == "shellcheck" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Shellcheck Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Shellcheck Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "shellcheck" for _, plugin in list(plugins.items()) ) @@ -249,7 +237,7 @@ def test_shellcheck_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.shellcheck_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.shellcheck.subprocess.check_output") def test_shellcheck_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means shellcheck hit an error). @@ -281,7 +269,7 @@ def test_shellcheck_tool_plugin_scan_calledprocesserror(mock_subprocess_check_ou assert issues is None -@mock.patch("statick_tool.plugins.tool.shellcheck_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.shellcheck.subprocess.check_output") def test_shellcheck_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means shellcheck doesn't exist). diff --git a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py b/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py index febeab16..ba072315 100644 --- a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py +++ b/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py @@ -1,20 +1,22 @@ """Unit tests for the spotbugs plugin.""" import argparse +import mock import os +import pytest import subprocess import sys -import mock -import pytest -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.spotbugs_tool_plugin import SpotbugsToolPlugin +from statick_tool.plugins.tool.spotbugs import SpotbugsToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_spotbugs_tool_plugin(use_plugin_context=True, custom_rsc_path=None): @@ -41,27 +43,13 @@ def setup_spotbugs_tool_plugin(use_plugin_context=True, custom_rsc_path=None): def test_spotbugs_tool_plugin_found(): """Test that the plugin manager can find the spotbugs plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "spotbugs" - assert any( - plugin_info.plugin_object.get_name() == "spotbugs" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Spotbugs Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Spotbugs Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "spotbugs" for _, plugin in list(plugins.items()) ) @@ -229,7 +217,7 @@ def test_spotbugs_tool_plugin_parse_wrong_file_path(): assert issues[0].filename == "Test.java" -@mock.patch("statick_tool.plugins.tool.spotbugs_tool_plugin.ToolPlugin.command_exists") +@mock.patch("statick_tool.plugins.tool.spotbugs.ToolPlugin.command_exists") def test_spotbugs_tool_plugin_scan_commandnotfound(mock_command_exists): """Test what happens when self.command_exists returns False. @@ -244,7 +232,7 @@ def test_spotbugs_tool_plugin_scan_commandnotfound(mock_command_exists): assert not issues -@mock.patch("statick_tool.plugins.tool.spotbugs_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.spotbugs.subprocess.check_output") def test_spotbugs_tool_plugin_scan_oserror(mock_subprocess_check_output): """ Test what happens when an OSError is raised (usually means maven doesn't exist - unlikely). @@ -262,7 +250,7 @@ def test_spotbugs_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.spotbugs_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.spotbugs.subprocess.check_output") def test_spotbugs_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means maven hit an error). diff --git a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py index b12a898b..5aea7335 100644 --- a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py +++ b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py @@ -1,19 +1,22 @@ """Unit tests for the uncrustify plugin.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.uncrustify_tool_plugin import UncrustifyToolPlugin +from statick_tool.plugins.tool.uncrustify import UncrustifyToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points try: from tempfile import TemporaryDirectory @@ -46,27 +49,13 @@ def setup_uncrustify_tool_plugin(extra_path=None, use_plugin_context=True, binar def test_uncrustify_tool_plugin_found(): """Test that the plugin manager can find the uncrustify plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "uncrustify" - assert any( - plugin_info.plugin_object.get_name() == "uncrustify" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Uncrustify Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "Uncrustify Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "uncrustify" for _, plugin in list(plugins.items()) ) @@ -189,7 +178,7 @@ def test_uncrustify_tool_plugin_scan_missing_fields(): assert not issues -@mock.patch("statick_tool.plugins.tool.uncrustify_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.uncrustify.subprocess.check_output") def test_uncrustify_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means uncrustify doesn't exist). @@ -212,7 +201,7 @@ def test_uncrustify_tool_plugin_scan_oserror(mock_subprocess_check_output): assert issues is None -@mock.patch("statick_tool.plugins.tool.uncrustify_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.uncrustify.subprocess.check_output") def test_uncrustify_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means uncrustify hit an error). diff --git a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py b/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py index 7a3fd605..11b175fc 100644 --- a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py +++ b/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py @@ -1,19 +1,22 @@ """xmllint unit tests.""" import argparse -import os -import subprocess - import mock +import os import pytest -from yapsy.PluginManager import PluginManager +import subprocess +import sys import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.xmllint_tool_plugin import XmllintToolPlugin +from statick_tool.plugins.tool.xmllint import XmllintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_xmllint_tool_plugin(): @@ -33,27 +36,13 @@ def setup_xmllint_tool_plugin(): def test_xmllint_tool_plugin_found(): """Test that the plugin manager finds the xmllint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "xmllint" - assert any( - plugin_info.plugin_object.get_name() == "xmllint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Xmllint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "xmllint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "xmllint" for _, plugin in list(plugins.items()) ) @@ -96,7 +85,7 @@ def test_xmllint_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.xmllint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.xmllint.subprocess.check_output") def test_xmllint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means xmllint hit an error). @@ -117,7 +106,7 @@ def test_xmllint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_outpu assert issues is None -@mock.patch("statick_tool.plugins.tool.xmllint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.xmllint.subprocess.check_output") def test_xmllint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means xmllint doesn't exist). diff --git a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py b/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py index 25a62703..f6a06f8a 100644 --- a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py +++ b/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py @@ -1,19 +1,21 @@ """Unit tests for the YAMLLint tool plugin.""" import argparse +import mock import os import subprocess import sys -import mock -from yapsy.PluginManager import PluginManager - import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.yamllint_tool_plugin import YamllintToolPlugin +from statick_tool.plugins.tool.yamllint import YamllintToolPlugin from statick_tool.resources import Resources -from statick_tool.tool_plugin import ToolPlugin + +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points def setup_yamllint_tool_plugin(): @@ -33,27 +35,13 @@ def setup_yamllint_tool_plugin(): def test_yamllint_tool_plugin_found(): """Test that the plugin manager finds the YAMLLint plugin.""" - manager = PluginManager() - # Get the path to statick_tool/__init__.py, get the directory part, and - # add 'plugins' to that to get the standard plugins dir - manager.setPluginPlaces( - [os.path.join(os.path.dirname(statick_tool.__file__), "plugins")] - ) - manager.setCategoriesFilter( - { - "Tool": ToolPlugin, - } - ) - manager.collectPlugins() - # Verify that a plugin's get_name() function returns "yamllint" - assert any( - plugin_info.plugin_object.get_name() == "yamllint" - for plugin_info in manager.getPluginsOfCategory("Tool") - ) - # While we're at it, verify that a plugin is named Yamllint Tool Plugin + plugins = {} + tool_plugins = entry_points(group="statick_tool.plugins.tool") + for plugin_type in tool_plugins: + plugin = plugin_type.load() + plugins[plugin_type.name] = plugin() assert any( - plugin_info.name == "yamllint Tool Plugin" - for plugin_info in manager.getPluginsOfCategory("Tool") + plugin.get_name() == "yamllint" for _, plugin in list(plugins.items()) ) @@ -99,7 +87,7 @@ def test_yamllint_tool_plugin_parse_invalid(): assert not issues -@mock.patch("statick_tool.plugins.tool.yamllint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.yamllint.subprocess.check_output") def test_yamllint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_output): """Test what happens when a CalledProcessError is raised (usually means yamllint hit an error). @@ -126,7 +114,7 @@ def test_yamllint_tool_plugin_scan_calledprocesserror(mock_subprocess_check_outp assert issues is None -@mock.patch("statick_tool.plugins.tool.yamllint_tool_plugin.subprocess.check_output") +@mock.patch("statick_tool.plugins.tool.yamllint.subprocess.check_output") def test_yamllint_tool_plugin_scan_oserror(mock_subprocess_check_output): """Test what happens when an OSError is raised (usually means yamllint doesn't exist). diff --git a/tests/statick_tool/test_statick_tool.py b/tests/statick_tool/test_statick_tool.py index dfd7d583..7ba691f6 100644 --- a/tests/statick_tool/test_statick_tool.py +++ b/tests/statick_tool/test_statick_tool.py @@ -1,5 +1,4 @@ """Unit tests of statick_tool.py.""" - import contextlib import logging import multiprocessing @@ -15,7 +14,7 @@ from statick_tool.args import Args from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.package import Package -from statick_tool.plugins.tool.clang_tidy_tool_plugin import ClangTidyToolPlugin +from statick_tool.plugins.tool.clang_tidy import ClangTidyToolPlugin from statick_tool.statick_tool import Statick LOGGER = logging.getLogger(__name__) @@ -558,6 +557,7 @@ def test_run_tool_dependency(init_statick): path = parsed_args.path statick.get_config(parsed_args) statick.get_exceptions(parsed_args) + print(f"tool plugins: {statick.tool_plugins}") issues, success = statick.run(path, parsed_args) for tool in issues: assert not issues[tool] From 1a027affc671f8c3fcc8d8981641769ac0232a69 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 21 Nov 2023 22:32:34 -0800 Subject: [PATCH 05/58] Remove use of backports.tempfile. Only needed for Python 3.6 and older, which are no longer supported by Statick. --- pyproject.toml | 1 - tests/exceptions/test_exceptions.py | 7 +------ .../test_code_climate_reporting_plugin.py | 7 +------ .../json_reporting_plugin/test_json_reporting_plugin.py | 7 +------ .../test_write_jenkins_warnings_ng_reporting_plugin.py | 7 +------ .../uncrustify_tool_plugin/test_uncrustify_tool_plugin.py | 7 +------ tests/resources/test_resources.py | 7 +------ tests/tool_plugin/test_tool_plugin.py | 7 +------ 8 files changed, 7 insertions(+), 43 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9423ce78..fb926ef5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,7 +111,6 @@ yamllint = "statick_tool.plugins.tool.yamllint:YamllintToolPlugin" [project.optional-dependencies] test = [ - "backports.tempfile", "flake8-pep3101", "flake8<5", # Pin until https://github.com/tholo/pytest-flake8/issues/87 is fixed. "lark", diff --git a/tests/exceptions/test_exceptions.py b/tests/exceptions/test_exceptions.py index 1e7dc24b..ade37f3d 100644 --- a/tests/exceptions/test_exceptions.py +++ b/tests/exceptions/test_exceptions.py @@ -8,12 +8,7 @@ from statick_tool.issue import Issue from statick_tool.package import Package -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory def test_exceptions_init_valid(): diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py index f664eecb..381ec7d7 100644 --- a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py +++ b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py @@ -16,12 +16,7 @@ else: from importlib.metadata import entry_points -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory def setup_code_climate_reporting_plugin( diff --git a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py index 2ad2d7bd..227e1720 100644 --- a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py +++ b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py @@ -15,12 +15,7 @@ else: from importlib.metadata import entry_points -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory def setup_json_reporting_plugin(file_path, use_plugin_context=True): diff --git a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py index ec406d78..625f4358 100644 --- a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py +++ b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py @@ -20,12 +20,7 @@ else: from importlib.metadata import entry_points -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory output_regex = r"^{\"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\", \"(.*)\": (\d+), \"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\"}" diff --git a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py index 5aea7335..79d03c80 100644 --- a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py +++ b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py @@ -18,12 +18,7 @@ else: from importlib.metadata import entry_points -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory def setup_uncrustify_tool_plugin(extra_path=None, use_plugin_context=True, binary=None): diff --git a/tests/resources/test_resources.py b/tests/resources/test_resources.py index 161debb1..08ced973 100644 --- a/tests/resources/test_resources.py +++ b/tests/resources/test_resources.py @@ -7,12 +7,7 @@ import statick_tool from statick_tool.resources import Resources -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory LOGGER = logging.getLogger(__name__) diff --git a/tests/tool_plugin/test_tool_plugin.py b/tests/tool_plugin/test_tool_plugin.py index 2720672b..2ca32699 100644 --- a/tests/tool_plugin/test_tool_plugin.py +++ b/tests/tool_plugin/test_tool_plugin.py @@ -12,12 +12,7 @@ from statick_tool.resources import Resources from statick_tool.tool_plugin import ToolPlugin -try: - from tempfile import TemporaryDirectory -except: # pylint: disable=bare-except # noqa: E722 # NOLINT - from backports.tempfile import ( # pylint: disable=wrong-import-order - TemporaryDirectory, - ) +from tempfile import TemporaryDirectory def test_tool_plugin_load_mapping_valid(): From 2c02f2f504bd7bda49b37cb1a1ea127ee03a676d Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 21 Nov 2023 22:37:04 -0800 Subject: [PATCH 06/58] Temporarily disable statick-md checks. --- .github/workflows/test.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e5bc243..c20f546a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -103,11 +103,12 @@ jobs: run: | mypy --ignore-missing-imports --strict src/statick_tool/ - - name: Statick markdown - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' - run: | - pip install statick-md - statick . --check --profile documentation.yaml + # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. + # - name: Statick markdown + # if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' + # run: | + # pip install statick-md + # statick . --check --profile documentation.yaml - name: Sphinx lint if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu.22.04' From b218a906f06d9c77c2ec770c0471097365b820a3 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 21 Nov 2023 22:54:56 -0800 Subject: [PATCH 07/58] Remove use of importlib_metadata. Only needed for Python <3.8. --- src/statick_tool/statick_tool.py | 6 +----- .../c_discovery_plugin/test_c_discovery_plugin.py | 7 +------ .../test_cmake_discovery_plugin.py | 10 ++-------- .../test_groovy_discovery_plugin.py | 7 +------ .../test_java_discovery_plugin.py | 7 +------ .../test_maven_discovery_plugin.py | 7 +------ .../test_perl_discovery_plugin.py | 7 +------ .../test_python_discovery_plugin.py | 7 +------ .../ros_discovery_plugin/test_ros_discovery_plugin.py | 7 +------ .../test_shell_discovery_plugin.py | 7 +------ .../xml_discovery_plugin/test_xml_discovery_plugin.py | 7 +------ .../test_yaml_discovery_plugin.py | 7 +------ .../test_code_climate_reporting_plugin.py | 10 ++-------- .../test_do_nothing_reporting_plugin.py | 7 +------ .../test_json_reporting_plugin.py | 10 ++-------- .../test_print_to_console_reporting_plugin.py | 7 +------ .../test_write_jenkins_warnings_ng_reporting_plugin.py | 10 ++-------- .../tool/bandit_tool_plugin/test_bandit_tool_plugin.py | 7 +------ .../tool/black_tool_plugin/test_black_tool_plugin.py | 7 +------ .../test_catkin-lint_tool_plugin.py | 7 +------ .../tool/cccc_tool_plugin/test_cccc_tool_plugin.py | 7 +------ .../test_clang-format_tool_plugin.py | 7 +------ .../test_clang-tidy_tool_plugin.py | 9 ++------- .../test_cmakelint_tool_plugin.py | 7 +------ .../cppcheck_tool_plugin/test_cppcheck_tool_plugin.py | 7 +------ .../cpplint_tool_plugin/test_cpplint_tool_plugin.py | 9 ++------- .../test_do_nothing_tool_plugin.py | 8 +------- .../test_docformatter_tool_plugin.py | 7 +------ .../test_flawfinder_tool_plugin.py | 6 +----- .../test_groovylint_tool_plugin.py | 7 +------ .../tool/isort_tool_plugin/test_isort_tool_plugin.py | 8 +------- .../tool/lizard_tool_plugin/test_lizard_tool_plugin.py | 7 +------ .../tool/make_tool_plugin/test_make_tool_plugin.py | 7 +------ .../tool/mypy_tool_plugin/test_mypy_tool_plugin.py | 7 +------ .../test_perlcritic_tool_plugin.py | 7 +------ .../test_pycodestyle_tool_plugin.py | 7 +------ .../test_pydocstyle_tool_plugin.py | 7 +------ .../pyflakes_tool_plugin/test_pyflakes_tool_plugin.py | 7 +------ .../tool/pylint_tool_plugin/test_pylint_tool_plugin.py | 7 +------ .../tool/ruff_tool_plugin/test_ruff_tool_plugin.py | 7 +------ .../test_shellcheck_tool_plugin.py | 6 +----- .../spotbugs_tool_plugin/test_spotbugs_tool_plugin.py | 6 +----- .../test_uncrustify_tool_plugin.py | 10 ++-------- .../xmllint_tool_plugin/test_xmllint_tool_plugin.py | 7 +------ .../yamllint_tool_plugin/test_yamllint_tool_plugin.py | 6 +----- 45 files changed, 52 insertions(+), 279 deletions(-) diff --git a/src/statick_tool/statick_tool.py b/src/statick_tool/statick_tool.py index 6e44e4e9..029ec48e 100644 --- a/src/statick_tool/statick_tool.py +++ b/src/statick_tool/statick_tool.py @@ -7,6 +7,7 @@ import os import sys import time +from importlib.metadata import entry_points from logging.handlers import MemoryHandler from typing import Any, Dict, List, Optional, Tuple @@ -22,11 +23,6 @@ from statick_tool.resources import Resources from statick_tool.timing import Timing -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - class Statick: # pylint: disable=too-many-instance-attributes """Code analysis front-end.""" diff --git a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py b/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py index c2bff110..ec27f1b4 100644 --- a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py +++ b/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py @@ -1,17 +1,12 @@ """Unit tests for the C discovery plugin.""" import contextlib import os -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.c import CDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py b/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py index 875e567c..4ec009ec 100644 --- a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py +++ b/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py @@ -1,10 +1,9 @@ """Unit tests for the CMake discovery plugin.""" import argparse +import mock import os import subprocess -import sys - -import mock +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +12,6 @@ from statick_tool.plugins.discovery.cmake import CMakeDiscoveryPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_cmake_discovery_plugin(add_plugin_context=True, cmake_flags=""): """Create an instance of the CMake discovery plugin.""" diff --git a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py b/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py index 5b8ec4da..126d67ca 100644 --- a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py +++ b/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the Groovy discovery plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.groovy import GroovyDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_groovy_plugin_found(): """Test that the plugin manager finds the Groovy discovery plugin.""" diff --git a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py b/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py index bf86101c..bfc9f19e 100644 --- a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py +++ b/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the Java discovery plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.java import JavaDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_java_discovery_plugin_found(): """Test that the plugin manager finds the Java discovery plugin.""" diff --git a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py b/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py index b2afe9f7..ca67f5f7 100644 --- a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py +++ b/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the Maven discovery plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.maven import MavenDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_maven_discovery_plugin_found(): """Test that the plugin manager finds the Maven discovery plugin.""" diff --git a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py b/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py index 22b7a006..547561b2 100644 --- a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py +++ b/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py @@ -2,17 +2,12 @@ import contextlib import os import pytest -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.perl import PerlDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py b/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py index 5a10cb69..aee91570 100644 --- a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py +++ b/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py @@ -2,17 +2,12 @@ import contextlib import os import pytest -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.python import PythonDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py b/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py index f12103f3..6d6c53a3 100644 --- a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py +++ b/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the ROS discovery plugin.""" import contextlib import os -import sys +from importlib.metadata import entry_points from statick_tool.package import Package from statick_tool.plugins.discovery.ros import RosDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py b/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py index ee2a88ec..d5da66d8 100644 --- a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py +++ b/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py @@ -2,17 +2,12 @@ import contextlib import os import pytest -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.shell import ShellDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - # From https://stackoverflow.com/questions/2059482/shell-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py b/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py index daa823f0..94a7276b 100644 --- a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py +++ b/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the XML discovery plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.xml import XMLDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_xml_discovery_plugin_found(): """Test that the XML discovery plugin is detected by the plugin system.""" diff --git a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py b/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py index 5c33ec9e..cfeae217 100644 --- a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py +++ b/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the YAML discovery plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.yaml import YAMLDiscoveryPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_yaml_discovery_plugin_found(): """Test that the YAML discovery plugin is detected by the plugin system.""" diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py index 381ec7d7..0bb3edda 100644 --- a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py +++ b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py @@ -2,7 +2,8 @@ import argparse import json import os -import sys +from importlib.metadata import entry_points +from tempfile import TemporaryDirectory from statick_tool.config import Config from statick_tool.issue import Issue @@ -11,13 +12,6 @@ from statick_tool.plugins.reporting.code_climate import CodeClimateReportingPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - -from tempfile import TemporaryDirectory - def setup_code_climate_reporting_plugin( file_path, diff --git a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py b/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py index 2aa5b6c6..4bb40ed8 100644 --- a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py +++ b/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py @@ -1,16 +1,11 @@ """Unit tests for the do nothing reporting plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugins.reporting.do_nothing import DoNothingReportingPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_do_nothing_reporting_plugin_found(): """Test that the plugin manager finds the do nothing reporting plugin.""" diff --git a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py index 227e1720..3007d7dc 100644 --- a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py +++ b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py @@ -1,7 +1,8 @@ """Unit tests for the JSON reporting plugin.""" import argparse import os -import sys +from importlib.metadata import entry_points +from tempfile import TemporaryDirectory from statick_tool.config import Config from statick_tool.issue import Issue @@ -10,13 +11,6 @@ from statick_tool.plugins.reporting.json import JsonReportingPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - -from tempfile import TemporaryDirectory - def setup_json_reporting_plugin(file_path, use_plugin_context=True): """Create an instance of the file writer plugin.""" diff --git a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py b/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py index a9878403..c9e7e5d9 100644 --- a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py +++ b/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py @@ -1,6 +1,6 @@ """Unit tests for the console reporting plugin.""" import os -import sys +from importlib.metadata import entry_points from statick_tool.issue import Issue from statick_tool.package import Package @@ -8,11 +8,6 @@ PrintToConsoleReportingPlugin, ) -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def test_console_reporting_plugin_found(): """Test that the plugin manager finds the console reporting plugin.""" diff --git a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py index 625f4358..a6652068 100644 --- a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py +++ b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py @@ -3,7 +3,8 @@ import json import os import re -import sys +from importlib.metadata import entry_points +from tempfile import TemporaryDirectory import statick_tool from statick_tool.config import Config @@ -15,13 +16,6 @@ ) from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - -from tempfile import TemporaryDirectory - output_regex = r"^{\"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\", \"(.*)\": (\d+), \"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\"}" diff --git a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py b/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py index 204f2431..cedbc0ef 100644 --- a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py +++ b/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +12,6 @@ from statick_tool.plugins.tool.bandit import BanditToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_bandit_tool_plugin(binary=None): """Create an instance of the bandit plugin.""" diff --git a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py b/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py index 3d9c86b1..73f439d5 100644 --- a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py +++ b/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.black import BlackToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_black_tool_plugin(): """Create and return an instance of the PyCodeStyle plugin.""" diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py b/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py index 9d678d18..7df32b7b 100644 --- a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py +++ b/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.catkin_lint import CatkinLintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_catkin_lint_tool_plugin(): """Construct and return an instance of the CatkinLint plugin.""" diff --git a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py b/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py index 393d054f..153ca7b7 100644 --- a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py +++ b/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py @@ -7,8 +7,8 @@ import pytest import shutil import subprocess -import sys import xmltodict +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -17,11 +17,6 @@ from statick_tool.plugins.tool.cccc import CCCCToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_cccc_tool_plugin(use_plugin_context=True, binary=None, cccc_config=None): """Create an instance of the CCCC plugin.""" diff --git a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py b/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py index 2d71c255..21557165 100644 --- a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py +++ b/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py @@ -5,8 +5,8 @@ import pytest import shutil import subprocess -import sys from xml.etree import ElementTree +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -16,11 +16,6 @@ from statick_tool.plugins.tool.clang_format import ClangFormatToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_clang_format_tool_plugin( use_plugin_context=True, binary=None, do_raise=False, issue_per_line=False diff --git a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py b/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py index 839a5e02..931311c5 100644 --- a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py +++ b/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py @@ -5,6 +5,8 @@ import pytest import subprocess import sys +from importlib.metadata import entry_points +from tempfile import TemporaryDirectory import statick_tool from statick_tool.config import Config @@ -13,13 +15,6 @@ from statick_tool.plugins.tool.clang_tidy import ClangTidyToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - -from tempfile import TemporaryDirectory - def setup_clang_tidy_tool_plugin(use_plugin_context=True, binary=None): """Initialize and return an instance of the clang-tidy plugin.""" diff --git a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py b/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py index d4989fdf..a48f60b4 100644 --- a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py +++ b/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +12,6 @@ from statick_tool.plugins.tool.cmakelint import CMakelintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_cmakelint_tool_plugin(): """Create an instance of the cmakelint plugin.""" diff --git a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py b/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py index 5dfb9e02..71de326c 100644 --- a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py +++ b/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.cppcheck import CppcheckToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_cppcheck_tool_plugin(use_plugin_context=True, binary=None): """Initialize and return an instance of the cppcheck plugin.""" diff --git a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py b/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py index 55081bfb..c3e902a5 100644 --- a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py +++ b/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py @@ -5,6 +5,8 @@ import pytest import subprocess import sys +from importlib.metadata import entry_points +from tempfile import TemporaryDirectory import statick_tool from statick_tool.config import Config @@ -13,13 +15,6 @@ from statick_tool.plugins.tool.cpplint import CpplintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - -from tempfile import TemporaryDirectory - def setup_cpplint_tool_plugin(): """Initialize and return an instance of the cpplint plugin.""" diff --git a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py b/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py index 683780fb..90b2d4d4 100644 --- a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py +++ b/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py @@ -1,16 +1,10 @@ """Unit tests for the do nothing tool plugin.""" import os -import sys +from importlib.metadata import entry_points -import statick_tool from statick_tool.package import Package from statick_tool.plugins.tool.do_nothing import DoNothingToolPlugin -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_do_nothing_tool_plugin(): """Create and return an instance of the do nothing plugin.""" diff --git a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py index fe3c67c5..6c3df6e2 100644 --- a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py +++ b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.docformatter import DocformatterToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_docformatter_tool_plugin(): """Create and return an instance of the Docformatter plugin.""" diff --git a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py b/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py index f8453333..c2fee829 100644 --- a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py +++ b/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py @@ -5,6 +5,7 @@ import pytest import subprocess import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +14,6 @@ from statick_tool.plugins.tool.flawfinder import FlawfinderToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_flawfinder_tool_plugin(): """Initialize and return an instance of the flawfinder plugin.""" diff --git a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py b/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py index b0ac0129..11dcbc52 100644 --- a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py +++ b/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.groovylint import GroovyLintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_groovylint_tool_plugin(): """Initialize and return an instance of the groovylint plugin.""" diff --git a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py b/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py index 316c2278..9ae564f6 100644 --- a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py +++ b/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py @@ -2,9 +2,8 @@ import argparse import mock import os -import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +12,6 @@ from statick_tool.plugins.tool.isort import IsortToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_isort_tool_plugin(custom_rsc_path=None): """Create and return an instance of the Isort plugin.""" diff --git a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py b/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py index f067af88..9fb56f5a 100644 --- a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py +++ b/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py @@ -2,7 +2,7 @@ import argparse import pytest import os -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -11,11 +11,6 @@ from statick_tool.plugins.tool.lizard import LizardToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_lizard_tool_plugin(custom_rsc_path=None): """Initialize and return an instance of the lizard plugin.""" diff --git a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py b/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py index 19a9a2e7..31998991 100644 --- a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py +++ b/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.make import MakeToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_make_tool_plugin(): """Construct and return an instance of the Make plugin.""" diff --git a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py b/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py index 135a7fa4..3fb7c3e7 100644 --- a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py +++ b/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.mypy import MypyToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_mypy_tool_plugin(): """Create and return an instance of the Mypy plugin.""" diff --git a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py b/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py index dec6249c..54fe64e5 100644 --- a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py +++ b/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.perlcritic import PerlCriticToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_perlcritic_tool_plugin(binary=None): """Initialize and return a perlcritic plugin.""" diff --git a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py b/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py index 4fa98011..e29c2e17 100644 --- a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py +++ b/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +12,6 @@ from statick_tool.plugins.tool.pycodestyle import PycodestyleToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_pycodestyle_tool_plugin(): """Create and return an instance of the PyCodeStyle plugin.""" diff --git a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py b/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py index 65c49d1a..45aa5577 100644 --- a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py +++ b/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +12,6 @@ from statick_tool.plugins.tool.pydocstyle import PydocstyleToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_pydocstyle_tool_plugin(): """Initialize and return a PyCodeStyle plugin.""" diff --git a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py b/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py index 9845c31c..9506b1a8 100644 --- a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py +++ b/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +12,6 @@ from statick_tool.plugins.tool.pyflakes import PyflakesToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_pyflakes_tool_plugin(): """Initialize and return a Pyflakes plugin.""" diff --git a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py b/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py index 31c9654d..0b67f27e 100644 --- a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py +++ b/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py @@ -4,7 +4,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.pylint import PylintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_pylint_tool_plugin(max_procs=1): """Construct and return an instance of the Pylint plugin.""" diff --git a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py b/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py index 5b7034f3..c52d1661 100644 --- a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py +++ b/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +12,6 @@ from statick_tool.plugins.tool.ruff import RuffToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_ruff_tool_plugin(): """Initialize and return a ruff plugin.""" diff --git a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py b/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py index 3c156c4a..a40715aa 100644 --- a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py +++ b/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py @@ -5,6 +5,7 @@ import pytest import subprocess import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +14,6 @@ from statick_tool.plugins.tool.shellcheck import ShellcheckToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_shellcheck_tool_plugin(binary=None): """Construct and return an instance of the Shellcheck plugin.""" diff --git a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py b/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py index ba072315..4ccf0f65 100644 --- a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py +++ b/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py @@ -5,6 +5,7 @@ import pytest import subprocess import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +14,6 @@ from statick_tool.plugins.tool.spotbugs import SpotbugsToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_spotbugs_tool_plugin(use_plugin_context=True, custom_rsc_path=None): """Initialize and return a spotbugs plugin.""" diff --git a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py index 79d03c80..d4cbc419 100644 --- a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py +++ b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py @@ -4,7 +4,8 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points +from tempfile import TemporaryDirectory import statick_tool from statick_tool.config import Config @@ -13,13 +14,6 @@ from statick_tool.plugins.tool.uncrustify import UncrustifyToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - -from tempfile import TemporaryDirectory - def setup_uncrustify_tool_plugin(extra_path=None, use_plugin_context=True, binary=None): """Initialize and return an instance of the uncrustify plugin.""" diff --git a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py b/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py index 11b175fc..a93d19f5 100644 --- a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py +++ b/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,11 +13,6 @@ from statick_tool.plugins.tool.xmllint import XmllintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_xmllint_tool_plugin(): """Create an instance of the xmllint plugin.""" diff --git a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py b/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py index f6a06f8a..04b7ab57 100644 --- a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py +++ b/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py @@ -4,6 +4,7 @@ import os import subprocess import sys +from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -12,11 +13,6 @@ from statick_tool.plugins.tool.yamllint import YamllintToolPlugin from statick_tool.resources import Resources -if sys.version_info < (3, 10): - from importlib_metadata import entry_points -else: - from importlib.metadata import entry_points - def setup_yamllint_tool_plugin(): """Construct and return an instance of the YAMLLint plugin.""" From 7bb0d3e04a7eb7345859b0a137e8b7a065480441 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:11:38 -0800 Subject: [PATCH 08/58] Debug print for importlib version. --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c20f546a..b6afc484 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -101,6 +101,7 @@ jobs: - name: Test with mypy run: | + pip list | grep importlib mypy --ignore-missing-imports --strict src/statick_tool/ # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. From 19305613f1be506ceba3cd3592015d4a7d45d3fa Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:22:50 -0800 Subject: [PATCH 09/58] Try importlib_metadata fix. --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6afc484..86821283 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,9 +99,13 @@ jobs: npm install -g markdownlint-cli@0.21.0 npm install -g npm-groovy-lint + # Have to uninstall twice, then install. + # https://github.com/pypa/twine/issues/760 - name: Test with mypy run: | - pip list | grep importlib + pip uninstall importlib_metadata + pip uninstall importlib_metadata + pip install importlib_metadata mypy --ignore-missing-imports --strict src/statick_tool/ # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. From 27c5dae25d4af80cf7361baf932da226f9c55e2f Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:25:54 -0800 Subject: [PATCH 10/58] Try mypy on ubuntu only. --- .github/workflows/test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86821283..be60961b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,13 +99,9 @@ jobs: npm install -g markdownlint-cli@0.21.0 npm install -g npm-groovy-lint - # Have to uninstall twice, then install. - # https://github.com/pypa/twine/issues/760 - name: Test with mypy + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu.22.04' run: | - pip uninstall importlib_metadata - pip uninstall importlib_metadata - pip install importlib_metadata mypy --ignore-missing-imports --strict src/statick_tool/ # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. From ac3459382a2b54c2adbf11dc4b9383d4a1d36efd Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:29:54 -0800 Subject: [PATCH 11/58] Try mypy on only Python 3.11. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index be60961b..1d1b4efa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -100,7 +100,7 @@ jobs: npm install -g npm-groovy-lint - name: Test with mypy - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu.22.04' + if: matrix.python-version == '3.11' run: | mypy --ignore-missing-imports --strict src/statick_tool/ From 412303ac92030490a2bd8350c23605b7e016959c Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:35:42 -0800 Subject: [PATCH 12/58] Revert "Remove use of importlib_metadata. Only needed for Python <3.8." This reverts commit b218a906f06d9c77c2ec770c0471097365b820a3. --- src/statick_tool/statick_tool.py | 6 +++++- .../c_discovery_plugin/test_c_discovery_plugin.py | 7 ++++++- .../test_cmake_discovery_plugin.py | 10 ++++++++-- .../test_groovy_discovery_plugin.py | 7 ++++++- .../test_java_discovery_plugin.py | 7 ++++++- .../test_maven_discovery_plugin.py | 7 ++++++- .../test_perl_discovery_plugin.py | 7 ++++++- .../test_python_discovery_plugin.py | 7 ++++++- .../ros_discovery_plugin/test_ros_discovery_plugin.py | 7 ++++++- .../test_shell_discovery_plugin.py | 7 ++++++- .../xml_discovery_plugin/test_xml_discovery_plugin.py | 7 ++++++- .../test_yaml_discovery_plugin.py | 7 ++++++- .../test_code_climate_reporting_plugin.py | 10 ++++++++-- .../test_do_nothing_reporting_plugin.py | 7 ++++++- .../test_json_reporting_plugin.py | 10 ++++++++-- .../test_print_to_console_reporting_plugin.py | 7 ++++++- .../test_write_jenkins_warnings_ng_reporting_plugin.py | 10 ++++++++-- .../tool/bandit_tool_plugin/test_bandit_tool_plugin.py | 7 ++++++- .../tool/black_tool_plugin/test_black_tool_plugin.py | 7 ++++++- .../test_catkin-lint_tool_plugin.py | 7 ++++++- .../tool/cccc_tool_plugin/test_cccc_tool_plugin.py | 7 ++++++- .../test_clang-format_tool_plugin.py | 7 ++++++- .../test_clang-tidy_tool_plugin.py | 9 +++++++-- .../test_cmakelint_tool_plugin.py | 7 ++++++- .../cppcheck_tool_plugin/test_cppcheck_tool_plugin.py | 7 ++++++- .../cpplint_tool_plugin/test_cpplint_tool_plugin.py | 9 +++++++-- .../test_do_nothing_tool_plugin.py | 8 +++++++- .../test_docformatter_tool_plugin.py | 7 ++++++- .../test_flawfinder_tool_plugin.py | 6 +++++- .../test_groovylint_tool_plugin.py | 7 ++++++- .../tool/isort_tool_plugin/test_isort_tool_plugin.py | 8 +++++++- .../tool/lizard_tool_plugin/test_lizard_tool_plugin.py | 7 ++++++- .../tool/make_tool_plugin/test_make_tool_plugin.py | 7 ++++++- .../tool/mypy_tool_plugin/test_mypy_tool_plugin.py | 7 ++++++- .../test_perlcritic_tool_plugin.py | 7 ++++++- .../test_pycodestyle_tool_plugin.py | 7 ++++++- .../test_pydocstyle_tool_plugin.py | 7 ++++++- .../pyflakes_tool_plugin/test_pyflakes_tool_plugin.py | 7 ++++++- .../tool/pylint_tool_plugin/test_pylint_tool_plugin.py | 7 ++++++- .../tool/ruff_tool_plugin/test_ruff_tool_plugin.py | 7 ++++++- .../test_shellcheck_tool_plugin.py | 6 +++++- .../spotbugs_tool_plugin/test_spotbugs_tool_plugin.py | 6 +++++- .../test_uncrustify_tool_plugin.py | 10 ++++++++-- .../xmllint_tool_plugin/test_xmllint_tool_plugin.py | 7 ++++++- .../yamllint_tool_plugin/test_yamllint_tool_plugin.py | 6 +++++- 45 files changed, 279 insertions(+), 52 deletions(-) diff --git a/src/statick_tool/statick_tool.py b/src/statick_tool/statick_tool.py index 029ec48e..6e44e4e9 100644 --- a/src/statick_tool/statick_tool.py +++ b/src/statick_tool/statick_tool.py @@ -7,7 +7,6 @@ import os import sys import time -from importlib.metadata import entry_points from logging.handlers import MemoryHandler from typing import Any, Dict, List, Optional, Tuple @@ -23,6 +22,11 @@ from statick_tool.resources import Resources from statick_tool.timing import Timing +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + class Statick: # pylint: disable=too-many-instance-attributes """Code analysis front-end.""" diff --git a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py b/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py index ec27f1b4..c2bff110 100644 --- a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py +++ b/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py @@ -1,12 +1,17 @@ """Unit tests for the C discovery plugin.""" import contextlib import os -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.c import CDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py b/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py index 4ec009ec..875e567c 100644 --- a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py +++ b/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py @@ -1,9 +1,10 @@ """Unit tests for the CMake discovery plugin.""" import argparse -import mock import os import subprocess -from importlib.metadata import entry_points +import sys + +import mock import statick_tool from statick_tool.config import Config @@ -12,6 +13,11 @@ from statick_tool.plugins.discovery.cmake import CMakeDiscoveryPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_cmake_discovery_plugin(add_plugin_context=True, cmake_flags=""): """Create an instance of the CMake discovery plugin.""" diff --git a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py b/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py index 126d67ca..5b8ec4da 100644 --- a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py +++ b/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the Groovy discovery plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.groovy import GroovyDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_groovy_plugin_found(): """Test that the plugin manager finds the Groovy discovery plugin.""" diff --git a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py b/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py index bfc9f19e..bf86101c 100644 --- a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py +++ b/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the Java discovery plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.java import JavaDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_java_discovery_plugin_found(): """Test that the plugin manager finds the Java discovery plugin.""" diff --git a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py b/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py index ca67f5f7..b2afe9f7 100644 --- a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py +++ b/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the Maven discovery plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.maven import MavenDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_maven_discovery_plugin_found(): """Test that the plugin manager finds the Maven discovery plugin.""" diff --git a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py b/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py index 547561b2..22b7a006 100644 --- a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py +++ b/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py @@ -2,12 +2,17 @@ import contextlib import os import pytest -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.perl import PerlDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py b/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py index aee91570..5a10cb69 100644 --- a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py +++ b/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py @@ -2,12 +2,17 @@ import contextlib import os import pytest -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.python import PythonDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py b/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py index 6d6c53a3..f12103f3 100644 --- a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py +++ b/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the ROS discovery plugin.""" import contextlib import os -from importlib.metadata import entry_points +import sys from statick_tool.package import Package from statick_tool.plugins.discovery.ros import RosDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + # From https://stackoverflow.com/questions/2059482/python-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py b/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py index d5da66d8..ee2a88ec 100644 --- a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py +++ b/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py @@ -2,12 +2,17 @@ import contextlib import os import pytest -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.shell import ShellDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + # From https://stackoverflow.com/questions/2059482/shell-temporarily-modify-the-current-processs-environment @contextlib.contextmanager diff --git a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py b/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py index 94a7276b..daa823f0 100644 --- a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py +++ b/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the XML discovery plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.xml import XMLDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_xml_discovery_plugin_found(): """Test that the XML discovery plugin is detected by the plugin system.""" diff --git a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py b/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py index cfeae217..5c33ec9e 100644 --- a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py +++ b/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the YAML discovery plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.yaml import YAMLDiscoveryPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_yaml_discovery_plugin_found(): """Test that the YAML discovery plugin is detected by the plugin system.""" diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py index 0bb3edda..381ec7d7 100644 --- a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py +++ b/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py @@ -2,8 +2,7 @@ import argparse import json import os -from importlib.metadata import entry_points -from tempfile import TemporaryDirectory +import sys from statick_tool.config import Config from statick_tool.issue import Issue @@ -12,6 +11,13 @@ from statick_tool.plugins.reporting.code_climate import CodeClimateReportingPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory + def setup_code_climate_reporting_plugin( file_path, diff --git a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py b/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py index 4bb40ed8..2aa5b6c6 100644 --- a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py +++ b/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py @@ -1,11 +1,16 @@ """Unit tests for the do nothing reporting plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.plugins.reporting.do_nothing import DoNothingReportingPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_do_nothing_reporting_plugin_found(): """Test that the plugin manager finds the do nothing reporting plugin.""" diff --git a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py index 3007d7dc..227e1720 100644 --- a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py +++ b/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py @@ -1,8 +1,7 @@ """Unit tests for the JSON reporting plugin.""" import argparse import os -from importlib.metadata import entry_points -from tempfile import TemporaryDirectory +import sys from statick_tool.config import Config from statick_tool.issue import Issue @@ -11,6 +10,13 @@ from statick_tool.plugins.reporting.json import JsonReportingPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory + def setup_json_reporting_plugin(file_path, use_plugin_context=True): """Create an instance of the file writer plugin.""" diff --git a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py b/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py index c9e7e5d9..a9878403 100644 --- a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py +++ b/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py @@ -1,6 +1,6 @@ """Unit tests for the console reporting plugin.""" import os -from importlib.metadata import entry_points +import sys from statick_tool.issue import Issue from statick_tool.package import Package @@ -8,6 +8,11 @@ PrintToConsoleReportingPlugin, ) +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def test_console_reporting_plugin_found(): """Test that the plugin manager finds the console reporting plugin.""" diff --git a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py index a6652068..625f4358 100644 --- a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py +++ b/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py @@ -3,8 +3,7 @@ import json import os import re -from importlib.metadata import entry_points -from tempfile import TemporaryDirectory +import sys import statick_tool from statick_tool.config import Config @@ -16,6 +15,13 @@ ) from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory + output_regex = r"^{\"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\", \"(.*)\": (\d+), \"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\", \"(.*)\": \"(.*)\"}" diff --git a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py b/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py index cedbc0ef..204f2431 100644 --- a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py +++ b/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +12,11 @@ from statick_tool.plugins.tool.bandit import BanditToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_bandit_tool_plugin(binary=None): """Create an instance of the bandit plugin.""" diff --git a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py b/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py index 73f439d5..3d9c86b1 100644 --- a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py +++ b/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.black import BlackToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_black_tool_plugin(): """Create and return an instance of the PyCodeStyle plugin.""" diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py b/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py index 7df32b7b..9d678d18 100644 --- a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py +++ b/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.catkin_lint import CatkinLintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_catkin_lint_tool_plugin(): """Construct and return an instance of the CatkinLint plugin.""" diff --git a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py b/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py index 153ca7b7..393d054f 100644 --- a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py +++ b/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py @@ -7,8 +7,8 @@ import pytest import shutil import subprocess +import sys import xmltodict -from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -17,6 +17,11 @@ from statick_tool.plugins.tool.cccc import CCCCToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_cccc_tool_plugin(use_plugin_context=True, binary=None, cccc_config=None): """Create an instance of the CCCC plugin.""" diff --git a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py b/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py index 21557165..2d71c255 100644 --- a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py +++ b/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py @@ -5,8 +5,8 @@ import pytest import shutil import subprocess +import sys from xml.etree import ElementTree -from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -16,6 +16,11 @@ from statick_tool.plugins.tool.clang_format import ClangFormatToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_clang_format_tool_plugin( use_plugin_context=True, binary=None, do_raise=False, issue_per_line=False diff --git a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py b/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py index 931311c5..839a5e02 100644 --- a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py +++ b/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py @@ -5,8 +5,6 @@ import pytest import subprocess import sys -from importlib.metadata import entry_points -from tempfile import TemporaryDirectory import statick_tool from statick_tool.config import Config @@ -15,6 +13,13 @@ from statick_tool.plugins.tool.clang_tidy import ClangTidyToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory + def setup_clang_tidy_tool_plugin(use_plugin_context=True, binary=None): """Initialize and return an instance of the clang-tidy plugin.""" diff --git a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py b/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py index a48f60b4..d4989fdf 100644 --- a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py +++ b/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +12,11 @@ from statick_tool.plugins.tool.cmakelint import CMakelintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_cmakelint_tool_plugin(): """Create an instance of the cmakelint plugin.""" diff --git a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py b/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py index 71de326c..5dfb9e02 100644 --- a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py +++ b/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.cppcheck import CppcheckToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_cppcheck_tool_plugin(use_plugin_context=True, binary=None): """Initialize and return an instance of the cppcheck plugin.""" diff --git a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py b/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py index c3e902a5..55081bfb 100644 --- a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py +++ b/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py @@ -5,8 +5,6 @@ import pytest import subprocess import sys -from importlib.metadata import entry_points -from tempfile import TemporaryDirectory import statick_tool from statick_tool.config import Config @@ -15,6 +13,13 @@ from statick_tool.plugins.tool.cpplint import CpplintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory + def setup_cpplint_tool_plugin(): """Initialize and return an instance of the cpplint plugin.""" diff --git a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py b/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py index 90b2d4d4..683780fb 100644 --- a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py +++ b/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py @@ -1,10 +1,16 @@ """Unit tests for the do nothing tool plugin.""" import os -from importlib.metadata import entry_points +import sys +import statick_tool from statick_tool.package import Package from statick_tool.plugins.tool.do_nothing import DoNothingToolPlugin +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_do_nothing_tool_plugin(): """Create and return an instance of the do nothing plugin.""" diff --git a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py index 6c3df6e2..fe3c67c5 100644 --- a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py +++ b/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.docformatter import DocformatterToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_docformatter_tool_plugin(): """Create and return an instance of the Docformatter plugin.""" diff --git a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py b/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py index c2fee829..f8453333 100644 --- a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py +++ b/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py @@ -5,7 +5,6 @@ import pytest import subprocess import sys -from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -14,6 +13,11 @@ from statick_tool.plugins.tool.flawfinder import FlawfinderToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_flawfinder_tool_plugin(): """Initialize and return an instance of the flawfinder plugin.""" diff --git a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py b/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py index 11dcbc52..b0ac0129 100644 --- a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py +++ b/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.groovylint import GroovyLintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_groovylint_tool_plugin(): """Initialize and return an instance of the groovylint plugin.""" diff --git a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py b/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py index 9ae564f6..316c2278 100644 --- a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py +++ b/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py @@ -2,8 +2,9 @@ import argparse import mock import os +import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +13,11 @@ from statick_tool.plugins.tool.isort import IsortToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_isort_tool_plugin(custom_rsc_path=None): """Create and return an instance of the Isort plugin.""" diff --git a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py b/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py index 9fb56f5a..f067af88 100644 --- a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py +++ b/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py @@ -2,7 +2,7 @@ import argparse import pytest import os -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -11,6 +11,11 @@ from statick_tool.plugins.tool.lizard import LizardToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_lizard_tool_plugin(custom_rsc_path=None): """Initialize and return an instance of the lizard plugin.""" diff --git a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py b/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py index 31998991..19a9a2e7 100644 --- a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py +++ b/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.make import MakeToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_make_tool_plugin(): """Construct and return an instance of the Make plugin.""" diff --git a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py b/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py index 3fb7c3e7..135a7fa4 100644 --- a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py +++ b/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.mypy import MypyToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_mypy_tool_plugin(): """Create and return an instance of the Mypy plugin.""" diff --git a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py b/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py index 54fe64e5..dec6249c 100644 --- a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py +++ b/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.perlcritic import PerlCriticToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_perlcritic_tool_plugin(binary=None): """Initialize and return a perlcritic plugin.""" diff --git a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py b/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py index e29c2e17..4fa98011 100644 --- a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py +++ b/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +12,11 @@ from statick_tool.plugins.tool.pycodestyle import PycodestyleToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_pycodestyle_tool_plugin(): """Create and return an instance of the PyCodeStyle plugin.""" diff --git a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py b/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py index 45aa5577..65c49d1a 100644 --- a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py +++ b/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +12,11 @@ from statick_tool.plugins.tool.pydocstyle import PydocstyleToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_pydocstyle_tool_plugin(): """Initialize and return a PyCodeStyle plugin.""" diff --git a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py b/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py index 9506b1a8..9845c31c 100644 --- a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py +++ b/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +12,11 @@ from statick_tool.plugins.tool.pyflakes import PyflakesToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_pyflakes_tool_plugin(): """Initialize and return a Pyflakes plugin.""" diff --git a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py b/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py index 0b67f27e..31c9654d 100644 --- a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py +++ b/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py @@ -4,7 +4,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.pylint import PylintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_pylint_tool_plugin(max_procs=1): """Construct and return an instance of the Pylint plugin.""" diff --git a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py b/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py index c52d1661..5b7034f3 100644 --- a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py +++ b/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py @@ -3,7 +3,7 @@ import mock import os import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -12,6 +12,11 @@ from statick_tool.plugins.tool.ruff import RuffToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_ruff_tool_plugin(): """Initialize and return a ruff plugin.""" diff --git a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py b/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py index a40715aa..3c156c4a 100644 --- a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py +++ b/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py @@ -5,7 +5,6 @@ import pytest import subprocess import sys -from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -14,6 +13,11 @@ from statick_tool.plugins.tool.shellcheck import ShellcheckToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_shellcheck_tool_plugin(binary=None): """Construct and return an instance of the Shellcheck plugin.""" diff --git a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py b/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py index 4ccf0f65..ba072315 100644 --- a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py +++ b/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py @@ -5,7 +5,6 @@ import pytest import subprocess import sys -from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -14,6 +13,11 @@ from statick_tool.plugins.tool.spotbugs import SpotbugsToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_spotbugs_tool_plugin(use_plugin_context=True, custom_rsc_path=None): """Initialize and return a spotbugs plugin.""" diff --git a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py index d4cbc419..79d03c80 100644 --- a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py +++ b/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py @@ -4,8 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points -from tempfile import TemporaryDirectory +import sys import statick_tool from statick_tool.config import Config @@ -14,6 +13,13 @@ from statick_tool.plugins.tool.uncrustify import UncrustifyToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + +from tempfile import TemporaryDirectory + def setup_uncrustify_tool_plugin(extra_path=None, use_plugin_context=True, binary=None): """Initialize and return an instance of the uncrustify plugin.""" diff --git a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py b/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py index a93d19f5..11b175fc 100644 --- a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py +++ b/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py @@ -4,7 +4,7 @@ import os import pytest import subprocess -from importlib.metadata import entry_points +import sys import statick_tool from statick_tool.config import Config @@ -13,6 +13,11 @@ from statick_tool.plugins.tool.xmllint import XmllintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_xmllint_tool_plugin(): """Create an instance of the xmllint plugin.""" diff --git a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py b/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py index 04b7ab57..f6a06f8a 100644 --- a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py +++ b/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py @@ -4,7 +4,6 @@ import os import subprocess import sys -from importlib.metadata import entry_points import statick_tool from statick_tool.config import Config @@ -13,6 +12,11 @@ from statick_tool.plugins.tool.yamllint import YamllintToolPlugin from statick_tool.resources import Resources +if sys.version_info < (3, 10): + from importlib_metadata import entry_points +else: + from importlib.metadata import entry_points + def setup_yamllint_tool_plugin(): """Construct and return an instance of the YAMLLint plugin.""" From d8f55f0f7e5e0ce964e156e03442ecfde1fb93e2 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:36:37 -0800 Subject: [PATCH 13/58] Run mypy on all Python versions. --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d1b4efa..3f37f8b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,6 @@ jobs: sudo apt-get install clang-format-14 sudo apt-get install clang-tidy-14 - # Have to install newer version from non-apt source due to SSL library compatibility issues. - name: Install node if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' run: | @@ -100,7 +99,6 @@ jobs: npm install -g npm-groovy-lint - name: Test with mypy - if: matrix.python-version == '3.11' run: | mypy --ignore-missing-imports --strict src/statick_tool/ From 5833b4909006d5bd992bdcce169f42f3e051cc13 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:39:10 -0800 Subject: [PATCH 14/58] Install importlib_metadata for older versions of Python. --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f37f8b8..bc822d50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,6 +98,11 @@ jobs: npm install -g markdownlint-cli@0.21.0 npm install -g npm-groovy-lint + - name: Install importlib_metadata + if matrix.python-version == '3.8' || matrix.python-version == '3.9' + run: | + pip install importlib_metadata + - name: Test with mypy run: | mypy --ignore-missing-imports --strict src/statick_tool/ From 10b62f7661273a5977000ad056d46d017c710eb4 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:39:56 -0800 Subject: [PATCH 15/58] Fix syntax. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bc822d50..cea98f04 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,7 +99,7 @@ jobs: npm install -g npm-groovy-lint - name: Install importlib_metadata - if matrix.python-version == '3.8' || matrix.python-version == '3.9' + if: matrix.python-version == '3.8' || matrix.python-version == '3.9' run: | pip install importlib_metadata From e739bfcef81cddee9a5547d5583e119057b30d04 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:43:31 -0800 Subject: [PATCH 16/58] Add importlib_metadata to package requirements. --- .github/workflows/test.yml | 5 ----- pyproject.toml | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cea98f04..3f37f8b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,11 +98,6 @@ jobs: npm install -g markdownlint-cli@0.21.0 npm install -g npm-groovy-lint - - name: Install importlib_metadata - if: matrix.python-version == '3.8' || matrix.python-version == '3.9' - run: | - pip install importlib_metadata - - name: Test with mypy run: | mypy --ignore-missing-imports --strict src/statick_tool/ diff --git a/pyproject.toml b/pyproject.toml index fb926ef5..76f514cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ dependencies = [ "deprecated", "docformatter", "flawfinder", + "importlib_metadata", "isort", "lizard", "mypy", From 8502c62897ce598ce959258e392d20a9e8f4d805 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 13:52:58 -0800 Subject: [PATCH 17/58] Add Python 3.12. --- pyproject.toml | 1 + tox.ini | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 76f514cd..1430238a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Testing", ] dependencies = [ diff --git a/tox.ini b/tox.ini index 2c1a2fa9..dfabbfee 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38, py39, py310, py311 +envlist = py38, py39, py310, py311, py312 skip_missing_interpreters = true [pytest] @@ -11,6 +11,7 @@ python = 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [testenv] changedir = {toxinidir}/output-{envname} From 7c4f872c5123b52aff09f482495e82be0b610178 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 14:14:53 -0800 Subject: [PATCH 18/58] Rename plugin unit test directories. --- .../{c_discovery_plugin => c}/exceptions.yaml | 0 .../invalid_package/test.cfg | 0 .../invalid_package/test.cxy | 0 .../invalid_package/test.ha | 0 .../test_c_discovery_plugin.py | 0 .../valid_package/ignore_this/ignoreme.c | 0 .../valid_package/oddextensionc.source | 0 .../valid_package/oddextensioncpp.source | 0 .../{c_discovery_plugin => c}/valid_package/test.c | 0 .../{c_discovery_plugin => c}/valid_package/test.cc | 0 .../valid_package/test.cpp | 0 .../valid_package/test.cxx | 0 .../{c_discovery_plugin => c}/valid_package/test.h | 0 .../valid_package/test.hpp | 0 .../valid_package/test.hxx | 0 .../cmake_ext_package/CMakeModules/FindCython.cmake | 0 .../test_cmake_discovery_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../exceptions.yaml | 0 .../invalid_package/test.aux | 0 .../invalid_package/test.cls | 0 .../invalid_package/test.sty | 0 .../test_groovy_discovery_plugin.py | 0 .../valid_package/Jenkinsfile | 0 .../valid_package/ignore_this/ignoreme.groovy | 0 .../valid_package/test.gradle | 0 .../valid_package/test.groovy | 0 .../{java_discovery_plugin => java}/exceptions.yaml | 0 .../invalid_package/test.javac | 0 .../test_java_discovery_plugin.py | 0 .../valid_package/ignore_this/IgnoreMe.class | Bin .../valid_package/ignore_this/ignoreme.java | 0 .../valid_package/test.class | 0 .../valid_package/test.java | 0 .../multi_package/a/c/pom.xml | 0 .../multi_package/a/pom.xml | 0 .../multi_package/b/pom.xml | 0 .../single_package/pom.xml | 0 .../test_maven_discovery_plugin.py | 0 .../two_package/a/pom.xml | 0 .../two_package/b/pom.xml | 0 .../valid_exceptions.yaml | 0 .../{perl_discovery_plugin => perl}/exceptions.yaml | 0 .../test_perl_discovery_plugin.py | 0 .../valid_package/ignore_this/ignoreme.pl | 0 .../valid_package/oddextensionpl.source | 0 .../valid_package/test.pl | 0 .../exceptions.yaml | 0 .../invalid_package/test.cfg | 0 .../test_python_discovery_plugin.py | 0 .../valid_package/ignore_this/ignoreme.py | 0 .../valid_package/oddextensionpy.source | 0 .../valid_package/test.py | 0 .../invalid_package_nocmakelists/package.xml | 0 .../invalid_package_nopackagexml/CMakeLists.txt | 0 .../ros2_python_package/package.xml | 0 .../test_ros_discovery_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/package.xml | 0 .../exceptions.yaml | 0 .../test_shell_discovery_plugin.py | 0 .../valid_package/ignore_this/ignoreme.bash | 0 .../valid_package/oddextensionbash.source | 0 .../valid_package/oddextensioncsh.source | 0 .../valid_package/oddextensiondash.source | 0 .../valid_package/oddextensionksh.source | 0 .../valid_package/oddextensionsh.source | 0 .../valid_package/oddextensionzsh.source | 0 .../valid_package/test.sh | 0 .../{xml_discovery_plugin => xml}/exceptions.yaml | 0 .../invalid_package/test.xmla | 0 .../test_xml_discovery_plugin.py | 0 .../valid_package/ignore_this/ignoreme.xml | 0 .../valid_package/test.launch | 0 .../valid_package/test.xml | 0 .../{yaml_discovery_plugin => yaml}/exceptions.yaml | 0 .../invalid_package/test.yamllint | 0 .../test_yaml_discovery_plugin.py | 0 .../valid_package/ignore_this/ignoreme.yaml | 0 .../valid_package/test.yaml | 0 .../valid_package/test.yml | 0 .../config/rsc/config-gitlab.yaml | 0 .../config/rsc/config.yaml | 0 .../test_code_climate_reporting_plugin.py | 0 .../test_do_nothing_reporting_plugin.py | 0 .../config/rsc/config.yaml | 0 .../test_json_reporting_plugin.py | 0 .../test_print_to_console_reporting_plugin.py | 0 ...st_write_jenkins_warnings_ng_reporting_plugin.py | 0 .../test_bandit_tool_plugin.py | 0 .../valid_package/b404.py | 0 .../test_black_tool_plugin.py | 0 .../valid_package/format_errors.py | 0 .../c0x_package/CMakeLists.txt | 0 .../c0x_package/package.xml | 0 .../c11_package/CMakeLists.txt | 0 .../c11_package/package.xml | 0 .../cmake_flags/CMakeLists.txt | 0 .../gnu99_package/CMakeLists.txt | 0 .../gnu99_package/package.xml | 0 .../test_catkin-lint_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/package.xml | 0 .../tool/{cccc_tool_plugin => cccc}/cccc.opt | 0 .../test_cccc_tool_plugin.py | 0 .../valid_package/cccc-missing-names.xml | 0 .../valid_package/cccc.xml | 0 .../valid_package/example.cpp | 0 .../different-clang-format.cfg | 0 .../test_clang-format_tool_plugin.py | 0 .../valid_package/indents.c | 0 .../valid_package/indents.h | 0 .../test_clang-tidy_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/test.c | 0 .../cmake_ext_package/CMakeLists.txt | 0 .../cmake_ext_package/CMakeModules/FindCython.cmake | 0 .../test_cmakelint_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../test_cppcheck_tool_plugin.py | 0 .../valid_package/test.c | 0 .../test_cpplint_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/test.c | 0 .../test_do_nothing_tool_plugin.py | 0 .../valid_package/basic.py | 0 .../test_docformatter_tool_plugin.py | 0 .../valid_package/wrong.py | 0 .../test_flawfinder_tool_plugin.py | 0 .../valid_package/strlen.c | 0 .../test_groovylint_tool_plugin.py | 0 .../valid_package/Jenkinsfile | 0 .../valid_package/rsc/.groovylintrc.json | 0 .../valid_package/rsc/config.yaml | 0 .../valid_package/test.gradle | 0 .../valid_package/test.groovy | 0 .../valid_package/test_errors.groovy | 0 .../{isort_tool_plugin => isort}/rsc/config.yaml | 0 .../test_isort_tool_plugin.py | 0 .../valid_package/sample.py | 0 .../valid_package/whitespace.py | 0 .../{lizard_tool_plugin => lizard}/rsc/config.yaml | 0 .../{lizard_tool_plugin => lizard}/rsc/profile.yaml | 0 .../test_lizard_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/test.c | 0 .../test_make_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/hello.cpp | 0 .../test_mypy_tool_plugin.py | 0 .../valid_package/wrong_mypy.py | 0 .../test_perlcritic_tool_plugin.py | 0 .../valid_package/test.pl | 0 .../test_pycodestyle_tool_plugin.py | 0 .../valid_package/e501.py | 0 .../test_pydocstyle_tool_plugin.py | 0 .../valid_package/d103.py | 0 .../test_pyflakes_tool_plugin.py | 0 .../valid_package/pyflakes_test.py | 0 .../test_pylint_tool_plugin.py | 0 .../valid_package/basic.py | 0 .../test_ruff_tool_plugin.py | 0 .../valid_package/ruff_test.py | 0 .../test_shellcheck_tool_plugin.py | 0 .../valid_package/basic.sh | 0 .../rsc/config.yaml | 0 .../rsc/profile.yaml | 0 .../rsc/spotbugs-exclude.xml | 0 .../test_spotbugs_tool_plugin.py | 0 .../valid_package/.gitignore | 0 .../valid_package/pom.xml | 0 .../valid_package/src/main/java/Test.java | 0 .../test_uncrustify_tool_plugin.py | 0 .../valid_package/CMakeLists.txt | 0 .../valid_package/rsc/uncrustify.cfg | 0 .../valid_package/test.c | 0 .../test_xmllint_tool_plugin.py | 0 .../valid_package/premature_end.xml | 0 .../test_yamllint_tool_plugin.py | 0 .../valid_package/document-start.yaml | 0 180 files changed, 0 insertions(+), 0 deletions(-) rename tests/plugins/discovery/{c_discovery_plugin => c}/exceptions.yaml (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/invalid_package/test.cfg (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/invalid_package/test.cxy (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/invalid_package/test.ha (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/test_c_discovery_plugin.py (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/ignore_this/ignoreme.c (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/oddextensionc.source (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/oddextensioncpp.source (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.c (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.cc (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.cpp (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.cxx (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.h (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.hpp (100%) rename tests/plugins/discovery/{c_discovery_plugin => c}/valid_package/test.hxx (100%) rename tests/plugins/discovery/{cmake_discovery_plugin => cmake}/cmake_ext_package/CMakeModules/FindCython.cmake (100%) rename tests/plugins/discovery/{cmake_discovery_plugin => cmake}/test_cmake_discovery_plugin.py (100%) rename tests/plugins/discovery/{cmake_discovery_plugin => cmake}/valid_package/CMakeLists.txt (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/exceptions.yaml (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/invalid_package/test.aux (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/invalid_package/test.cls (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/invalid_package/test.sty (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/test_groovy_discovery_plugin.py (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/valid_package/Jenkinsfile (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/valid_package/ignore_this/ignoreme.groovy (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/valid_package/test.gradle (100%) rename tests/plugins/discovery/{groovy_discovery_plugin => groovy}/valid_package/test.groovy (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/exceptions.yaml (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/invalid_package/test.javac (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/test_java_discovery_plugin.py (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/valid_package/ignore_this/IgnoreMe.class (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/valid_package/ignore_this/ignoreme.java (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/valid_package/test.class (100%) rename tests/plugins/discovery/{java_discovery_plugin => java}/valid_package/test.java (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/multi_package/a/c/pom.xml (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/multi_package/a/pom.xml (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/multi_package/b/pom.xml (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/single_package/pom.xml (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/test_maven_discovery_plugin.py (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/two_package/a/pom.xml (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/two_package/b/pom.xml (100%) rename tests/plugins/discovery/{maven_discovery_plugin => maven}/valid_exceptions.yaml (100%) rename tests/plugins/discovery/{perl_discovery_plugin => perl}/exceptions.yaml (100%) rename tests/plugins/discovery/{perl_discovery_plugin => perl}/test_perl_discovery_plugin.py (100%) rename tests/plugins/discovery/{perl_discovery_plugin => perl}/valid_package/ignore_this/ignoreme.pl (100%) rename tests/plugins/discovery/{perl_discovery_plugin => perl}/valid_package/oddextensionpl.source (100%) rename tests/plugins/discovery/{perl_discovery_plugin => perl}/valid_package/test.pl (100%) rename tests/plugins/discovery/{python_discovery_plugin => python}/exceptions.yaml (100%) rename tests/plugins/discovery/{python_discovery_plugin => python}/invalid_package/test.cfg (100%) rename tests/plugins/discovery/{python_discovery_plugin => python}/test_python_discovery_plugin.py (100%) rename tests/plugins/discovery/{python_discovery_plugin => python}/valid_package/ignore_this/ignoreme.py (100%) rename tests/plugins/discovery/{python_discovery_plugin => python}/valid_package/oddextensionpy.source (100%) rename tests/plugins/discovery/{python_discovery_plugin => python}/valid_package/test.py (100%) rename tests/plugins/discovery/{ros_discovery_plugin => ros}/invalid_package_nocmakelists/package.xml (100%) rename tests/plugins/discovery/{ros_discovery_plugin => ros}/invalid_package_nopackagexml/CMakeLists.txt (100%) rename tests/plugins/discovery/{ros_discovery_plugin => ros}/ros2_python_package/package.xml (100%) rename tests/plugins/discovery/{ros_discovery_plugin => ros}/test_ros_discovery_plugin.py (100%) rename tests/plugins/discovery/{ros_discovery_plugin => ros}/valid_package/CMakeLists.txt (100%) rename tests/plugins/discovery/{ros_discovery_plugin => ros}/valid_package/package.xml (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/exceptions.yaml (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/test_shell_discovery_plugin.py (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/ignore_this/ignoreme.bash (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/oddextensionbash.source (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/oddextensioncsh.source (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/oddextensiondash.source (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/oddextensionksh.source (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/oddextensionsh.source (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/oddextensionzsh.source (100%) rename tests/plugins/discovery/{shell_discovery_plugin => shell}/valid_package/test.sh (100%) rename tests/plugins/discovery/{xml_discovery_plugin => xml}/exceptions.yaml (100%) rename tests/plugins/discovery/{xml_discovery_plugin => xml}/invalid_package/test.xmla (100%) rename tests/plugins/discovery/{xml_discovery_plugin => xml}/test_xml_discovery_plugin.py (100%) rename tests/plugins/discovery/{xml_discovery_plugin => xml}/valid_package/ignore_this/ignoreme.xml (100%) rename tests/plugins/discovery/{xml_discovery_plugin => xml}/valid_package/test.launch (100%) rename tests/plugins/discovery/{xml_discovery_plugin => xml}/valid_package/test.xml (100%) rename tests/plugins/discovery/{yaml_discovery_plugin => yaml}/exceptions.yaml (100%) rename tests/plugins/discovery/{yaml_discovery_plugin => yaml}/invalid_package/test.yamllint (100%) rename tests/plugins/discovery/{yaml_discovery_plugin => yaml}/test_yaml_discovery_plugin.py (100%) rename tests/plugins/discovery/{yaml_discovery_plugin => yaml}/valid_package/ignore_this/ignoreme.yaml (100%) rename tests/plugins/discovery/{yaml_discovery_plugin => yaml}/valid_package/test.yaml (100%) rename tests/plugins/discovery/{yaml_discovery_plugin => yaml}/valid_package/test.yml (100%) rename tests/plugins/reporting/{code_climate_reporting_plugin => code_climate}/config/rsc/config-gitlab.yaml (100%) rename tests/plugins/reporting/{code_climate_reporting_plugin => code_climate}/config/rsc/config.yaml (100%) rename tests/plugins/reporting/{code_climate_reporting_plugin => code_climate}/test_code_climate_reporting_plugin.py (100%) rename tests/plugins/reporting/{do_nothing_reporting_plugin => do_nothing}/test_do_nothing_reporting_plugin.py (100%) rename tests/plugins/reporting/{json_reporting_plugin => json}/config/rsc/config.yaml (100%) rename tests/plugins/reporting/{json_reporting_plugin => json}/test_json_reporting_plugin.py (100%) rename tests/plugins/reporting/{print_to_console_reporting_plugin => print_to_console}/test_print_to_console_reporting_plugin.py (100%) rename tests/plugins/reporting/{write_jenkins_warnings_ng_reporting_plugin => write_jenkins_warnings_ng}/test_write_jenkins_warnings_ng_reporting_plugin.py (100%) rename tests/plugins/tool/{bandit_tool_plugin => bandit}/test_bandit_tool_plugin.py (100%) rename tests/plugins/tool/{bandit_tool_plugin => bandit}/valid_package/b404.py (100%) rename tests/plugins/tool/{black_tool_plugin => black}/test_black_tool_plugin.py (100%) rename tests/plugins/tool/{black_tool_plugin => black}/valid_package/format_errors.py (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/c0x_package/CMakeLists.txt (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/c0x_package/package.xml (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/c11_package/CMakeLists.txt (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/c11_package/package.xml (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/cmake_flags/CMakeLists.txt (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/gnu99_package/CMakeLists.txt (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/gnu99_package/package.xml (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/test_catkin-lint_tool_plugin.py (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{catkin-lint_tool_plugin => catkin-lint}/valid_package/package.xml (100%) rename tests/plugins/tool/{cccc_tool_plugin => cccc}/cccc.opt (100%) rename tests/plugins/tool/{cccc_tool_plugin => cccc}/test_cccc_tool_plugin.py (100%) rename tests/plugins/tool/{cccc_tool_plugin => cccc}/valid_package/cccc-missing-names.xml (100%) rename tests/plugins/tool/{cccc_tool_plugin => cccc}/valid_package/cccc.xml (100%) rename tests/plugins/tool/{cccc_tool_plugin => cccc}/valid_package/example.cpp (100%) rename tests/plugins/tool/{clang-format_tool_plugin => clang-format}/different-clang-format.cfg (100%) rename tests/plugins/tool/{clang-format_tool_plugin => clang-format}/test_clang-format_tool_plugin.py (100%) rename tests/plugins/tool/{clang-format_tool_plugin => clang-format}/valid_package/indents.c (100%) rename tests/plugins/tool/{clang-format_tool_plugin => clang-format}/valid_package/indents.h (100%) rename tests/plugins/tool/{clang-tidy_tool_plugin => clang-tidy}/test_clang-tidy_tool_plugin.py (100%) rename tests/plugins/tool/{clang-tidy_tool_plugin => clang-tidy}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{clang-tidy_tool_plugin => clang-tidy}/valid_package/test.c (100%) rename tests/plugins/tool/{cmakelint_tool_plugin => cmakelint}/cmake_ext_package/CMakeLists.txt (100%) rename tests/plugins/tool/{cmakelint_tool_plugin => cmakelint}/cmake_ext_package/CMakeModules/FindCython.cmake (100%) rename tests/plugins/tool/{cmakelint_tool_plugin => cmakelint}/test_cmakelint_tool_plugin.py (100%) rename tests/plugins/tool/{cmakelint_tool_plugin => cmakelint}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{cppcheck_tool_plugin => cppcheck}/test_cppcheck_tool_plugin.py (100%) rename tests/plugins/tool/{cppcheck_tool_plugin => cppcheck}/valid_package/test.c (100%) rename tests/plugins/tool/{cpplint_tool_plugin => cpplint}/test_cpplint_tool_plugin.py (100%) rename tests/plugins/tool/{cpplint_tool_plugin => cpplint}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{cpplint_tool_plugin => cpplint}/valid_package/test.c (100%) rename tests/plugins/tool/{do_nothing_tool_plugin => do_nothing}/test_do_nothing_tool_plugin.py (100%) rename tests/plugins/tool/{do_nothing_tool_plugin => do_nothing}/valid_package/basic.py (100%) rename tests/plugins/tool/{docformatter_tool_plugin => docformatter}/test_docformatter_tool_plugin.py (100%) rename tests/plugins/tool/{docformatter_tool_plugin => docformatter}/valid_package/wrong.py (100%) rename tests/plugins/tool/{flawfinder_tool_plugin => flawfinder}/test_flawfinder_tool_plugin.py (100%) rename tests/plugins/tool/{flawfinder_tool_plugin => flawfinder}/valid_package/strlen.c (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/test_groovylint_tool_plugin.py (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/valid_package/Jenkinsfile (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/valid_package/rsc/.groovylintrc.json (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/valid_package/rsc/config.yaml (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/valid_package/test.gradle (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/valid_package/test.groovy (100%) rename tests/plugins/tool/{groovylint_tool_plugin => groovylint}/valid_package/test_errors.groovy (100%) rename tests/plugins/tool/{isort_tool_plugin => isort}/rsc/config.yaml (100%) rename tests/plugins/tool/{isort_tool_plugin => isort}/test_isort_tool_plugin.py (100%) rename tests/plugins/tool/{isort_tool_plugin => isort}/valid_package/sample.py (100%) rename tests/plugins/tool/{isort_tool_plugin => isort}/valid_package/whitespace.py (100%) rename tests/plugins/tool/{lizard_tool_plugin => lizard}/rsc/config.yaml (100%) rename tests/plugins/tool/{lizard_tool_plugin => lizard}/rsc/profile.yaml (100%) rename tests/plugins/tool/{lizard_tool_plugin => lizard}/test_lizard_tool_plugin.py (100%) rename tests/plugins/tool/{lizard_tool_plugin => lizard}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{lizard_tool_plugin => lizard}/valid_package/test.c (100%) rename tests/plugins/tool/{make_tool_plugin => make}/test_make_tool_plugin.py (100%) rename tests/plugins/tool/{make_tool_plugin => make}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{make_tool_plugin => make}/valid_package/hello.cpp (100%) rename tests/plugins/tool/{mypy_tool_plugin => mypy}/test_mypy_tool_plugin.py (100%) rename tests/plugins/tool/{mypy_tool_plugin => mypy}/valid_package/wrong_mypy.py (100%) rename tests/plugins/tool/{perlcritic_tool_plugin => perlcritic}/test_perlcritic_tool_plugin.py (100%) rename tests/plugins/tool/{perlcritic_tool_plugin => perlcritic}/valid_package/test.pl (100%) rename tests/plugins/tool/{pycodestyle_tool_plugin => pycodestyle}/test_pycodestyle_tool_plugin.py (100%) rename tests/plugins/tool/{pycodestyle_tool_plugin => pycodestyle}/valid_package/e501.py (100%) rename tests/plugins/tool/{pydocstyle_tool_plugin => pydocstyle}/test_pydocstyle_tool_plugin.py (100%) rename tests/plugins/tool/{pydocstyle_tool_plugin => pydocstyle}/valid_package/d103.py (100%) rename tests/plugins/tool/{pyflakes_tool_plugin => pyflakes}/test_pyflakes_tool_plugin.py (100%) rename tests/plugins/tool/{pyflakes_tool_plugin => pyflakes}/valid_package/pyflakes_test.py (100%) rename tests/plugins/tool/{pylint_tool_plugin => pylint}/test_pylint_tool_plugin.py (100%) rename tests/plugins/tool/{pylint_tool_plugin => pylint}/valid_package/basic.py (100%) rename tests/plugins/tool/{ruff_tool_plugin => ruff}/test_ruff_tool_plugin.py (100%) rename tests/plugins/tool/{ruff_tool_plugin => ruff}/valid_package/ruff_test.py (100%) rename tests/plugins/tool/{shellcheck_tool_plugin => shellcheck}/test_shellcheck_tool_plugin.py (100%) rename tests/plugins/tool/{shellcheck_tool_plugin => shellcheck}/valid_package/basic.sh (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/rsc/config.yaml (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/rsc/profile.yaml (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/rsc/spotbugs-exclude.xml (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/test_spotbugs_tool_plugin.py (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/valid_package/.gitignore (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/valid_package/pom.xml (100%) rename tests/plugins/tool/{spotbugs_tool_plugin => spotbugs}/valid_package/src/main/java/Test.java (100%) rename tests/plugins/tool/{uncrustify_tool_plugin => uncrustify}/test_uncrustify_tool_plugin.py (100%) rename tests/plugins/tool/{uncrustify_tool_plugin => uncrustify}/valid_package/CMakeLists.txt (100%) rename tests/plugins/tool/{uncrustify_tool_plugin => uncrustify}/valid_package/rsc/uncrustify.cfg (100%) rename tests/plugins/tool/{uncrustify_tool_plugin => uncrustify}/valid_package/test.c (100%) rename tests/plugins/tool/{xmllint_tool_plugin => xmllint}/test_xmllint_tool_plugin.py (100%) rename tests/plugins/tool/{xmllint_tool_plugin => xmllint}/valid_package/premature_end.xml (100%) rename tests/plugins/tool/{yamllint_tool_plugin => yamllint}/test_yamllint_tool_plugin.py (100%) rename tests/plugins/tool/{yamllint_tool_plugin => yamllint}/valid_package/document-start.yaml (100%) diff --git a/tests/plugins/discovery/c_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/c/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/c/exceptions.yaml diff --git a/tests/plugins/discovery/c_discovery_plugin/invalid_package/test.cfg b/tests/plugins/discovery/c/invalid_package/test.cfg similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/invalid_package/test.cfg rename to tests/plugins/discovery/c/invalid_package/test.cfg diff --git a/tests/plugins/discovery/c_discovery_plugin/invalid_package/test.cxy b/tests/plugins/discovery/c/invalid_package/test.cxy similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/invalid_package/test.cxy rename to tests/plugins/discovery/c/invalid_package/test.cxy diff --git a/tests/plugins/discovery/c_discovery_plugin/invalid_package/test.ha b/tests/plugins/discovery/c/invalid_package/test.ha similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/invalid_package/test.ha rename to tests/plugins/discovery/c/invalid_package/test.ha diff --git a/tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py b/tests/plugins/discovery/c/test_c_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/test_c_discovery_plugin.py rename to tests/plugins/discovery/c/test_c_discovery_plugin.py diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/ignore_this/ignoreme.c b/tests/plugins/discovery/c/valid_package/ignore_this/ignoreme.c similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/ignore_this/ignoreme.c rename to tests/plugins/discovery/c/valid_package/ignore_this/ignoreme.c diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/oddextensionc.source b/tests/plugins/discovery/c/valid_package/oddextensionc.source similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/oddextensionc.source rename to tests/plugins/discovery/c/valid_package/oddextensionc.source diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/oddextensioncpp.source b/tests/plugins/discovery/c/valid_package/oddextensioncpp.source similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/oddextensioncpp.source rename to tests/plugins/discovery/c/valid_package/oddextensioncpp.source diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.c b/tests/plugins/discovery/c/valid_package/test.c similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.c rename to tests/plugins/discovery/c/valid_package/test.c diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.cc b/tests/plugins/discovery/c/valid_package/test.cc similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.cc rename to tests/plugins/discovery/c/valid_package/test.cc diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.cpp b/tests/plugins/discovery/c/valid_package/test.cpp similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.cpp rename to tests/plugins/discovery/c/valid_package/test.cpp diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.cxx b/tests/plugins/discovery/c/valid_package/test.cxx similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.cxx rename to tests/plugins/discovery/c/valid_package/test.cxx diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.h b/tests/plugins/discovery/c/valid_package/test.h similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.h rename to tests/plugins/discovery/c/valid_package/test.h diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.hpp b/tests/plugins/discovery/c/valid_package/test.hpp similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.hpp rename to tests/plugins/discovery/c/valid_package/test.hpp diff --git a/tests/plugins/discovery/c_discovery_plugin/valid_package/test.hxx b/tests/plugins/discovery/c/valid_package/test.hxx similarity index 100% rename from tests/plugins/discovery/c_discovery_plugin/valid_package/test.hxx rename to tests/plugins/discovery/c/valid_package/test.hxx diff --git a/tests/plugins/discovery/cmake_discovery_plugin/cmake_ext_package/CMakeModules/FindCython.cmake b/tests/plugins/discovery/cmake/cmake_ext_package/CMakeModules/FindCython.cmake similarity index 100% rename from tests/plugins/discovery/cmake_discovery_plugin/cmake_ext_package/CMakeModules/FindCython.cmake rename to tests/plugins/discovery/cmake/cmake_ext_package/CMakeModules/FindCython.cmake diff --git a/tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py b/tests/plugins/discovery/cmake/test_cmake_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/cmake_discovery_plugin/test_cmake_discovery_plugin.py rename to tests/plugins/discovery/cmake/test_cmake_discovery_plugin.py diff --git a/tests/plugins/discovery/cmake_discovery_plugin/valid_package/CMakeLists.txt b/tests/plugins/discovery/cmake/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/discovery/cmake_discovery_plugin/valid_package/CMakeLists.txt rename to tests/plugins/discovery/cmake/valid_package/CMakeLists.txt diff --git a/tests/plugins/discovery/groovy_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/groovy/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/groovy/exceptions.yaml diff --git a/tests/plugins/discovery/groovy_discovery_plugin/invalid_package/test.aux b/tests/plugins/discovery/groovy/invalid_package/test.aux similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/invalid_package/test.aux rename to tests/plugins/discovery/groovy/invalid_package/test.aux diff --git a/tests/plugins/discovery/groovy_discovery_plugin/invalid_package/test.cls b/tests/plugins/discovery/groovy/invalid_package/test.cls similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/invalid_package/test.cls rename to tests/plugins/discovery/groovy/invalid_package/test.cls diff --git a/tests/plugins/discovery/groovy_discovery_plugin/invalid_package/test.sty b/tests/plugins/discovery/groovy/invalid_package/test.sty similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/invalid_package/test.sty rename to tests/plugins/discovery/groovy/invalid_package/test.sty diff --git a/tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py b/tests/plugins/discovery/groovy/test_groovy_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/test_groovy_discovery_plugin.py rename to tests/plugins/discovery/groovy/test_groovy_discovery_plugin.py diff --git a/tests/plugins/discovery/groovy_discovery_plugin/valid_package/Jenkinsfile b/tests/plugins/discovery/groovy/valid_package/Jenkinsfile similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/valid_package/Jenkinsfile rename to tests/plugins/discovery/groovy/valid_package/Jenkinsfile diff --git a/tests/plugins/discovery/groovy_discovery_plugin/valid_package/ignore_this/ignoreme.groovy b/tests/plugins/discovery/groovy/valid_package/ignore_this/ignoreme.groovy similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/valid_package/ignore_this/ignoreme.groovy rename to tests/plugins/discovery/groovy/valid_package/ignore_this/ignoreme.groovy diff --git a/tests/plugins/discovery/groovy_discovery_plugin/valid_package/test.gradle b/tests/plugins/discovery/groovy/valid_package/test.gradle similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/valid_package/test.gradle rename to tests/plugins/discovery/groovy/valid_package/test.gradle diff --git a/tests/plugins/discovery/groovy_discovery_plugin/valid_package/test.groovy b/tests/plugins/discovery/groovy/valid_package/test.groovy similarity index 100% rename from tests/plugins/discovery/groovy_discovery_plugin/valid_package/test.groovy rename to tests/plugins/discovery/groovy/valid_package/test.groovy diff --git a/tests/plugins/discovery/java_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/java/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/java/exceptions.yaml diff --git a/tests/plugins/discovery/java_discovery_plugin/invalid_package/test.javac b/tests/plugins/discovery/java/invalid_package/test.javac similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/invalid_package/test.javac rename to tests/plugins/discovery/java/invalid_package/test.javac diff --git a/tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py b/tests/plugins/discovery/java/test_java_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/test_java_discovery_plugin.py rename to tests/plugins/discovery/java/test_java_discovery_plugin.py diff --git a/tests/plugins/discovery/java_discovery_plugin/valid_package/ignore_this/IgnoreMe.class b/tests/plugins/discovery/java/valid_package/ignore_this/IgnoreMe.class similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/valid_package/ignore_this/IgnoreMe.class rename to tests/plugins/discovery/java/valid_package/ignore_this/IgnoreMe.class diff --git a/tests/plugins/discovery/java_discovery_plugin/valid_package/ignore_this/ignoreme.java b/tests/plugins/discovery/java/valid_package/ignore_this/ignoreme.java similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/valid_package/ignore_this/ignoreme.java rename to tests/plugins/discovery/java/valid_package/ignore_this/ignoreme.java diff --git a/tests/plugins/discovery/java_discovery_plugin/valid_package/test.class b/tests/plugins/discovery/java/valid_package/test.class similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/valid_package/test.class rename to tests/plugins/discovery/java/valid_package/test.class diff --git a/tests/plugins/discovery/java_discovery_plugin/valid_package/test.java b/tests/plugins/discovery/java/valid_package/test.java similarity index 100% rename from tests/plugins/discovery/java_discovery_plugin/valid_package/test.java rename to tests/plugins/discovery/java/valid_package/test.java diff --git a/tests/plugins/discovery/maven_discovery_plugin/multi_package/a/c/pom.xml b/tests/plugins/discovery/maven/multi_package/a/c/pom.xml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/multi_package/a/c/pom.xml rename to tests/plugins/discovery/maven/multi_package/a/c/pom.xml diff --git a/tests/plugins/discovery/maven_discovery_plugin/multi_package/a/pom.xml b/tests/plugins/discovery/maven/multi_package/a/pom.xml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/multi_package/a/pom.xml rename to tests/plugins/discovery/maven/multi_package/a/pom.xml diff --git a/tests/plugins/discovery/maven_discovery_plugin/multi_package/b/pom.xml b/tests/plugins/discovery/maven/multi_package/b/pom.xml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/multi_package/b/pom.xml rename to tests/plugins/discovery/maven/multi_package/b/pom.xml diff --git a/tests/plugins/discovery/maven_discovery_plugin/single_package/pom.xml b/tests/plugins/discovery/maven/single_package/pom.xml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/single_package/pom.xml rename to tests/plugins/discovery/maven/single_package/pom.xml diff --git a/tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py b/tests/plugins/discovery/maven/test_maven_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/test_maven_discovery_plugin.py rename to tests/plugins/discovery/maven/test_maven_discovery_plugin.py diff --git a/tests/plugins/discovery/maven_discovery_plugin/two_package/a/pom.xml b/tests/plugins/discovery/maven/two_package/a/pom.xml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/two_package/a/pom.xml rename to tests/plugins/discovery/maven/two_package/a/pom.xml diff --git a/tests/plugins/discovery/maven_discovery_plugin/two_package/b/pom.xml b/tests/plugins/discovery/maven/two_package/b/pom.xml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/two_package/b/pom.xml rename to tests/plugins/discovery/maven/two_package/b/pom.xml diff --git a/tests/plugins/discovery/maven_discovery_plugin/valid_exceptions.yaml b/tests/plugins/discovery/maven/valid_exceptions.yaml similarity index 100% rename from tests/plugins/discovery/maven_discovery_plugin/valid_exceptions.yaml rename to tests/plugins/discovery/maven/valid_exceptions.yaml diff --git a/tests/plugins/discovery/perl_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/perl/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/perl_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/perl/exceptions.yaml diff --git a/tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py b/tests/plugins/discovery/perl/test_perl_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/perl_discovery_plugin/test_perl_discovery_plugin.py rename to tests/plugins/discovery/perl/test_perl_discovery_plugin.py diff --git a/tests/plugins/discovery/perl_discovery_plugin/valid_package/ignore_this/ignoreme.pl b/tests/plugins/discovery/perl/valid_package/ignore_this/ignoreme.pl similarity index 100% rename from tests/plugins/discovery/perl_discovery_plugin/valid_package/ignore_this/ignoreme.pl rename to tests/plugins/discovery/perl/valid_package/ignore_this/ignoreme.pl diff --git a/tests/plugins/discovery/perl_discovery_plugin/valid_package/oddextensionpl.source b/tests/plugins/discovery/perl/valid_package/oddextensionpl.source similarity index 100% rename from tests/plugins/discovery/perl_discovery_plugin/valid_package/oddextensionpl.source rename to tests/plugins/discovery/perl/valid_package/oddextensionpl.source diff --git a/tests/plugins/discovery/perl_discovery_plugin/valid_package/test.pl b/tests/plugins/discovery/perl/valid_package/test.pl similarity index 100% rename from tests/plugins/discovery/perl_discovery_plugin/valid_package/test.pl rename to tests/plugins/discovery/perl/valid_package/test.pl diff --git a/tests/plugins/discovery/python_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/python/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/python_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/python/exceptions.yaml diff --git a/tests/plugins/discovery/python_discovery_plugin/invalid_package/test.cfg b/tests/plugins/discovery/python/invalid_package/test.cfg similarity index 100% rename from tests/plugins/discovery/python_discovery_plugin/invalid_package/test.cfg rename to tests/plugins/discovery/python/invalid_package/test.cfg diff --git a/tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py b/tests/plugins/discovery/python/test_python_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/python_discovery_plugin/test_python_discovery_plugin.py rename to tests/plugins/discovery/python/test_python_discovery_plugin.py diff --git a/tests/plugins/discovery/python_discovery_plugin/valid_package/ignore_this/ignoreme.py b/tests/plugins/discovery/python/valid_package/ignore_this/ignoreme.py similarity index 100% rename from tests/plugins/discovery/python_discovery_plugin/valid_package/ignore_this/ignoreme.py rename to tests/plugins/discovery/python/valid_package/ignore_this/ignoreme.py diff --git a/tests/plugins/discovery/python_discovery_plugin/valid_package/oddextensionpy.source b/tests/plugins/discovery/python/valid_package/oddextensionpy.source similarity index 100% rename from tests/plugins/discovery/python_discovery_plugin/valid_package/oddextensionpy.source rename to tests/plugins/discovery/python/valid_package/oddextensionpy.source diff --git a/tests/plugins/discovery/python_discovery_plugin/valid_package/test.py b/tests/plugins/discovery/python/valid_package/test.py similarity index 100% rename from tests/plugins/discovery/python_discovery_plugin/valid_package/test.py rename to tests/plugins/discovery/python/valid_package/test.py diff --git a/tests/plugins/discovery/ros_discovery_plugin/invalid_package_nocmakelists/package.xml b/tests/plugins/discovery/ros/invalid_package_nocmakelists/package.xml similarity index 100% rename from tests/plugins/discovery/ros_discovery_plugin/invalid_package_nocmakelists/package.xml rename to tests/plugins/discovery/ros/invalid_package_nocmakelists/package.xml diff --git a/tests/plugins/discovery/ros_discovery_plugin/invalid_package_nopackagexml/CMakeLists.txt b/tests/plugins/discovery/ros/invalid_package_nopackagexml/CMakeLists.txt similarity index 100% rename from tests/plugins/discovery/ros_discovery_plugin/invalid_package_nopackagexml/CMakeLists.txt rename to tests/plugins/discovery/ros/invalid_package_nopackagexml/CMakeLists.txt diff --git a/tests/plugins/discovery/ros_discovery_plugin/ros2_python_package/package.xml b/tests/plugins/discovery/ros/ros2_python_package/package.xml similarity index 100% rename from tests/plugins/discovery/ros_discovery_plugin/ros2_python_package/package.xml rename to tests/plugins/discovery/ros/ros2_python_package/package.xml diff --git a/tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py b/tests/plugins/discovery/ros/test_ros_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/ros_discovery_plugin/test_ros_discovery_plugin.py rename to tests/plugins/discovery/ros/test_ros_discovery_plugin.py diff --git a/tests/plugins/discovery/ros_discovery_plugin/valid_package/CMakeLists.txt b/tests/plugins/discovery/ros/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/discovery/ros_discovery_plugin/valid_package/CMakeLists.txt rename to tests/plugins/discovery/ros/valid_package/CMakeLists.txt diff --git a/tests/plugins/discovery/ros_discovery_plugin/valid_package/package.xml b/tests/plugins/discovery/ros/valid_package/package.xml similarity index 100% rename from tests/plugins/discovery/ros_discovery_plugin/valid_package/package.xml rename to tests/plugins/discovery/ros/valid_package/package.xml diff --git a/tests/plugins/discovery/shell_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/shell/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/shell/exceptions.yaml diff --git a/tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py b/tests/plugins/discovery/shell/test_shell_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/test_shell_discovery_plugin.py rename to tests/plugins/discovery/shell/test_shell_discovery_plugin.py diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/ignore_this/ignoreme.bash b/tests/plugins/discovery/shell/valid_package/ignore_this/ignoreme.bash similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/ignore_this/ignoreme.bash rename to tests/plugins/discovery/shell/valid_package/ignore_this/ignoreme.bash diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionbash.source b/tests/plugins/discovery/shell/valid_package/oddextensionbash.source similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionbash.source rename to tests/plugins/discovery/shell/valid_package/oddextensionbash.source diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensioncsh.source b/tests/plugins/discovery/shell/valid_package/oddextensioncsh.source similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensioncsh.source rename to tests/plugins/discovery/shell/valid_package/oddextensioncsh.source diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensiondash.source b/tests/plugins/discovery/shell/valid_package/oddextensiondash.source similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensiondash.source rename to tests/plugins/discovery/shell/valid_package/oddextensiondash.source diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionksh.source b/tests/plugins/discovery/shell/valid_package/oddextensionksh.source similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionksh.source rename to tests/plugins/discovery/shell/valid_package/oddextensionksh.source diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionsh.source b/tests/plugins/discovery/shell/valid_package/oddextensionsh.source similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionsh.source rename to tests/plugins/discovery/shell/valid_package/oddextensionsh.source diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionzsh.source b/tests/plugins/discovery/shell/valid_package/oddextensionzsh.source similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/oddextensionzsh.source rename to tests/plugins/discovery/shell/valid_package/oddextensionzsh.source diff --git a/tests/plugins/discovery/shell_discovery_plugin/valid_package/test.sh b/tests/plugins/discovery/shell/valid_package/test.sh similarity index 100% rename from tests/plugins/discovery/shell_discovery_plugin/valid_package/test.sh rename to tests/plugins/discovery/shell/valid_package/test.sh diff --git a/tests/plugins/discovery/xml_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/xml/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/xml_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/xml/exceptions.yaml diff --git a/tests/plugins/discovery/xml_discovery_plugin/invalid_package/test.xmla b/tests/plugins/discovery/xml/invalid_package/test.xmla similarity index 100% rename from tests/plugins/discovery/xml_discovery_plugin/invalid_package/test.xmla rename to tests/plugins/discovery/xml/invalid_package/test.xmla diff --git a/tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py b/tests/plugins/discovery/xml/test_xml_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/xml_discovery_plugin/test_xml_discovery_plugin.py rename to tests/plugins/discovery/xml/test_xml_discovery_plugin.py diff --git a/tests/plugins/discovery/xml_discovery_plugin/valid_package/ignore_this/ignoreme.xml b/tests/plugins/discovery/xml/valid_package/ignore_this/ignoreme.xml similarity index 100% rename from tests/plugins/discovery/xml_discovery_plugin/valid_package/ignore_this/ignoreme.xml rename to tests/plugins/discovery/xml/valid_package/ignore_this/ignoreme.xml diff --git a/tests/plugins/discovery/xml_discovery_plugin/valid_package/test.launch b/tests/plugins/discovery/xml/valid_package/test.launch similarity index 100% rename from tests/plugins/discovery/xml_discovery_plugin/valid_package/test.launch rename to tests/plugins/discovery/xml/valid_package/test.launch diff --git a/tests/plugins/discovery/xml_discovery_plugin/valid_package/test.xml b/tests/plugins/discovery/xml/valid_package/test.xml similarity index 100% rename from tests/plugins/discovery/xml_discovery_plugin/valid_package/test.xml rename to tests/plugins/discovery/xml/valid_package/test.xml diff --git a/tests/plugins/discovery/yaml_discovery_plugin/exceptions.yaml b/tests/plugins/discovery/yaml/exceptions.yaml similarity index 100% rename from tests/plugins/discovery/yaml_discovery_plugin/exceptions.yaml rename to tests/plugins/discovery/yaml/exceptions.yaml diff --git a/tests/plugins/discovery/yaml_discovery_plugin/invalid_package/test.yamllint b/tests/plugins/discovery/yaml/invalid_package/test.yamllint similarity index 100% rename from tests/plugins/discovery/yaml_discovery_plugin/invalid_package/test.yamllint rename to tests/plugins/discovery/yaml/invalid_package/test.yamllint diff --git a/tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py b/tests/plugins/discovery/yaml/test_yaml_discovery_plugin.py similarity index 100% rename from tests/plugins/discovery/yaml_discovery_plugin/test_yaml_discovery_plugin.py rename to tests/plugins/discovery/yaml/test_yaml_discovery_plugin.py diff --git a/tests/plugins/discovery/yaml_discovery_plugin/valid_package/ignore_this/ignoreme.yaml b/tests/plugins/discovery/yaml/valid_package/ignore_this/ignoreme.yaml similarity index 100% rename from tests/plugins/discovery/yaml_discovery_plugin/valid_package/ignore_this/ignoreme.yaml rename to tests/plugins/discovery/yaml/valid_package/ignore_this/ignoreme.yaml diff --git a/tests/plugins/discovery/yaml_discovery_plugin/valid_package/test.yaml b/tests/plugins/discovery/yaml/valid_package/test.yaml similarity index 100% rename from tests/plugins/discovery/yaml_discovery_plugin/valid_package/test.yaml rename to tests/plugins/discovery/yaml/valid_package/test.yaml diff --git a/tests/plugins/discovery/yaml_discovery_plugin/valid_package/test.yml b/tests/plugins/discovery/yaml/valid_package/test.yml similarity index 100% rename from tests/plugins/discovery/yaml_discovery_plugin/valid_package/test.yml rename to tests/plugins/discovery/yaml/valid_package/test.yml diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/config/rsc/config-gitlab.yaml b/tests/plugins/reporting/code_climate/config/rsc/config-gitlab.yaml similarity index 100% rename from tests/plugins/reporting/code_climate_reporting_plugin/config/rsc/config-gitlab.yaml rename to tests/plugins/reporting/code_climate/config/rsc/config-gitlab.yaml diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/config/rsc/config.yaml b/tests/plugins/reporting/code_climate/config/rsc/config.yaml similarity index 100% rename from tests/plugins/reporting/code_climate_reporting_plugin/config/rsc/config.yaml rename to tests/plugins/reporting/code_climate/config/rsc/config.yaml diff --git a/tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py b/tests/plugins/reporting/code_climate/test_code_climate_reporting_plugin.py similarity index 100% rename from tests/plugins/reporting/code_climate_reporting_plugin/test_code_climate_reporting_plugin.py rename to tests/plugins/reporting/code_climate/test_code_climate_reporting_plugin.py diff --git a/tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py b/tests/plugins/reporting/do_nothing/test_do_nothing_reporting_plugin.py similarity index 100% rename from tests/plugins/reporting/do_nothing_reporting_plugin/test_do_nothing_reporting_plugin.py rename to tests/plugins/reporting/do_nothing/test_do_nothing_reporting_plugin.py diff --git a/tests/plugins/reporting/json_reporting_plugin/config/rsc/config.yaml b/tests/plugins/reporting/json/config/rsc/config.yaml similarity index 100% rename from tests/plugins/reporting/json_reporting_plugin/config/rsc/config.yaml rename to tests/plugins/reporting/json/config/rsc/config.yaml diff --git a/tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py b/tests/plugins/reporting/json/test_json_reporting_plugin.py similarity index 100% rename from tests/plugins/reporting/json_reporting_plugin/test_json_reporting_plugin.py rename to tests/plugins/reporting/json/test_json_reporting_plugin.py diff --git a/tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py b/tests/plugins/reporting/print_to_console/test_print_to_console_reporting_plugin.py similarity index 100% rename from tests/plugins/reporting/print_to_console_reporting_plugin/test_print_to_console_reporting_plugin.py rename to tests/plugins/reporting/print_to_console/test_print_to_console_reporting_plugin.py diff --git a/tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py b/tests/plugins/reporting/write_jenkins_warnings_ng/test_write_jenkins_warnings_ng_reporting_plugin.py similarity index 100% rename from tests/plugins/reporting/write_jenkins_warnings_ng_reporting_plugin/test_write_jenkins_warnings_ng_reporting_plugin.py rename to tests/plugins/reporting/write_jenkins_warnings_ng/test_write_jenkins_warnings_ng_reporting_plugin.py diff --git a/tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py b/tests/plugins/tool/bandit/test_bandit_tool_plugin.py similarity index 100% rename from tests/plugins/tool/bandit_tool_plugin/test_bandit_tool_plugin.py rename to tests/plugins/tool/bandit/test_bandit_tool_plugin.py diff --git a/tests/plugins/tool/bandit_tool_plugin/valid_package/b404.py b/tests/plugins/tool/bandit/valid_package/b404.py similarity index 100% rename from tests/plugins/tool/bandit_tool_plugin/valid_package/b404.py rename to tests/plugins/tool/bandit/valid_package/b404.py diff --git a/tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py b/tests/plugins/tool/black/test_black_tool_plugin.py similarity index 100% rename from tests/plugins/tool/black_tool_plugin/test_black_tool_plugin.py rename to tests/plugins/tool/black/test_black_tool_plugin.py diff --git a/tests/plugins/tool/black_tool_plugin/valid_package/format_errors.py b/tests/plugins/tool/black/valid_package/format_errors.py similarity index 100% rename from tests/plugins/tool/black_tool_plugin/valid_package/format_errors.py rename to tests/plugins/tool/black/valid_package/format_errors.py diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/c0x_package/CMakeLists.txt b/tests/plugins/tool/catkin-lint/c0x_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/c0x_package/CMakeLists.txt rename to tests/plugins/tool/catkin-lint/c0x_package/CMakeLists.txt diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/c0x_package/package.xml b/tests/plugins/tool/catkin-lint/c0x_package/package.xml similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/c0x_package/package.xml rename to tests/plugins/tool/catkin-lint/c0x_package/package.xml diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/c11_package/CMakeLists.txt b/tests/plugins/tool/catkin-lint/c11_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/c11_package/CMakeLists.txt rename to tests/plugins/tool/catkin-lint/c11_package/CMakeLists.txt diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/c11_package/package.xml b/tests/plugins/tool/catkin-lint/c11_package/package.xml similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/c11_package/package.xml rename to tests/plugins/tool/catkin-lint/c11_package/package.xml diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/cmake_flags/CMakeLists.txt b/tests/plugins/tool/catkin-lint/cmake_flags/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/cmake_flags/CMakeLists.txt rename to tests/plugins/tool/catkin-lint/cmake_flags/CMakeLists.txt diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/gnu99_package/CMakeLists.txt b/tests/plugins/tool/catkin-lint/gnu99_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/gnu99_package/CMakeLists.txt rename to tests/plugins/tool/catkin-lint/gnu99_package/CMakeLists.txt diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/gnu99_package/package.xml b/tests/plugins/tool/catkin-lint/gnu99_package/package.xml similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/gnu99_package/package.xml rename to tests/plugins/tool/catkin-lint/gnu99_package/package.xml diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py b/tests/plugins/tool/catkin-lint/test_catkin-lint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/test_catkin-lint_tool_plugin.py rename to tests/plugins/tool/catkin-lint/test_catkin-lint_tool_plugin.py diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/catkin-lint/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/catkin-lint/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/catkin-lint_tool_plugin/valid_package/package.xml b/tests/plugins/tool/catkin-lint/valid_package/package.xml similarity index 100% rename from tests/plugins/tool/catkin-lint_tool_plugin/valid_package/package.xml rename to tests/plugins/tool/catkin-lint/valid_package/package.xml diff --git a/tests/plugins/tool/cccc_tool_plugin/cccc.opt b/tests/plugins/tool/cccc/cccc.opt similarity index 100% rename from tests/plugins/tool/cccc_tool_plugin/cccc.opt rename to tests/plugins/tool/cccc/cccc.opt diff --git a/tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py b/tests/plugins/tool/cccc/test_cccc_tool_plugin.py similarity index 100% rename from tests/plugins/tool/cccc_tool_plugin/test_cccc_tool_plugin.py rename to tests/plugins/tool/cccc/test_cccc_tool_plugin.py diff --git a/tests/plugins/tool/cccc_tool_plugin/valid_package/cccc-missing-names.xml b/tests/plugins/tool/cccc/valid_package/cccc-missing-names.xml similarity index 100% rename from tests/plugins/tool/cccc_tool_plugin/valid_package/cccc-missing-names.xml rename to tests/plugins/tool/cccc/valid_package/cccc-missing-names.xml diff --git a/tests/plugins/tool/cccc_tool_plugin/valid_package/cccc.xml b/tests/plugins/tool/cccc/valid_package/cccc.xml similarity index 100% rename from tests/plugins/tool/cccc_tool_plugin/valid_package/cccc.xml rename to tests/plugins/tool/cccc/valid_package/cccc.xml diff --git a/tests/plugins/tool/cccc_tool_plugin/valid_package/example.cpp b/tests/plugins/tool/cccc/valid_package/example.cpp similarity index 100% rename from tests/plugins/tool/cccc_tool_plugin/valid_package/example.cpp rename to tests/plugins/tool/cccc/valid_package/example.cpp diff --git a/tests/plugins/tool/clang-format_tool_plugin/different-clang-format.cfg b/tests/plugins/tool/clang-format/different-clang-format.cfg similarity index 100% rename from tests/plugins/tool/clang-format_tool_plugin/different-clang-format.cfg rename to tests/plugins/tool/clang-format/different-clang-format.cfg diff --git a/tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py b/tests/plugins/tool/clang-format/test_clang-format_tool_plugin.py similarity index 100% rename from tests/plugins/tool/clang-format_tool_plugin/test_clang-format_tool_plugin.py rename to tests/plugins/tool/clang-format/test_clang-format_tool_plugin.py diff --git a/tests/plugins/tool/clang-format_tool_plugin/valid_package/indents.c b/tests/plugins/tool/clang-format/valid_package/indents.c similarity index 100% rename from tests/plugins/tool/clang-format_tool_plugin/valid_package/indents.c rename to tests/plugins/tool/clang-format/valid_package/indents.c diff --git a/tests/plugins/tool/clang-format_tool_plugin/valid_package/indents.h b/tests/plugins/tool/clang-format/valid_package/indents.h similarity index 100% rename from tests/plugins/tool/clang-format_tool_plugin/valid_package/indents.h rename to tests/plugins/tool/clang-format/valid_package/indents.h diff --git a/tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py b/tests/plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py similarity index 100% rename from tests/plugins/tool/clang-tidy_tool_plugin/test_clang-tidy_tool_plugin.py rename to tests/plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py diff --git a/tests/plugins/tool/clang-tidy_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/clang-tidy/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/clang-tidy_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/clang-tidy/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/clang-tidy_tool_plugin/valid_package/test.c b/tests/plugins/tool/clang-tidy/valid_package/test.c similarity index 100% rename from tests/plugins/tool/clang-tidy_tool_plugin/valid_package/test.c rename to tests/plugins/tool/clang-tidy/valid_package/test.c diff --git a/tests/plugins/tool/cmakelint_tool_plugin/cmake_ext_package/CMakeLists.txt b/tests/plugins/tool/cmakelint/cmake_ext_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/cmakelint_tool_plugin/cmake_ext_package/CMakeLists.txt rename to tests/plugins/tool/cmakelint/cmake_ext_package/CMakeLists.txt diff --git a/tests/plugins/tool/cmakelint_tool_plugin/cmake_ext_package/CMakeModules/FindCython.cmake b/tests/plugins/tool/cmakelint/cmake_ext_package/CMakeModules/FindCython.cmake similarity index 100% rename from tests/plugins/tool/cmakelint_tool_plugin/cmake_ext_package/CMakeModules/FindCython.cmake rename to tests/plugins/tool/cmakelint/cmake_ext_package/CMakeModules/FindCython.cmake diff --git a/tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py b/tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/cmakelint_tool_plugin/test_cmakelint_tool_plugin.py rename to tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py diff --git a/tests/plugins/tool/cmakelint_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/cmakelint/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/cmakelint_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/cmakelint/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py b/tests/plugins/tool/cppcheck/test_cppcheck_tool_plugin.py similarity index 100% rename from tests/plugins/tool/cppcheck_tool_plugin/test_cppcheck_tool_plugin.py rename to tests/plugins/tool/cppcheck/test_cppcheck_tool_plugin.py diff --git a/tests/plugins/tool/cppcheck_tool_plugin/valid_package/test.c b/tests/plugins/tool/cppcheck/valid_package/test.c similarity index 100% rename from tests/plugins/tool/cppcheck_tool_plugin/valid_package/test.c rename to tests/plugins/tool/cppcheck/valid_package/test.c diff --git a/tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py b/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/cpplint_tool_plugin/test_cpplint_tool_plugin.py rename to tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py diff --git a/tests/plugins/tool/cpplint_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/cpplint/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/cpplint_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/cpplint/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/cpplint_tool_plugin/valid_package/test.c b/tests/plugins/tool/cpplint/valid_package/test.c similarity index 100% rename from tests/plugins/tool/cpplint_tool_plugin/valid_package/test.c rename to tests/plugins/tool/cpplint/valid_package/test.c diff --git a/tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py b/tests/plugins/tool/do_nothing/test_do_nothing_tool_plugin.py similarity index 100% rename from tests/plugins/tool/do_nothing_tool_plugin/test_do_nothing_tool_plugin.py rename to tests/plugins/tool/do_nothing/test_do_nothing_tool_plugin.py diff --git a/tests/plugins/tool/do_nothing_tool_plugin/valid_package/basic.py b/tests/plugins/tool/do_nothing/valid_package/basic.py similarity index 100% rename from tests/plugins/tool/do_nothing_tool_plugin/valid_package/basic.py rename to tests/plugins/tool/do_nothing/valid_package/basic.py diff --git a/tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py b/tests/plugins/tool/docformatter/test_docformatter_tool_plugin.py similarity index 100% rename from tests/plugins/tool/docformatter_tool_plugin/test_docformatter_tool_plugin.py rename to tests/plugins/tool/docformatter/test_docformatter_tool_plugin.py diff --git a/tests/plugins/tool/docformatter_tool_plugin/valid_package/wrong.py b/tests/plugins/tool/docformatter/valid_package/wrong.py similarity index 100% rename from tests/plugins/tool/docformatter_tool_plugin/valid_package/wrong.py rename to tests/plugins/tool/docformatter/valid_package/wrong.py diff --git a/tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py b/tests/plugins/tool/flawfinder/test_flawfinder_tool_plugin.py similarity index 100% rename from tests/plugins/tool/flawfinder_tool_plugin/test_flawfinder_tool_plugin.py rename to tests/plugins/tool/flawfinder/test_flawfinder_tool_plugin.py diff --git a/tests/plugins/tool/flawfinder_tool_plugin/valid_package/strlen.c b/tests/plugins/tool/flawfinder/valid_package/strlen.c similarity index 100% rename from tests/plugins/tool/flawfinder_tool_plugin/valid_package/strlen.c rename to tests/plugins/tool/flawfinder/valid_package/strlen.c diff --git a/tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py b/tests/plugins/tool/groovylint/test_groovylint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/test_groovylint_tool_plugin.py rename to tests/plugins/tool/groovylint/test_groovylint_tool_plugin.py diff --git a/tests/plugins/tool/groovylint_tool_plugin/valid_package/Jenkinsfile b/tests/plugins/tool/groovylint/valid_package/Jenkinsfile similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/valid_package/Jenkinsfile rename to tests/plugins/tool/groovylint/valid_package/Jenkinsfile diff --git a/tests/plugins/tool/groovylint_tool_plugin/valid_package/rsc/.groovylintrc.json b/tests/plugins/tool/groovylint/valid_package/rsc/.groovylintrc.json similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/valid_package/rsc/.groovylintrc.json rename to tests/plugins/tool/groovylint/valid_package/rsc/.groovylintrc.json diff --git a/tests/plugins/tool/groovylint_tool_plugin/valid_package/rsc/config.yaml b/tests/plugins/tool/groovylint/valid_package/rsc/config.yaml similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/valid_package/rsc/config.yaml rename to tests/plugins/tool/groovylint/valid_package/rsc/config.yaml diff --git a/tests/plugins/tool/groovylint_tool_plugin/valid_package/test.gradle b/tests/plugins/tool/groovylint/valid_package/test.gradle similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/valid_package/test.gradle rename to tests/plugins/tool/groovylint/valid_package/test.gradle diff --git a/tests/plugins/tool/groovylint_tool_plugin/valid_package/test.groovy b/tests/plugins/tool/groovylint/valid_package/test.groovy similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/valid_package/test.groovy rename to tests/plugins/tool/groovylint/valid_package/test.groovy diff --git a/tests/plugins/tool/groovylint_tool_plugin/valid_package/test_errors.groovy b/tests/plugins/tool/groovylint/valid_package/test_errors.groovy similarity index 100% rename from tests/plugins/tool/groovylint_tool_plugin/valid_package/test_errors.groovy rename to tests/plugins/tool/groovylint/valid_package/test_errors.groovy diff --git a/tests/plugins/tool/isort_tool_plugin/rsc/config.yaml b/tests/plugins/tool/isort/rsc/config.yaml similarity index 100% rename from tests/plugins/tool/isort_tool_plugin/rsc/config.yaml rename to tests/plugins/tool/isort/rsc/config.yaml diff --git a/tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py b/tests/plugins/tool/isort/test_isort_tool_plugin.py similarity index 100% rename from tests/plugins/tool/isort_tool_plugin/test_isort_tool_plugin.py rename to tests/plugins/tool/isort/test_isort_tool_plugin.py diff --git a/tests/plugins/tool/isort_tool_plugin/valid_package/sample.py b/tests/plugins/tool/isort/valid_package/sample.py similarity index 100% rename from tests/plugins/tool/isort_tool_plugin/valid_package/sample.py rename to tests/plugins/tool/isort/valid_package/sample.py diff --git a/tests/plugins/tool/isort_tool_plugin/valid_package/whitespace.py b/tests/plugins/tool/isort/valid_package/whitespace.py similarity index 100% rename from tests/plugins/tool/isort_tool_plugin/valid_package/whitespace.py rename to tests/plugins/tool/isort/valid_package/whitespace.py diff --git a/tests/plugins/tool/lizard_tool_plugin/rsc/config.yaml b/tests/plugins/tool/lizard/rsc/config.yaml similarity index 100% rename from tests/plugins/tool/lizard_tool_plugin/rsc/config.yaml rename to tests/plugins/tool/lizard/rsc/config.yaml diff --git a/tests/plugins/tool/lizard_tool_plugin/rsc/profile.yaml b/tests/plugins/tool/lizard/rsc/profile.yaml similarity index 100% rename from tests/plugins/tool/lizard_tool_plugin/rsc/profile.yaml rename to tests/plugins/tool/lizard/rsc/profile.yaml diff --git a/tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py b/tests/plugins/tool/lizard/test_lizard_tool_plugin.py similarity index 100% rename from tests/plugins/tool/lizard_tool_plugin/test_lizard_tool_plugin.py rename to tests/plugins/tool/lizard/test_lizard_tool_plugin.py diff --git a/tests/plugins/tool/lizard_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/lizard/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/lizard_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/lizard/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/lizard_tool_plugin/valid_package/test.c b/tests/plugins/tool/lizard/valid_package/test.c similarity index 100% rename from tests/plugins/tool/lizard_tool_plugin/valid_package/test.c rename to tests/plugins/tool/lizard/valid_package/test.c diff --git a/tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py b/tests/plugins/tool/make/test_make_tool_plugin.py similarity index 100% rename from tests/plugins/tool/make_tool_plugin/test_make_tool_plugin.py rename to tests/plugins/tool/make/test_make_tool_plugin.py diff --git a/tests/plugins/tool/make_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/make/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/make_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/make/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/make_tool_plugin/valid_package/hello.cpp b/tests/plugins/tool/make/valid_package/hello.cpp similarity index 100% rename from tests/plugins/tool/make_tool_plugin/valid_package/hello.cpp rename to tests/plugins/tool/make/valid_package/hello.cpp diff --git a/tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py b/tests/plugins/tool/mypy/test_mypy_tool_plugin.py similarity index 100% rename from tests/plugins/tool/mypy_tool_plugin/test_mypy_tool_plugin.py rename to tests/plugins/tool/mypy/test_mypy_tool_plugin.py diff --git a/tests/plugins/tool/mypy_tool_plugin/valid_package/wrong_mypy.py b/tests/plugins/tool/mypy/valid_package/wrong_mypy.py similarity index 100% rename from tests/plugins/tool/mypy_tool_plugin/valid_package/wrong_mypy.py rename to tests/plugins/tool/mypy/valid_package/wrong_mypy.py diff --git a/tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py b/tests/plugins/tool/perlcritic/test_perlcritic_tool_plugin.py similarity index 100% rename from tests/plugins/tool/perlcritic_tool_plugin/test_perlcritic_tool_plugin.py rename to tests/plugins/tool/perlcritic/test_perlcritic_tool_plugin.py diff --git a/tests/plugins/tool/perlcritic_tool_plugin/valid_package/test.pl b/tests/plugins/tool/perlcritic/valid_package/test.pl similarity index 100% rename from tests/plugins/tool/perlcritic_tool_plugin/valid_package/test.pl rename to tests/plugins/tool/perlcritic/valid_package/test.pl diff --git a/tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py b/tests/plugins/tool/pycodestyle/test_pycodestyle_tool_plugin.py similarity index 100% rename from tests/plugins/tool/pycodestyle_tool_plugin/test_pycodestyle_tool_plugin.py rename to tests/plugins/tool/pycodestyle/test_pycodestyle_tool_plugin.py diff --git a/tests/plugins/tool/pycodestyle_tool_plugin/valid_package/e501.py b/tests/plugins/tool/pycodestyle/valid_package/e501.py similarity index 100% rename from tests/plugins/tool/pycodestyle_tool_plugin/valid_package/e501.py rename to tests/plugins/tool/pycodestyle/valid_package/e501.py diff --git a/tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py b/tests/plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py similarity index 100% rename from tests/plugins/tool/pydocstyle_tool_plugin/test_pydocstyle_tool_plugin.py rename to tests/plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py diff --git a/tests/plugins/tool/pydocstyle_tool_plugin/valid_package/d103.py b/tests/plugins/tool/pydocstyle/valid_package/d103.py similarity index 100% rename from tests/plugins/tool/pydocstyle_tool_plugin/valid_package/d103.py rename to tests/plugins/tool/pydocstyle/valid_package/d103.py diff --git a/tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py b/tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py similarity index 100% rename from tests/plugins/tool/pyflakes_tool_plugin/test_pyflakes_tool_plugin.py rename to tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py diff --git a/tests/plugins/tool/pyflakes_tool_plugin/valid_package/pyflakes_test.py b/tests/plugins/tool/pyflakes/valid_package/pyflakes_test.py similarity index 100% rename from tests/plugins/tool/pyflakes_tool_plugin/valid_package/pyflakes_test.py rename to tests/plugins/tool/pyflakes/valid_package/pyflakes_test.py diff --git a/tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py b/tests/plugins/tool/pylint/test_pylint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/pylint_tool_plugin/test_pylint_tool_plugin.py rename to tests/plugins/tool/pylint/test_pylint_tool_plugin.py diff --git a/tests/plugins/tool/pylint_tool_plugin/valid_package/basic.py b/tests/plugins/tool/pylint/valid_package/basic.py similarity index 100% rename from tests/plugins/tool/pylint_tool_plugin/valid_package/basic.py rename to tests/plugins/tool/pylint/valid_package/basic.py diff --git a/tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py b/tests/plugins/tool/ruff/test_ruff_tool_plugin.py similarity index 100% rename from tests/plugins/tool/ruff_tool_plugin/test_ruff_tool_plugin.py rename to tests/plugins/tool/ruff/test_ruff_tool_plugin.py diff --git a/tests/plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py b/tests/plugins/tool/ruff/valid_package/ruff_test.py similarity index 100% rename from tests/plugins/tool/ruff_tool_plugin/valid_package/ruff_test.py rename to tests/plugins/tool/ruff/valid_package/ruff_test.py diff --git a/tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py b/tests/plugins/tool/shellcheck/test_shellcheck_tool_plugin.py similarity index 100% rename from tests/plugins/tool/shellcheck_tool_plugin/test_shellcheck_tool_plugin.py rename to tests/plugins/tool/shellcheck/test_shellcheck_tool_plugin.py diff --git a/tests/plugins/tool/shellcheck_tool_plugin/valid_package/basic.sh b/tests/plugins/tool/shellcheck/valid_package/basic.sh similarity index 100% rename from tests/plugins/tool/shellcheck_tool_plugin/valid_package/basic.sh rename to tests/plugins/tool/shellcheck/valid_package/basic.sh diff --git a/tests/plugins/tool/spotbugs_tool_plugin/rsc/config.yaml b/tests/plugins/tool/spotbugs/rsc/config.yaml similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/rsc/config.yaml rename to tests/plugins/tool/spotbugs/rsc/config.yaml diff --git a/tests/plugins/tool/spotbugs_tool_plugin/rsc/profile.yaml b/tests/plugins/tool/spotbugs/rsc/profile.yaml similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/rsc/profile.yaml rename to tests/plugins/tool/spotbugs/rsc/profile.yaml diff --git a/tests/plugins/tool/spotbugs_tool_plugin/rsc/spotbugs-exclude.xml b/tests/plugins/tool/spotbugs/rsc/spotbugs-exclude.xml similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/rsc/spotbugs-exclude.xml rename to tests/plugins/tool/spotbugs/rsc/spotbugs-exclude.xml diff --git a/tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py b/tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/test_spotbugs_tool_plugin.py rename to tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py diff --git a/tests/plugins/tool/spotbugs_tool_plugin/valid_package/.gitignore b/tests/plugins/tool/spotbugs/valid_package/.gitignore similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/valid_package/.gitignore rename to tests/plugins/tool/spotbugs/valid_package/.gitignore diff --git a/tests/plugins/tool/spotbugs_tool_plugin/valid_package/pom.xml b/tests/plugins/tool/spotbugs/valid_package/pom.xml similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/valid_package/pom.xml rename to tests/plugins/tool/spotbugs/valid_package/pom.xml diff --git a/tests/plugins/tool/spotbugs_tool_plugin/valid_package/src/main/java/Test.java b/tests/plugins/tool/spotbugs/valid_package/src/main/java/Test.java similarity index 100% rename from tests/plugins/tool/spotbugs_tool_plugin/valid_package/src/main/java/Test.java rename to tests/plugins/tool/spotbugs/valid_package/src/main/java/Test.java diff --git a/tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py b/tests/plugins/tool/uncrustify/test_uncrustify_tool_plugin.py similarity index 100% rename from tests/plugins/tool/uncrustify_tool_plugin/test_uncrustify_tool_plugin.py rename to tests/plugins/tool/uncrustify/test_uncrustify_tool_plugin.py diff --git a/tests/plugins/tool/uncrustify_tool_plugin/valid_package/CMakeLists.txt b/tests/plugins/tool/uncrustify/valid_package/CMakeLists.txt similarity index 100% rename from tests/plugins/tool/uncrustify_tool_plugin/valid_package/CMakeLists.txt rename to tests/plugins/tool/uncrustify/valid_package/CMakeLists.txt diff --git a/tests/plugins/tool/uncrustify_tool_plugin/valid_package/rsc/uncrustify.cfg b/tests/plugins/tool/uncrustify/valid_package/rsc/uncrustify.cfg similarity index 100% rename from tests/plugins/tool/uncrustify_tool_plugin/valid_package/rsc/uncrustify.cfg rename to tests/plugins/tool/uncrustify/valid_package/rsc/uncrustify.cfg diff --git a/tests/plugins/tool/uncrustify_tool_plugin/valid_package/test.c b/tests/plugins/tool/uncrustify/valid_package/test.c similarity index 100% rename from tests/plugins/tool/uncrustify_tool_plugin/valid_package/test.c rename to tests/plugins/tool/uncrustify/valid_package/test.c diff --git a/tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py b/tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/xmllint_tool_plugin/test_xmllint_tool_plugin.py rename to tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py diff --git a/tests/plugins/tool/xmllint_tool_plugin/valid_package/premature_end.xml b/tests/plugins/tool/xmllint/valid_package/premature_end.xml similarity index 100% rename from tests/plugins/tool/xmllint_tool_plugin/valid_package/premature_end.xml rename to tests/plugins/tool/xmllint/valid_package/premature_end.xml diff --git a/tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py b/tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py similarity index 100% rename from tests/plugins/tool/yamllint_tool_plugin/test_yamllint_tool_plugin.py rename to tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py diff --git a/tests/plugins/tool/yamllint_tool_plugin/valid_package/document-start.yaml b/tests/plugins/tool/yamllint/valid_package/document-start.yaml similarity index 100% rename from tests/plugins/tool/yamllint_tool_plugin/valid_package/document-start.yaml rename to tests/plugins/tool/yamllint/valid_package/document-start.yaml From e45d370bcb0ade5f5fb1803437646264415c8dec Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Wed, 22 Nov 2023 15:15:19 -0800 Subject: [PATCH 19/58] Remove dependency on deprecated. --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1430238a..9d7616cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,6 @@ dependencies = [ "black", "cmakelint", "cpplint", - "deprecated", "docformatter", "flawfinder", "importlib_metadata", @@ -40,7 +39,6 @@ dependencies = [ "ruff", "tabulate", "types-PyYAML", - "types-deprecated", "types-setuptools", "types-tabulate", "xmltodict", From 7344c6c626bdd308f9d53fa01ea2383400216c97 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 23 Nov 2023 14:58:46 -0800 Subject: [PATCH 20/58] Update publish and test github workflow configs. --- .github/workflows/publish.yaml | 42 +++++++++++++--------------------- .github/workflows/test.yml | 29 +++-------------------- pyproject.toml | 4 ++++ 3 files changed, 23 insertions(+), 52 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 22e9f730..80a5838d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,45 +9,35 @@ on: # NOLINT jobs: build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/statick + permissions: + id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v1 + - name: Set up Python + uses: actions/setup-python@v4 with: python-version: '3.11' - - - uses: actions/cache@v3 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + cache: 'pip' - name: Install tools run: | - python -m pip install --upgrade setuptools - python -m pip install --upgrade wheel - python -m pip install -r requirements-docs.txt - python -m pip install -r requirements.txt + pip install . + pip install .[docs] + pip install .[dist] - name: Build a binary wheel and a source tarball run: | - python setup.py sdist bdist_wheel - - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_TEST_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + pip install -q build + python -m build - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_TOKEN }} + uses: pypa/gh-action-pypi-publish@release/v1 - name: Sphinx lint uses: ammaraskar/sphinx-action@master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f37f8b8..20995d3f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-20.04, ubuntu-22.04, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 @@ -28,30 +28,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - - uses: actions/cache@v3 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - uses: actions/cache@v3 - if: startsWith(runner.os, 'macOS') - with: - path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - uses: actions/cache@v3 - if: startsWith(runner.os, 'Windows') - with: - path: ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + cache: 'pip' - name: Install dependencies run: | @@ -92,7 +69,7 @@ jobs: sudo apt-get install clang-format-14 sudo apt-get install clang-tidy-14 - - name: Install node + - name: Install node tools if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' run: | npm install -g markdownlint-cli@0.21.0 diff --git a/pyproject.toml b/pyproject.toml index 9d7616cc..538b3ba4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -131,6 +131,10 @@ docs = [ "yaml-1.3", "yapsy", ] +dist = [ + "setuptools", + "wheel", +] [tool.isort] profile = "black" From 5f24a36497c339b9c58fee8f89f4ddb73580d6ad Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 23 Nov 2023 15:07:03 -0800 Subject: [PATCH 21/58] Install setuptools for test. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 538b3ba4..8c334889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,6 +122,7 @@ test = [ "pytest-cov", "pytest-flake8", "pytest-isort", + "setuptools", "tox", "tox-gh-actions", ] From 460d43b5d6dab707bf82edcd5a9d4141e82d2df8 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 24 Nov 2023 07:19:10 -0800 Subject: [PATCH 22/58] Remove some unused dependencies. --- .github/workflows/publish.yaml | 1 - .github/workflows/test.yml | 2 -- pyproject.toml | 1 - 3 files changed, 4 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 80a5838d..5695eb9e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -27,7 +27,6 @@ jobs: - name: Install tools run: | - pip install . pip install .[docs] pip install .[dist] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20995d3f..7c613a7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,8 +44,6 @@ jobs: run: | for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - # Use apt-get instead of apt as apt does not have a stable CLI interface. The apt tool prints out - # "WARNING: apt does not have a stable CLI interface. Use with caution in scripts." - name: Install tools (Linux) if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' run: | diff --git a/pyproject.toml b/pyproject.toml index 8c334889..a1b6d033 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,7 +130,6 @@ docs = [ "sphinx==1.7.9", "travis-sphinx==2.2.1", "yaml-1.3", - "yapsy", ] dist = [ "setuptools", From d7f830250befdd79e3df8ef40c8b0bea784a0e8e Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 24 Nov 2023 07:22:23 -0800 Subject: [PATCH 23/58] Remove yapsy from templates. --- docker/requirements.txt | 1 - templates/Dockerfile | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docker/requirements.txt b/docker/requirements.txt index 48ac8424..2ebc110d 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -21,4 +21,3 @@ statick-web tabulate xmltodict yamllint -yapsy diff --git a/templates/Dockerfile b/templates/Dockerfile index 49b90bf6..461abafb 100644 --- a/templates/Dockerfile +++ b/templates/Dockerfile @@ -1,5 +1,5 @@ -FROM ubuntu:xenial -LABEL maintainer="SPAWAR" +FROM ubuntu:22.04 +LABEL maintainer="NIWC" LABEL org.label-schema.name = "Statick Runner" LABEL org.label-schema.vcs-url = "https://github.com/sscpac/statick" @@ -14,14 +14,13 @@ RUN update-locale LC_ALL=en_US.UTF-8 # Statick requirements # packages needed to checkout and run statick itself -RUN apt-get update && apt-get install -y git wget build-essential python-yapsy python-yapsy python-yaml +RUN apt-get update && apt-get install -y git wget build-essential python-yaml # external tools -RUN apt-get update && apt-get install -y flawfinder clang-tidy clang-format clang python-yapsy findbugs bandit flawfinder libomp-dev libxml2 cppcheck cmake pylint python-pylint-django +RUN apt-get update && apt-get install -y flawfinder clang-tidy clang-format clang findbugs bandit flawfinder libomp-dev libxml2 cppcheck cmake pylint python-pylint-django RUN pip install --upgrade pip -RUN pip install yamllint cmakelint lizard flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-docstrings flake8-import-order flake8-quotes +RUN pip install yamllint cmakelint lizard flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-docstrings flake8-import-order flake8-quotes - -# Jenkins user setup (keep this at the bottom) -RUN useradd -m jenkins -s /bin/bash +# Statick user setup (keep this at the bottom) +RUN useradd -m statick -s /bin/bash ENV JAVA_OPTS="-Xmx8292m" -USER jenkins +USER statick From 5b407f948217d509feddc8dda88f0974fb8914c0 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 24 Nov 2023 07:34:15 -0800 Subject: [PATCH 24/58] Update sphinx docs. --- docs/source/conf.py | 2 +- .../source/statick_tool.plugins.discovery.rst | 66 +++---- .../source/statick_tool.plugins.reporting.rst | 30 +-- docs/source/statick_tool.plugins.tool.rst | 174 +++++++++--------- 4 files changed, 136 insertions(+), 136 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d17ae023..98ef4e1a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -65,7 +65,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/source/statick_tool.plugins.discovery.rst b/docs/source/statick_tool.plugins.discovery.rst index 5e5e6eb6..7971c47e 100644 --- a/docs/source/statick_tool.plugins.discovery.rst +++ b/docs/source/statick_tool.plugins.discovery.rst @@ -12,99 +12,99 @@ Module contents Submodules ---------- -statick_tool.plugins.discovery.c_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.c module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.c_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.c :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.cmake_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.cmake module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.cmake_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.cmake :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.groovy_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.groovy module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.groovy_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.groovy :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.java_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.java module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.java_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.java :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.maven_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.maven module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.maven_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.maven :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.perl_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.perl module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.perl_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.perl :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.python_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.python module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.python_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.python :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.ros_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.ros module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.ros_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.ros :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.shell_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.shell module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.shell_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.shell :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.xml_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.xml module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.xml_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.xml :members: :undoc-members: :show-inheritance: -statick_tool.plugins.discovery.yaml_discovery_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.discovery.yaml module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.discovery.yaml_discovery_plugin +.. automodule:: statick_tool.plugins.discovery.yaml :members: :undoc-members: :show-inheritance: diff --git a/docs/source/statick_tool.plugins.reporting.rst b/docs/source/statick_tool.plugins.reporting.rst index 545658ad..7dc6891a 100644 --- a/docs/source/statick_tool.plugins.reporting.rst +++ b/docs/source/statick_tool.plugins.reporting.rst @@ -12,42 +12,42 @@ Module contents Submodules ---------- -statick_tool.plugins.reporting.code_climate_reporting_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.reporting.code_climate module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.reporting.code_climate_reporting_plugin +.. automodule:: statick_tool.plugins.reporting.code_climate :members: :undoc-members: :show-inheritance: -statick_tool.plugins.reporting.do_nothing_reporting_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.reporting.do_nothing module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.reporting.do_nothing_reporting_plugin +.. automodule:: statick_tool.plugins.reporting.do_nothing :members: :undoc-members: :show-inheritance: -statick_tool.plugins.reporting.json_reporting_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.reporting.json module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.reporting.json_reporting_plugin +.. automodule:: statick_tool.plugins.reporting.json :members: :undoc-members: :show-inheritance: -statick_tool.plugins.reporting.print_to_console_reporting_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.reporting.print_to_console module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.reporting.print_to_console_reporting_plugin +.. automodule:: statick_tool.plugins.reporting.print_to_console :members: :undoc-members: :show-inheritance: -statick_tool.plugins.reporting.write_jenkins_warnings_ng_reporting_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.reporting.write_jenkins_warnings_ng module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.reporting.write_jenkins_warnings_ng_reporting_plugin +.. automodule:: statick_tool.plugins.reporting.write_jenkins_warnings_ng :members: :undoc-members: :show-inheritance: diff --git a/docs/source/statick_tool.plugins.tool.rst b/docs/source/statick_tool.plugins.tool.rst index 64e3842b..10fa7cfb 100644 --- a/docs/source/statick_tool.plugins.tool.rst +++ b/docs/source/statick_tool.plugins.tool.rst @@ -12,234 +12,234 @@ Module contents Submodules ---------- -statick_tool.plugins.tool.bandit_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.bandit module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.bandit_tool_plugin +.. automodule:: statick_tool.plugins.tool.bandit :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.black_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.black module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.black_tool_plugin +.. automodule:: statick_tool.plugins.tool.black :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.catkin_lint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.catkin_lint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.catkin_lint_tool_plugin +.. automodule:: statick_tool.plugins.tool.catkin_lint :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.cccc_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.cccc module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.cccc_tool_plugin +.. automodule:: statick_tool.plugins.tool.cccc :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.clang_format_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.clang_format module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.clang_format_tool_plugin +.. automodule:: statick_tool.plugins.tool.clang_format :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.clang_tidy_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.clang_tidy module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.clang_tidy_tool_plugin +.. automodule:: statick_tool.plugins.tool.clang_tidy :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.cmakelint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.cmakelint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.cmakelint_tool_plugin +.. automodule:: statick_tool.plugins.tool.cmakelint :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.cppcheck_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.cppcheck module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.cppcheck_tool_plugin +.. automodule:: statick_tool.plugins.tool.cppcheck :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.cpplint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.cpplint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.cpplint_tool_plugin +.. automodule:: statick_tool.plugins.tool.cpplint :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.docformatter_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.docformatter module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.docformatter_tool_plugin +.. automodule:: statick_tool.plugins.tool.docformatter :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.do_nothing_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.do_nothing module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.do_nothing_tool_plugin +.. automodule:: statick_tool.plugins.tool.do_nothing :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.flawfinder_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.flawfinder module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.flawfinder_tool_plugin +.. automodule:: statick_tool.plugins.tool.flawfinder :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.groovylint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.groovylint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.groovylint_tool_plugin +.. automodule:: statick_tool.plugins.tool.groovylint :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.isort_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.isort module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.isort_tool_plugin +.. automodule:: statick_tool.plugins.tool.isort :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.lizard_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.lizard module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.lizard_tool_plugin +.. automodule:: statick_tool.plugins.tool.lizard :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.make_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.make module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.make_tool_plugin +.. automodule:: statick_tool.plugins.tool.make :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.mypy_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.mypy module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.mypy_tool_plugin +.. automodule:: statick_tool.plugins.tool.mypy :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.perlcritic_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.perlcritic module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.perlcritic_tool_plugin +.. automodule:: statick_tool.plugins.tool.perlcritic :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.pycodestyle_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.pycodestyle module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.pycodestyle_tool_plugin +.. automodule:: statick_tool.plugins.tool.pycodestyle :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.pydocstyle_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.pydocstyle module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.pydocstyle_tool_plugin +.. automodule:: statick_tool.plugins.tool.pydocstyle :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.pyflakes_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.pyflakes module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.pyflakes_tool_plugin +.. automodule:: statick_tool.plugins.tool.pyflakes :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.pylint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.pylint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.pylint_tool_plugin +.. automodule:: statick_tool.plugins.tool.pylint :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.ruff_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.ruff module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.ruff_tool_plugin +.. automodule:: statick_tool.plugins.tool.ruff :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.shellcheck_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.shellcheck module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.shellcheck_tool_plugin +.. automodule:: statick_tool.plugins.tool.shellcheck :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.shellcheck_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.shellcheck module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.shellcheck_tool_plugin +.. automodule:: statick_tool.plugins.tool.shellcheck :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.spotbugs_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.spotbugs module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.spotbugs_tool_plugin +.. automodule:: statick_tool.plugins.tool.spotbugs :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.uncrustify_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.uncrustify module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.uncrustify_tool_plugin +.. automodule:: statick_tool.plugins.tool.uncrustify :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.xmllint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.xmllint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.xmllint_tool_plugin +.. automodule:: statick_tool.plugins.tool.xmllint :members: :undoc-members: :show-inheritance: -statick_tool.plugins.tool.yamllint_tool_plugin module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +statick_tool.plugins.tool.yamllint module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: statick_tool.plugins.tool.yamllint_tool_plugin +.. automodule:: statick_tool.plugins.tool.yamllint :members: :undoc-members: :show-inheritance: From a63de33c0e7c14718c682b8fd0a94aa0977d1db6 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 25 Nov 2023 18:51:07 -0800 Subject: [PATCH 25/58] Dependency cleanup. --- .github/workflows/publish.yaml | 1 - pyproject.toml | 15 ++------------- tox.ini | 2 -- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5695eb9e..8ea101a5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -28,7 +28,6 @@ jobs: - name: Install tools run: | pip install .[docs] - pip install .[dist] - name: Build a binary wheel and a source tarball run: | diff --git a/pyproject.toml b/pyproject.toml index a1b6d033..0e2d9eab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] @@ -111,30 +111,19 @@ yamllint = "statick_tool.plugins.tool.yamllint:YamllintToolPlugin" [project.optional-dependencies] test = [ - "flake8-pep3101", - "flake8<5", # Pin until https://github.com/tholo/pytest-flake8/issues/87 is fixed. + "coverage", "lark", "mock", - "pycodestyle", - "pydocstyle", "pylint-django", "pytest", "pytest-cov", - "pytest-flake8", - "pytest-isort", - "setuptools", "tox", "tox-gh-actions", ] docs = [ "sphinx==1.7.9", - "travis-sphinx==2.2.1", "yaml-1.3", ] -dist = [ - "setuptools", - "wheel", -] [tool.isort] profile = "black" diff --git a/tox.ini b/tox.ini index dfabbfee..6d25656c 100644 --- a/tox.ini +++ b/tox.ini @@ -15,8 +15,6 @@ python = [testenv] changedir = {toxinidir}/output-{envname} -passenv = CI -setenv = PY_IGNORE_IMPORTMISMATCH = 1 deps = .[test] commands = From aa80b215e53146b3ba6a1a870013dc8dba585077 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 25 Nov 2023 21:10:16 -0800 Subject: [PATCH 26/58] Fix tox issue. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 6d25656c..f8dfdd78 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ python = [testenv] changedir = {toxinidir}/output-{envname} +setenv = PY_IGNORE_IMPORTMISMATCH = 1 deps = .[test] commands = From f6ec3153144947bdc140f2dae9334e29a3a00c40 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 25 Nov 2023 21:18:03 -0800 Subject: [PATCH 27/58] Remove deprecated use of pkg_resources in favor of importlib for version information. --- src/statick_tool/statick_tool.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/statick_tool/statick_tool.py b/src/statick_tool/statick_tool.py index 6e44e4e9..92fdf362 100644 --- a/src/statick_tool/statick_tool.py +++ b/src/statick_tool/statick_tool.py @@ -10,8 +10,6 @@ from logging.handlers import MemoryHandler from typing import Any, Dict, List, Optional, Tuple -import pkg_resources - from statick_tool.config import Config from statick_tool.discovery_plugin import DiscoveryPlugin from statick_tool.exceptions import Exceptions @@ -22,6 +20,7 @@ from statick_tool.resources import Resources from statick_tool.timing import Timing +from importlib.metadata import version if sys.version_info < (3, 10): from importlib_metadata import entry_points else: @@ -184,7 +183,7 @@ def gather_args(self, args: argparse.ArgumentParser) -> None: args.add_argument( "--version", action="version", - version=f"%(prog)s {pkg_resources.get_distribution('statick').version}", + version=f"%(prog)s {version('statick')}", ) args.add_argument( "--mapping-file-suffix", From a38e763812180218d7b0c7cf184a32bf475ed2b1 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 25 Nov 2023 21:23:16 -0800 Subject: [PATCH 28/58] Run isort. --- src/statick_tool/statick_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/statick_tool/statick_tool.py b/src/statick_tool/statick_tool.py index 92fdf362..fca9fdec 100644 --- a/src/statick_tool/statick_tool.py +++ b/src/statick_tool/statick_tool.py @@ -7,6 +7,7 @@ import os import sys import time +from importlib.metadata import version from logging.handlers import MemoryHandler from typing import Any, Dict, List, Optional, Tuple @@ -20,7 +21,6 @@ from statick_tool.resources import Resources from statick_tool.timing import Timing -from importlib.metadata import version if sys.version_info < (3, 10): from importlib_metadata import entry_points else: From bfeb3829511ad973ec52bb56d34794a74b8e1112 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sun, 14 Jan 2024 19:29:45 -0800 Subject: [PATCH 29/58] Delete yapsy-plugin file for example. --- .../plugins/my_custom_tool_plugin.yapsy-plugin | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 examples/navigation/navigation_config/plugins/my_custom_tool_plugin.yapsy-plugin diff --git a/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.yapsy-plugin b/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.yapsy-plugin deleted file mode 100644 index 888099ed..00000000 --- a/examples/navigation/navigation_config/plugins/my_custom_tool_plugin.yapsy-plugin +++ /dev/null @@ -1,3 +0,0 @@ -[Core] -Name = My Custom Tool Plugin -Module = my_custom_tool_plugin From 175724662311721d472f15d1c756ca687bf50ef9 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 6 Feb 2024 12:41:21 -0800 Subject: [PATCH 30/58] Black formatting. --- src/statick_tool/plugins/discovery/ros.py | 6 +++--- src/statick_tool/statick_tool.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/statick_tool/plugins/discovery/ros.py b/src/statick_tool/plugins/discovery/ros.py index a70e2f58..fbf29398 100644 --- a/src/statick_tool/plugins/discovery/ros.py +++ b/src/statick_tool/plugins/discovery/ros.py @@ -61,9 +61,9 @@ def scan( if path is not None: for item in path.split(":"): if distro is not None and distro in item: - package[ - "cmake_flags" - ] = "-DCMAKE_PREFIX_PATH=" + item.rstrip("/bin") + package["cmake_flags"] = ( + "-DCMAKE_PREFIX_PATH=" + item.rstrip("/bin") + ) package["is_ros2"] = True elif os.path.isfile(package_file) and ros_version is not None: with open(package_file, encoding="utf8") as fconfig: diff --git a/src/statick_tool/statick_tool.py b/src/statick_tool/statick_tool.py index fca9fdec..d92ee4d6 100644 --- a/src/statick_tool/statick_tool.py +++ b/src/statick_tool/statick_tool.py @@ -1,4 +1,5 @@ """Code analysis front-end.""" + import argparse import copy import io From 3beb69c4d876fbd77d0e59faf64c71320d2fb080 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 18 Apr 2024 16:52:37 -0700 Subject: [PATCH 31/58] More files to remove after testing with clean.sh script. Pin pytest. --- clean.sh | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clean.sh b/clean.sh index c5a89140..bb4d53d4 100644 --- a/clean.sh +++ b/clean.sh @@ -1,6 +1,6 @@ #!/bin/bash -rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log +rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log CMakeCache.txt CMakeFiles/ *.cmake Makefile CMakeLists.txt *.statick.json .coverage find . -type d -name .mypy_cache -exec rm -rf {} \; find . -type d -name .pytest_cache -exec rm -rf {} \; find . -type d -name .ruff_cache -exec rm -rf {} \; diff --git a/pyproject.toml b/pyproject.toml index 0e2d9eab..bab69e81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,7 +115,7 @@ test = [ "lark", "mock", "pylint-django", - "pytest", + "pytest==8.0.0", "pytest-cov", "tox", "tox-gh-actions", From 9410875560c696c5ba4c912e4e61ca2c52a3f215 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 22 Apr 2024 08:46:35 -0700 Subject: [PATCH 32/58] Update clean script. Add some pytest options. --- clean.sh | 2 +- pyproject.toml | 8 ++++++++ tox.ini | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/clean.sh b/clean.sh index c5a89140..fcc3cf24 100644 --- a/clean.sh +++ b/clean.sh @@ -1,6 +1,6 @@ #!/bin/bash -rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log +rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log CMake* *.cmake Makefile *.statick.json .cccc-example.cpp/ find . -type d -name .mypy_cache -exec rm -rf {} \; find . -type d -name .pytest_cache -exec rm -rf {} \; find . -type d -name .ruff_cache -exec rm -rf {} \; diff --git a/pyproject.toml b/pyproject.toml index 0e2d9eab..943ea0ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,14 @@ statick_tool = [ "rsc/plugin_mapping/*", ] +[tool.pytest.ini_options] +# addopts = [ +# "--import-mode=importlib", +# ] +pythonpath = [ + "src", +] + [project.entry-points."statick_tool.plugins.discovery"] c = "statick_tool.plugins.discovery.c:CDiscoveryPlugin" cmake = "statick_tool.plugins.discovery.cmake:CMakeDiscoveryPlugin" diff --git a/tox.ini b/tox.ini index f8dfdd78..6d25656c 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,6 @@ python = [testenv] changedir = {toxinidir}/output-{envname} -setenv = PY_IGNORE_IMPORTMISMATCH = 1 deps = .[test] commands = From afbcaa9e5e5398c3a7c304bef93fdcde3205f829 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 22 Apr 2024 08:58:10 -0700 Subject: [PATCH 33/58] Pin pytest. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 943ea0ea..38c5dc99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,7 +123,7 @@ test = [ "lark", "mock", "pylint-django", - "pytest", + "pytest==8.0.0", "pytest-cov", "tox", "tox-gh-actions", From adc91d183a7dbad598e7db6e6c9ff10179a15ad0 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 11:30:45 -0700 Subject: [PATCH 34/58] Ignore requirements.txt. Use pip-compile to generate that file locally. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a456aca3..3c66f5ac 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ build/ dist/ *.egg-info/ MANIFEST +requirements.txt docs/_build From 2791dabd4b439d7544659b00b17629be4cde5bbd Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 19:33:37 -0700 Subject: [PATCH 35/58] Rename test input files so they do not have the same filename for multiple tests. --- .../tool/do_nothing/test_do_nothing_tool_plugin.py | 4 ++-- .../valid_package/{basic.py => do_nothing_basic.py} | 0 tests/plugins/tool/pylint/test_pylint_tool_plugin.py | 12 ++++++------ .../valid_package/{basic.py => pylint_basic.py} | 0 4 files changed, 8 insertions(+), 8 deletions(-) rename tests/plugins/tool/do_nothing/valid_package/{basic.py => do_nothing_basic.py} (100%) rename tests/plugins/tool/pylint/valid_package/{basic.py => pylint_basic.py} (100%) diff --git a/tests/plugins/tool/do_nothing/test_do_nothing_tool_plugin.py b/tests/plugins/tool/do_nothing/test_do_nothing_tool_plugin.py index b3aaf4d5..fa62aed3 100644 --- a/tests/plugins/tool/do_nothing/test_do_nothing_tool_plugin.py +++ b/tests/plugins/tool/do_nothing/test_do_nothing_tool_plugin.py @@ -44,7 +44,7 @@ def test_do_nothing_tool_plugin_process_files(): "valid_package", os.path.join(os.path.dirname(__file__), "valid_package") ) package["python_src"] = [ - os.path.join(os.path.dirname(__file__), "valid_package", "basic.py") + os.path.join(os.path.dirname(__file__), "valid_package", "do_nothing_basic.py") ] output = plugin.process_files(package, "level", package["python_src"], []) assert not output @@ -53,6 +53,6 @@ def test_do_nothing_tool_plugin_process_files(): def test_do_nothing_tool_plugin_parse_output(): """Verify that we can parse the normal output of do_nothing.""" plugin = setup_do_nothing_tool_plugin() - output = "would reformat /home/user/valid_package/basic.py" + output = "would reformat /home/user/valid_package/do_nothing_basic.py" issues = plugin.parse_output([output]) assert not issues diff --git a/tests/plugins/tool/do_nothing/valid_package/basic.py b/tests/plugins/tool/do_nothing/valid_package/do_nothing_basic.py similarity index 100% rename from tests/plugins/tool/do_nothing/valid_package/basic.py rename to tests/plugins/tool/do_nothing/valid_package/do_nothing_basic.py diff --git a/tests/plugins/tool/pylint/test_pylint_tool_plugin.py b/tests/plugins/tool/pylint/test_pylint_tool_plugin.py index 5b5b103d..52fa273d 100644 --- a/tests/plugins/tool/pylint/test_pylint_tool_plugin.py +++ b/tests/plugins/tool/pylint/test_pylint_tool_plugin.py @@ -55,7 +55,7 @@ def test_pylint_tool_plugin_scan_valid(): "valid_package", os.path.join(os.path.dirname(__file__), "valid_package") ) package["python_src"] = [ - os.path.join(os.path.dirname(__file__), "valid_package", "basic.py") + os.path.join(os.path.dirname(__file__), "valid_package", "pylint_basic.py") ] issues = pltp.scan(package, "level") # We expect to have missing docstring and unused import warnings. @@ -71,7 +71,7 @@ def test_pylint_tool_plugin_scan_valid_max_cpu_cores(): "valid_package", os.path.join(os.path.dirname(__file__), "valid_package") ) package["python_src"] = [ - os.path.join(os.path.dirname(__file__), "valid_package", "basic.py") + os.path.join(os.path.dirname(__file__), "valid_package", "pylint_basic.py") ] issues = pltp.scan(package, "level") # We expect to have missing docstring and unused import warnings. @@ -81,21 +81,21 @@ def test_pylint_tool_plugin_scan_valid_max_cpu_cores(): def test_pylint_tool_plugin_parse_valid(): """Verify that we can parse the normal output of pylint.""" pltp = setup_pylint_tool_plugin() - output = "basic.py:1: [W0611(unused-import), ] Unused import subprocess" + output = "pylint_basic.py:1: [W0611(unused-import), ] Unused import subprocess" issues = pltp.parse_output([output]) assert len(issues) == 1 - assert issues[0].filename == "basic.py" + assert issues[0].filename == "pylint_basic.py" assert issues[0].line_number == "1" assert issues[0].tool == "pylint" assert issues[0].issue_type == "W0611(unused-import)" assert issues[0].severity == "5" assert issues[0].message == "Unused import subprocess" - output = "basic.py:1: [W0611(unused-import)] Unused import subprocess" + output = "pylint_basic.py:1: [W0611(unused-import)] Unused import subprocess" issues = pltp.parse_output([output]) assert issues[0].message == "Unused import subprocess" - output = "basic.py:1: [W0611(unused-import), not-empty] Unused import subprocess" + output = "pylint_basic.py:1: [W0611(unused-import), not-empty] Unused import subprocess" issues = pltp.parse_output([output]) assert issues[0].message == "not-empty: Unused import subprocess" diff --git a/tests/plugins/tool/pylint/valid_package/basic.py b/tests/plugins/tool/pylint/valid_package/pylint_basic.py similarity index 100% rename from tests/plugins/tool/pylint/valid_package/basic.py rename to tests/plugins/tool/pylint/valid_package/pylint_basic.py From 6555026b6638ab286063cfa64cbc178ab8d10d3a Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 19:36:13 -0700 Subject: [PATCH 36/58] Pull in fix from PR to main that fixes ruff tool command. --- src/statick_tool/plugins/tool/ruff.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/statick_tool/plugins/tool/ruff.py b/src/statick_tool/plugins/tool/ruff.py index 6141634a..86509485 100644 --- a/src/statick_tool/plugins/tool/ruff.py +++ b/src/statick_tool/plugins/tool/ruff.py @@ -26,8 +26,24 @@ def process_files( ) -> Optional[List[str]]: """Run tool and gather output.""" flags: List[str] = [] - flags += user_flags + # Ruff removed usage of plain ``ruff'' command in version 0.5.0. We need to make + # sure to use ``ruff check''. + try: + test_file: List[str] = [] + if files: + test_file.append(files[0]) + output = subprocess.check_output( + ["ruff"] + test_file, stderr=subprocess.STDOUT, universal_newlines=True + ) + except subprocess.CalledProcessError as ex: + logging.debug("Exception in first check of ruff, need to add check verb") + logging.debug(ex) + flags.append("check") + except OSError as ex: + logging.warning("Couldn't find ruff executable! (%s)", ex) + return None + flags += user_flags total_output: List[str] = [] try: @@ -35,14 +51,9 @@ def process_files( output = subprocess.check_output( subproc_args, stderr=subprocess.STDOUT, universal_newlines=True ) - except subprocess.CalledProcessError as ex: output = ex.output - except OSError as ex: - logging.warning("Couldn't find ruff executable! (%s)", ex) - return None - total_output.append(output) logging.debug("%s", total_output) From 040bdf38998a88337bfca8e07d93bee1665ebad3 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 19:42:59 -0700 Subject: [PATCH 37/58] Pull in another fix in PR to main. --- clean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clean.sh b/clean.sh index fcc3cf24..f82857df 100644 --- a/clean.sh +++ b/clean.sh @@ -1,6 +1,6 @@ #!/bin/bash -rm -rf build/ dist/ htmlcov/ output-py* .pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log CMake* *.cmake Makefile *.statick.json .cccc-example.cpp/ +rm -rf build/ dist/ htmlcov/ ./output-py* ./.pytest_cache src/statick.egg-info/ statick_output/* .tox/ ./*.log ./CMake* ./*.cmake Makefile ./*.statick.json .cccc-example.cpp/ find . -type d -name .mypy_cache -exec rm -rf {} \; find . -type d -name .pytest_cache -exec rm -rf {} \; find . -type d -name .ruff_cache -exec rm -rf {} \; From 85e5be634d27639a6d92445889e347870f131529 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 19:50:51 -0700 Subject: [PATCH 38/58] Bump versions of GitHub actions. --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c613a7a..54913e4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,14 +18,14 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: '16' - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -95,7 +95,7 @@ jobs: python -m tox - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: false From 20577991a2034ba61ed81b7bc457c07bc8245e53 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 20:18:33 -0700 Subject: [PATCH 39/58] Update more GitHub action versions. --- .github/workflows/publish.yaml | 4 ++-- .github/workflows/publish_docker_image.yaml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8ea101a5..15eefc4e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' @@ -43,7 +43,7 @@ jobs: docs-folder: 'docs/' - name: Publish documentation - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/build/html diff --git a/.github/workflows/publish_docker_image.yaml b/.github/workflows/publish_docker_image.yaml index 571ea943..17a91c1b 100644 --- a/.github/workflows/publish_docker_image.yaml +++ b/.github/workflows/publish_docker_image.yaml @@ -11,17 +11,17 @@ env: jobs: build-and-push-image: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -29,14 +29,14 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=semver,pattern={{version}} - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: context: docker push: true From 91c70241ecc26c26fdad85e422c187cab0978af6 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 21:13:57 -0700 Subject: [PATCH 40/58] Add ubuntu-24.04 to os list for testing. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54913e4a..d140a5ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-20.04, ubuntu-22.04, windows-latest] + os: [macos-latest, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-latest] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: From 94d2ec49381fe7aae5d0519b04dbd8541b3ca5ad Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 21:21:38 -0700 Subject: [PATCH 41/58] Use codecov token. --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d140a5ab..c2206899 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,6 +98,7 @@ jobs: uses: codecov/codecov-action@v4 with: fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} - name: Self check if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' From 68343406ea30a05f1db9e3dfa83a380e4aa4ca62 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Sat, 27 Jul 2024 22:04:29 -0700 Subject: [PATCH 42/58] Fix code coverage for discovery plugin dependency checks. --- tests/statick_tool/rsc/config-discovery-dependency.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/statick_tool/rsc/config-discovery-dependency.yaml b/tests/statick_tool/rsc/config-discovery-dependency.yaml index 905cf7ff..914d59e7 100644 --- a/tests/statick_tool/rsc/config-discovery-dependency.yaml +++ b/tests/statick_tool/rsc/config-discovery-dependency.yaml @@ -1,6 +1,8 @@ levels: custom: discovery: - - cmake + # We want to check that a dependency is not run a second time if it runs before the plugin that depends on it. + - ros # Put ros first so it runs before cmake. + - cmake # Put cmake second since it depends on ros. The ros plugin should not run twice. tool: - do_nothing From 92802e7d3714560f4fcb63a71ed018754f4909e4 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 29 Jul 2024 06:05:14 -0700 Subject: [PATCH 43/58] Remove commented out pytest option. --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 99faf928..7b30db8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,9 +56,6 @@ statick_tool = [ ] [tool.pytest.ini_options] -# addopts = [ -# "--import-mode=importlib", -# ] pythonpath = [ "src", ] From f5d448ea3745952c03ac63cc4e73f1745f940047 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 14 Oct 2024 15:56:04 -0700 Subject: [PATCH 44/58] Add Python 3.13 to list for testing and support. --- .github/workflows/test.yml | 2 +- pyproject.toml | 1 + tox.ini | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 42819388..f06686a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-latest] - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 701491a1..8f004841 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Testing", ] dependencies = [ diff --git a/tox.ini b/tox.ini index cbd74663..70799a4b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py39, py310, py311, py312 +envlist = py39, py310, py311, py312, py313 skip_missing_interpreters = true [pytest] @@ -11,6 +11,7 @@ python = 3.10: py310 3.11: py311 3.12: py312 + 3.13: py313 [testenv] changedir = {toxinidir}/output-{envname} From c4a9cb57ff49055ae55673775042512c846613a2 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 14 Oct 2024 16:06:55 -0700 Subject: [PATCH 45/58] Update readme unit test commands to include src/. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b28dd2d7..20dc73f1 100644 --- a/README.md +++ b/README.md @@ -847,14 +847,14 @@ If you have a unit test file at `tests/my_module/test_my_module.py` you can easi and save yourself a lot of time during development. ```shell -python3 -m pytest --cov=statick_tool/ tests/my_module/test_my_module.py +python3 -m pytest --cov=src/statick_tool/ tests/my_module/test_my_module.py ``` To run all the tests and get a report with branch coverage specify the `tests` directory. Any subdirectory will run all the tests in that subdirectory. ```shell -python3 -m pytest --cov=statick_tool/ --cov-report term-missing --cov-report html --cov-branch tests/ +python3 -m pytest --cov=src/statick_tool/ --cov-report term-missing --cov-report html --cov-branch tests/ ``` ### Mypy From 65c10f19377a5fb4c3c5be16d5e9801ed55de10f Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 14 Oct 2024 20:40:47 -0700 Subject: [PATCH 46/58] Fix unit test and type hints. --- src/statick_tool/plugins/discovery/ros.py | 2 +- tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/statick_tool/plugins/discovery/ros.py b/src/statick_tool/plugins/discovery/ros.py index fbf29398..f5559aa9 100644 --- a/src/statick_tool/plugins/discovery/ros.py +++ b/src/statick_tool/plugins/discovery/ros.py @@ -24,7 +24,7 @@ def deep_get( cls, dictionary: Union[str, Dict[Any, str]], keys: str, - default: Optional[str] = None, + default: str = "", ) -> Any: """Safe way to check for a value in a nested dict. diff --git a/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py b/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py index b81cf1a6..b7b98657 100644 --- a/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py +++ b/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py @@ -90,7 +90,7 @@ def test_cpplint_tool_plugin_scan_valid(): package["cpplint"] = "cpplint" issues = ctp.scan(package, "level") print(f"Line: {issues[2].message}") - assert len(issues) == 4 + assert len(issues) == 5 assert issues[2].filename == os.path.join( os.path.dirname(__file__), "valid_package", "test.c" ) From 40a124f725479fab91fee70d8975f2789cb64ca7 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 14 Oct 2024 21:12:42 -0700 Subject: [PATCH 47/58] Drop Python 3.8. --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8f004841..fbff5897 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,12 +8,11 @@ authors = [{name = "NIWC Pacific"}] description="Making code quality easier." version = "0.9.5" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" license = {text = "CC0-1.0"} classifiers = [ "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", From a8b4a212f7317f3854fa7a7a056dc73650f64f8e Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Tue, 15 Oct 2024 06:33:34 -0700 Subject: [PATCH 48/58] Black formatting. --- src/statick_tool/plugins/tool/clang_format.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/statick_tool/plugins/tool/clang_format.py b/src/statick_tool/plugins/tool/clang_format.py index 3717b43e..891dde87 100644 --- a/src/statick_tool/plugins/tool/clang_format.py +++ b/src/statick_tool/plugins/tool/clang_format.py @@ -157,11 +157,14 @@ def check_configuration(self, clang_format_bin: str) -> Optional[bool]: if not os.path.isfile(os.path.expanduser("~/" + default_file_name)): default_file_name = ".clang-format" - with open( - os.path.expanduser("~/" + default_file_name), "r", encoding="utf8" - ) as home_format_file, open( - format_file_name, "r", encoding="utf8" # type: ignore - ) as format_file: + with ( + open( + os.path.expanduser("~/" + default_file_name), "r", encoding="utf8" + ) as home_format_file, + open( + format_file_name, "r", encoding="utf8" # type: ignore + ) as format_file, + ): actual_format = home_format_file.read() target_format = format_file.read() diff = difflib.context_diff( From fca629bb37ee3585cfd37b02ed6ba70829be84e5 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 2 Jan 2025 17:12:33 -0800 Subject: [PATCH 49/58] Run more CI steps on Ubuntu 24.04. --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f06686a9..79c13eb5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: # Remove apt repos that are known to break from time to time. # See https://github.com/actions/virtual-environments/issues/323 - name: Remove broken apt repos [Ubuntu] - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' run: | for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done @@ -79,13 +79,13 @@ jobs: # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. # - name: Statick markdown - # if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' + # if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' # run: | # pip install statick-md # statick . --check --profile documentation.yaml - name: Sphinx lint - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu.22.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' uses: ammaraskar/sphinx-action@master with: docs-folder: 'docs/' @@ -101,7 +101,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Self check - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' run: | mkdir statick-output statick . --output-directory statick-output --check --profile self_check.yaml --log INFO From 9d408c176fa089431da1f344099405b5df28bc43 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 2 Jan 2025 17:17:32 -0800 Subject: [PATCH 50/58] Fix typo in CI. --- .github/workflows/test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 79c13eb5..1aa2cd4f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,12 +40,12 @@ jobs: # Remove apt repos that are known to break from time to time. # See https://github.com/actions/virtual-environments/issues/323 - name: Remove broken apt repos [Ubuntu] - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' run: | for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - name: Install tools (Linux) - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' run: | sudo apt-get update sudo apt-get install cccc @@ -68,7 +68,7 @@ jobs: sudo apt-get install clang-tidy-14 - name: Install node tools - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' run: | npm install -g markdownlint-cli@0.21.0 npm install -g npm-groovy-lint @@ -79,13 +79,13 @@ jobs: # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. # - name: Statick markdown - # if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' + # if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' # run: | # pip install statick-md # statick . --check --profile documentation.yaml - name: Sphinx lint - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' uses: ammaraskar/sphinx-action@master with: docs-folder: 'docs/' @@ -101,7 +101,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Self check - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04 || matrix.os == 'ubuntu-24.04' + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' run: | mkdir statick-output statick . --output-directory statick-output --check --profile self_check.yaml --log INFO From 331db09574dfdf3cac6ae80440f9800eafd61550 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 2 Jan 2025 18:10:14 -0800 Subject: [PATCH 51/58] Make new function to get version of cppcheck binary. Use that to fix unit test with different outcomes based on version of cppcheck. --- pyproject.toml | 1 + src/statick_tool/plugins/tool/cppcheck.py | 53 ++++++++++++------- .../cppcheck/test_cppcheck_tool_plugin.py | 12 +++-- 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fbff5897..9c0b3e0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dependencies = [ "isort", "lizard", "mypy", + "packaging", "pycodestyle", "pydocstyle", "pyflakes", diff --git a/src/statick_tool/plugins/tool/cppcheck.py b/src/statick_tool/plugins/tool/cppcheck.py index ee237f5e..df4eee14 100644 --- a/src/statick_tool/plugins/tool/cppcheck.py +++ b/src/statick_tool/plugins/tool/cppcheck.py @@ -7,6 +7,8 @@ import subprocess from typing import List, Match, Optional, Pattern +from packaging.version import Version + from statick_tool.issue import Issue from statick_tool.package import Package from statick_tool.tool_plugin import ToolPlugin @@ -32,6 +34,26 @@ def gather_args(self, args: argparse.Namespace) -> None: "--cppcheck-bin", dest="cppcheck_bin", type=str, help="cppcheck binary path" ) + @classmethod + def get_version(cls, cppcheck_bin: str) -> str: + """Get version of tool. + + If no version is found the function returns "0.0". + """ + version = "0.0" + output = subprocess.check_output( + [cppcheck_bin, "--version"], + stderr=subprocess.STDOUT, + universal_newlines=True, + ) + ver_re = r"(.+) ([0-9]*\.?[0-9]+)" + parse: Pattern[str] = re.compile(ver_re) + match: Optional[Match[str]] = parse.match(output) + if match: + version = match.group(2) + + return version + # pylint: disable=too-many-locals, too-many-branches, too-many-return-statements def scan(self, package: Package, level: str) -> Optional[List[Issue]]: """Run tool and gather output.""" @@ -57,26 +79,17 @@ def scan(self, package: Package, level: str) -> Optional[List[Issue]]: cppcheck_bin = self.plugin_context.args.cppcheck_bin try: - output = subprocess.check_output( - [cppcheck_bin, "--version"], - stderr=subprocess.STDOUT, - universal_newlines=True, - ) - ver_re = r"(.+) ([0-9]*\.?[0-9]+)" - parse: Pattern[str] = re.compile(ver_re) - match: Optional[Match[str]] = parse.match(output) - if match: - ver = float(match.group(2)) - # If specific version is not specified just use the installed version. - if user_version is not None and ver != float(user_version): - logging.warning( - "You need version %s of cppcheck, but you have %s. " - "See README.md for instuctions on how to install the " - "proper version", - user_version, - match.group(2), - ) - return None + version = self.get_version(cppcheck_bin) + # If specific version is not specified just use the installed version. + if user_version is not None and Version(version) != Version(user_version): + logging.warning( + "You need version %s of cppcheck, but you have %s. " + "See README.md for instructions on how to install the " + "proper version", + user_version, + version, + ) + return None except OSError as ex: logging.warning("Cppcheck not found! (%s)", ex) diff --git a/tests/plugins/tool/cppcheck/test_cppcheck_tool_plugin.py b/tests/plugins/tool/cppcheck/test_cppcheck_tool_plugin.py index 3c480dae..c681075a 100644 --- a/tests/plugins/tool/cppcheck/test_cppcheck_tool_plugin.py +++ b/tests/plugins/tool/cppcheck/test_cppcheck_tool_plugin.py @@ -1,12 +1,14 @@ """Unit tests for the cppcheck plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest +from packaging.version import Version + import statick_tool from statick_tool.config import Config from statick_tool.package import Package @@ -80,7 +82,11 @@ def test_cppcheck_tool_plugin_scan_valid(): ) assert issues[0].line_number == "4" assert issues[0].tool == "cppcheck" - assert issues[0].issue_type == "error/uninitvar" + version = cctp.get_version("cppcheck") + if Version(version) >= Version("2.8"): + assert issues[0].issue_type == "error/legacyUninitvar" + else: + assert issues[0].issue_type == "error/uninitvar" assert issues[0].severity == "5" assert issues[0].message == "Uninitialized variable: si" From 61adf34a72cfc6e7ab9ca9f813fdba3aea0a8366 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 2 Jan 2025 18:13:13 -0800 Subject: [PATCH 52/58] Run isort on all unit test files (but not ones with intentional errors). --- tests/exceptions/test_exceptions.py | 3 +-- tests/plugins/discovery/perl/test_perl_discovery_plugin.py | 3 ++- .../discovery/python/test_python_discovery_plugin.py | 3 ++- .../plugins/discovery/shell/test_shell_discovery_plugin.py | 3 ++- tests/plugins/tool/bandit/test_bandit_tool_plugin.py | 3 ++- tests/plugins/tool/black/test_black_tool_plugin.py | 5 +++-- .../tool/catkin-lint/test_catkin-lint_tool_plugin.py | 5 +++-- tests/plugins/tool/cccc/test_cccc_tool_plugin.py | 5 +++-- .../tool/clang-format/test_clang-format_tool_plugin.py | 7 ++++--- .../plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py | 5 +++-- tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py | 3 ++- tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py | 5 +++-- .../tool/docformatter/test_docformatter_tool_plugin.py | 5 +++-- .../plugins/tool/flawfinder/test_flawfinder_tool_plugin.py | 5 +++-- .../plugins/tool/groovylint/test_groovylint_tool_plugin.py | 5 +++-- tests/plugins/tool/isort/test_isort_tool_plugin.py | 5 +++-- tests/plugins/tool/lizard/test_lizard_tool_plugin.py | 3 ++- tests/plugins/tool/make/test_make_tool_plugin.py | 5 +++-- tests/plugins/tool/mypy/test_mypy_tool_plugin.py | 5 +++-- .../plugins/tool/perlcritic/test_perlcritic_tool_plugin.py | 5 +++-- .../tool/pycodestyle/test_pycodestyle_tool_plugin.py | 3 ++- .../plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py | 3 ++- tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py | 3 ++- tests/plugins/tool/pylint/test_pylint_tool_plugin.py | 3 ++- tests/plugins/tool/ruff/test_ruff_tool_plugin.py | 3 ++- .../plugins/tool/shellcheck/test_shellcheck_tool_plugin.py | 5 +++-- tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py | 5 +++-- .../plugins/tool/uncrustify/test_uncrustify_tool_plugin.py | 5 +++-- tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py | 5 +++-- tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py | 3 ++- tests/resources/test_resources.py | 3 +-- tests/tool_plugin/test_tool_plugin.py | 3 +-- 32 files changed, 79 insertions(+), 53 deletions(-) diff --git a/tests/exceptions/test_exceptions.py b/tests/exceptions/test_exceptions.py index bace0429..4113bee7 100644 --- a/tests/exceptions/test_exceptions.py +++ b/tests/exceptions/test_exceptions.py @@ -2,6 +2,7 @@ import os import tempfile +from tempfile import TemporaryDirectory import pytest @@ -9,8 +10,6 @@ from statick_tool.issue import Issue from statick_tool.package import Package -from tempfile import TemporaryDirectory - def test_exceptions_init_valid(): """Test that the Exceptions module initializes correctly. diff --git a/tests/plugins/discovery/perl/test_perl_discovery_plugin.py b/tests/plugins/discovery/perl/test_perl_discovery_plugin.py index e858ccf7..fdeba61c 100644 --- a/tests/plugins/discovery/perl/test_perl_discovery_plugin.py +++ b/tests/plugins/discovery/perl/test_perl_discovery_plugin.py @@ -2,9 +2,10 @@ import contextlib import os -import pytest import sys +import pytest + from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.perl import PerlDiscoveryPlugin diff --git a/tests/plugins/discovery/python/test_python_discovery_plugin.py b/tests/plugins/discovery/python/test_python_discovery_plugin.py index d955dea3..da36d555 100644 --- a/tests/plugins/discovery/python/test_python_discovery_plugin.py +++ b/tests/plugins/discovery/python/test_python_discovery_plugin.py @@ -2,9 +2,10 @@ import contextlib import os -import pytest import sys +import pytest + from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.python import PythonDiscoveryPlugin diff --git a/tests/plugins/discovery/shell/test_shell_discovery_plugin.py b/tests/plugins/discovery/shell/test_shell_discovery_plugin.py index 19c5d54a..990e966e 100644 --- a/tests/plugins/discovery/shell/test_shell_discovery_plugin.py +++ b/tests/plugins/discovery/shell/test_shell_discovery_plugin.py @@ -2,9 +2,10 @@ import contextlib import os -import pytest import sys +import pytest + from statick_tool.exceptions import Exceptions from statick_tool.package import Package from statick_tool.plugins.discovery.shell import ShellDiscoveryPlugin diff --git a/tests/plugins/tool/bandit/test_bandit_tool_plugin.py b/tests/plugins/tool/bandit/test_bandit_tool_plugin.py index 86b70bb6..b6ae67fc 100644 --- a/tests/plugins/tool/bandit/test_bandit_tool_plugin.py +++ b/tests/plugins/tool/bandit/test_bandit_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the bandit tool module.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/black/test_black_tool_plugin.py b/tests/plugins/tool/black/test_black_tool_plugin.py index e67f5478..b2cb963f 100644 --- a/tests/plugins/tool/black/test_black_tool_plugin.py +++ b/tests/plugins/tool/black/test_black_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the black plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/catkin-lint/test_catkin-lint_tool_plugin.py b/tests/plugins/tool/catkin-lint/test_catkin-lint_tool_plugin.py index 653c5186..03028f4c 100644 --- a/tests/plugins/tool/catkin-lint/test_catkin-lint_tool_plugin.py +++ b/tests/plugins/tool/catkin-lint/test_catkin-lint_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the catkin_lint tool plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/cccc/test_cccc_tool_plugin.py b/tests/plugins/tool/cccc/test_cccc_tool_plugin.py index 393d054f..0f596250 100644 --- a/tests/plugins/tool/cccc/test_cccc_tool_plugin.py +++ b/tests/plugins/tool/cccc/test_cccc_tool_plugin.py @@ -2,12 +2,13 @@ from __future__ import print_function import argparse -import mock import os -import pytest import shutil import subprocess import sys + +import mock +import pytest import xmltodict import statick_tool diff --git a/tests/plugins/tool/clang-format/test_clang-format_tool_plugin.py b/tests/plugins/tool/clang-format/test_clang-format_tool_plugin.py index 14a5f0f2..7d215f61 100644 --- a/tests/plugins/tool/clang-format/test_clang-format_tool_plugin.py +++ b/tests/plugins/tool/clang-format/test_clang-format_tool_plugin.py @@ -1,20 +1,21 @@ """Unit tests for the clang-format plugin.""" import argparse -import mock import os -import pytest import shutil import subprocess import sys from xml.etree import ElementTree +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package from statick_tool.plugin_context import PluginContext -from statick_tool.plugins.tool.clang_format_parser import ClangFormatXMLParser from statick_tool.plugins.tool.clang_format import ClangFormatToolPlugin +from statick_tool.plugins.tool.clang_format_parser import ClangFormatXMLParser from statick_tool.resources import Resources if sys.version_info < (3, 10): diff --git a/tests/plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py b/tests/plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py index 2ae882ac..f6483461 100644 --- a/tests/plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py +++ b/tests/plugins/tool/clang-tidy/test_clang-tidy_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the clang-tidy plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py b/tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py index 3da20e08..411e81ec 100644 --- a/tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py +++ b/tests/plugins/tool/cmakelint/test_cmakelint_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for cmakelint plugin.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py b/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py index 055094d4..add52b4d 100644 --- a/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py +++ b/tests/plugins/tool/cpplint/test_cpplint_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the cpplint plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/docformatter/test_docformatter_tool_plugin.py b/tests/plugins/tool/docformatter/test_docformatter_tool_plugin.py index 710c6a3e..6c5a25f9 100644 --- a/tests/plugins/tool/docformatter/test_docformatter_tool_plugin.py +++ b/tests/plugins/tool/docformatter/test_docformatter_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the docformatter plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/flawfinder/test_flawfinder_tool_plugin.py b/tests/plugins/tool/flawfinder/test_flawfinder_tool_plugin.py index 5cd4c538..9d8df4d1 100644 --- a/tests/plugins/tool/flawfinder/test_flawfinder_tool_plugin.py +++ b/tests/plugins/tool/flawfinder/test_flawfinder_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the flawfinder plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/groovylint/test_groovylint_tool_plugin.py b/tests/plugins/tool/groovylint/test_groovylint_tool_plugin.py index 591ab78b..62f9fce0 100644 --- a/tests/plugins/tool/groovylint/test_groovylint_tool_plugin.py +++ b/tests/plugins/tool/groovylint/test_groovylint_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the groovylint plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/isort/test_isort_tool_plugin.py b/tests/plugins/tool/isort/test_isort_tool_plugin.py index a6f5e424..3a5a62b9 100644 --- a/tests/plugins/tool/isort/test_isort_tool_plugin.py +++ b/tests/plugins/tool/isort/test_isort_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the isort plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/lizard/test_lizard_tool_plugin.py b/tests/plugins/tool/lizard/test_lizard_tool_plugin.py index 04bea72a..675878d5 100644 --- a/tests/plugins/tool/lizard/test_lizard_tool_plugin.py +++ b/tests/plugins/tool/lizard/test_lizard_tool_plugin.py @@ -1,10 +1,11 @@ """Unit tests for the lizard plugin.""" import argparse -import pytest import os import sys +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/make/test_make_tool_plugin.py b/tests/plugins/tool/make/test_make_tool_plugin.py index e2727af7..2aa763f3 100644 --- a/tests/plugins/tool/make/test_make_tool_plugin.py +++ b/tests/plugins/tool/make/test_make_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the make tool plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/mypy/test_mypy_tool_plugin.py b/tests/plugins/tool/mypy/test_mypy_tool_plugin.py index e596cc0b..351746fa 100644 --- a/tests/plugins/tool/mypy/test_mypy_tool_plugin.py +++ b/tests/plugins/tool/mypy/test_mypy_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the mypy plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/perlcritic/test_perlcritic_tool_plugin.py b/tests/plugins/tool/perlcritic/test_perlcritic_tool_plugin.py index da2184b4..1f3fcfc0 100644 --- a/tests/plugins/tool/perlcritic/test_perlcritic_tool_plugin.py +++ b/tests/plugins/tool/perlcritic/test_perlcritic_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the perlcritic plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/pycodestyle/test_pycodestyle_tool_plugin.py b/tests/plugins/tool/pycodestyle/test_pycodestyle_tool_plugin.py index 88e260db..66e11953 100644 --- a/tests/plugins/tool/pycodestyle/test_pycodestyle_tool_plugin.py +++ b/tests/plugins/tool/pycodestyle/test_pycodestyle_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the pycodestyle plugin.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py b/tests/plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py index d14cc9e5..22894cfc 100644 --- a/tests/plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py +++ b/tests/plugins/tool/pydocstyle/test_pydocstyle_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the PyCodeStyle plugin.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py b/tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py index 9be383c1..81d7b2ef 100644 --- a/tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py +++ b/tests/plugins/tool/pyflakes/test_pyflakes_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the Pyflakes plugin.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/pylint/test_pylint_tool_plugin.py b/tests/plugins/tool/pylint/test_pylint_tool_plugin.py index 52fa273d..b41144a8 100644 --- a/tests/plugins/tool/pylint/test_pylint_tool_plugin.py +++ b/tests/plugins/tool/pylint/test_pylint_tool_plugin.py @@ -2,11 +2,12 @@ import argparse import multiprocessing -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/ruff/test_ruff_tool_plugin.py b/tests/plugins/tool/ruff/test_ruff_tool_plugin.py index 8d22335b..f2f4d46f 100644 --- a/tests/plugins/tool/ruff/test_ruff_tool_plugin.py +++ b/tests/plugins/tool/ruff/test_ruff_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the ruff plugin.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/shellcheck/test_shellcheck_tool_plugin.py b/tests/plugins/tool/shellcheck/test_shellcheck_tool_plugin.py index 482e153d..a78ce54b 100644 --- a/tests/plugins/tool/shellcheck/test_shellcheck_tool_plugin.py +++ b/tests/plugins/tool/shellcheck/test_shellcheck_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the Shellcheck tool plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py b/tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py index ec88607d..56465e50 100644 --- a/tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py +++ b/tests/plugins/tool/spotbugs/test_spotbugs_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the spotbugs plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/uncrustify/test_uncrustify_tool_plugin.py b/tests/plugins/tool/uncrustify/test_uncrustify_tool_plugin.py index 42aebd98..b429741e 100644 --- a/tests/plugins/tool/uncrustify/test_uncrustify_tool_plugin.py +++ b/tests/plugins/tool/uncrustify/test_uncrustify_tool_plugin.py @@ -1,12 +1,13 @@ """Unit tests for the uncrustify plugin.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py b/tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py index 2cbedfef..901627ff 100644 --- a/tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py +++ b/tests/plugins/tool/xmllint/test_xmllint_tool_plugin.py @@ -1,12 +1,13 @@ """xmllint unit tests.""" import argparse -import mock import os -import pytest import subprocess import sys +import mock +import pytest + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py b/tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py index 68ce900b..96b4f38f 100644 --- a/tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py +++ b/tests/plugins/tool/yamllint/test_yamllint_tool_plugin.py @@ -1,11 +1,12 @@ """Unit tests for the YAMLLint tool plugin.""" import argparse -import mock import os import subprocess import sys +import mock + import statick_tool from statick_tool.config import Config from statick_tool.package import Package diff --git a/tests/resources/test_resources.py b/tests/resources/test_resources.py index 08ced973..a750c6b6 100644 --- a/tests/resources/test_resources.py +++ b/tests/resources/test_resources.py @@ -3,12 +3,11 @@ import logging import os import tempfile +from tempfile import TemporaryDirectory import statick_tool from statick_tool.resources import Resources -from tempfile import TemporaryDirectory - LOGGER = logging.getLogger(__name__) diff --git a/tests/tool_plugin/test_tool_plugin.py b/tests/tool_plugin/test_tool_plugin.py index b8cb9b55..f6c0ed36 100644 --- a/tests/tool_plugin/test_tool_plugin.py +++ b/tests/tool_plugin/test_tool_plugin.py @@ -5,6 +5,7 @@ import stat import sys import tempfile +from tempfile import TemporaryDirectory import pytest @@ -13,8 +14,6 @@ from statick_tool.resources import Resources from statick_tool.tool_plugin import ToolPlugin -from tempfile import TemporaryDirectory - def test_tool_plugin_load_mapping_valid(): """Test that we can load the warnings mapping.""" From 6d45c74f11f7141b67c0d5065622fa508ebec545 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Thu, 2 Jan 2025 19:17:32 -0800 Subject: [PATCH 53/58] Update changelog. --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b258cda1..e0160bbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased -Removed support for Python 3.8. +- Removed support for Python 3.8. +- Added support for Python 3.12 and 3.13. +- Switched from yapsy to setuptools for plugin mechanism. (#508) ### Added +- Use of `pyproject.toml` instead of `setup.py` and `requirements.txt`. - Allow short flag names. (#489, @qdang922) - `--output-directory` supports `-o` - `--user-paths` supports `-u` @@ -34,6 +37,8 @@ Removed support for Python 3.8. - Ignore new pylint finding for too many positional arguments. Finding showed up with pylint 3.3.0. - Change default value of deep get method to match valid type for reduce function. +- Run `isort` on unit test files. +- Handle updated warning type from `cppcheck` introduced in version 2.8. ## v0.9.4 - 2022-04-25 From cd5f09beff78dc63d3202f9145d00081e08e4a6d Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 3 Jan 2025 09:46:31 -0800 Subject: [PATCH 54/58] Fix README. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 20dc73f1..a78a7472 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,6 @@ Each _tool_ plugin provides the types of files it can analyze, then the output o determine the specific files that should be analyzed by each tool. The _tool_ plugin can also specify any other tools that are required to run before the current tool can act. -For example, `cppcheck` depends on the output of the `make` tool. The _tool_ plugin then scans each package by invoking the binary associated with the tool. The output of the scan is parsed to generate the list of issues discovered by Statick. From 7f946dbc44f21f26dacfc8dc6aa0e6457655f7d6 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 3 Jan 2025 10:01:24 -0800 Subject: [PATCH 55/58] Unpin pytest version. Simplify pip install command. --- .github/workflows/test.yml | 4 +--- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1aa2cd4f..8f3ab505 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,9 +33,7 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install . - pip install .[test] - pip install .[docs] + pip install .[docs,test] # Remove apt repos that are known to break from time to time. # See https://github.com/actions/virtual-environments/issues/323 diff --git a/pyproject.toml b/pyproject.toml index 9c0b3e0b..3942469f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,7 +121,7 @@ test = [ "lark", "mock", "pylint-django", - "pytest==8.0.0", + "pytest", "pytest-cov", "tox", "tox-gh-actions", From 9696360029a860612e0a814219937e3d91b97a9c Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 3 Jan 2025 12:16:55 -0800 Subject: [PATCH 56/58] Update version number. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3942469f..e4335e01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "statick" authors = [{name = "NIWC Pacific"}] description="Making code quality easier." -version = "0.9.5" +version = "0.11.0" readme = "README.md" requires-python = ">=3.9" license = {text = "CC0-1.0"} From 9443df2af5c00ada9cd24a62d4cf84bcfc8c9c0b Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Fri, 3 Jan 2025 12:18:57 -0800 Subject: [PATCH 57/58] Update version. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e4335e01..1fffd69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "statick" authors = [{name = "NIWC Pacific"}] description="Making code quality easier." -version = "0.11.0" +version = "0.10.0" readme = "README.md" requires-python = ">=3.9" license = {text = "CC0-1.0"} From cdefe5514b4ce56b299f70763badf3e66931efd4 Mon Sep 17 00:00:00 2001 From: Thomas Denewiler Date: Mon, 6 Jan 2025 08:53:44 -0800 Subject: [PATCH 58/58] Use runner.os to simplify Linux-specific action steps. --- .github/workflows/test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f3ab505..d977bf08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,12 +38,12 @@ jobs: # Remove apt repos that are known to break from time to time. # See https://github.com/actions/virtual-environments/issues/323 - name: Remove broken apt repos [Ubuntu] - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' + if: runner.os == 'Linux' run: | for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - name: Install tools (Linux) - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' + if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install cccc @@ -66,7 +66,7 @@ jobs: sudo apt-get install clang-tidy-14 - name: Install node tools - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' + if: runner.os == 'Linux' run: | npm install -g markdownlint-cli@0.21.0 npm install -g npm-groovy-lint @@ -77,13 +77,13 @@ jobs: # Re-enable this step when statick-md switches from yapsy to entry points plugin approach. # - name: Statick markdown - # if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' + # if: runner.os == 'Linux' # run: | # pip install statick-md # statick . --check --profile documentation.yaml - name: Sphinx lint - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' + if: runner.os == 'Linux' uses: ammaraskar/sphinx-action@master with: docs-folder: 'docs/' @@ -99,7 +99,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Self check - if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' + if: runner.os == 'Linux' run: | mkdir statick-output statick . --output-directory statick-output --check --profile self_check.yaml --log INFO