lintro 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lintro might be problematic. Click here for more details.
- {lintro-0.7.0/lintro.egg-info → lintro-0.8.0}/PKG-INFO +1 -1
- {lintro-0.7.0 → lintro-0.8.0}/assets/images/coverage-badge.svg +3 -3
- {lintro-0.7.0 → lintro-0.8.0}/lintro/__init__.py +1 -1
- {lintro-0.7.0 → lintro-0.8.0}/lintro/cli.py +6 -0
- lintro-0.8.0/lintro/enums/__init__.py +1 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/darglint_strictness.py +10 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/hadolint_enums.py +22 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/yamllint_format.py +11 -0
- lintro-0.8.0/lintro/exceptions/__init__.py +1 -0
- lintro-0.8.0/lintro/formatters/__init__.py +1 -0
- lintro-0.8.0/lintro/formatters/core/__init__.py +1 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/core/output_style.py +11 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/core/table_descriptor.py +8 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/csv.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/grid.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/html.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/json.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/markdown.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/plain.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/black_formatter.py +27 -5
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/darglint_formatter.py +16 -1
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/hadolint_formatter.py +13 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/prettier_formatter.py +15 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/ruff_formatter.py +16 -1
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/yamllint_formatter.py +14 -1
- lintro-0.8.0/lintro/models/__init__.py +1 -0
- lintro-0.8.0/lintro/models/core/__init__.py +1 -0
- lintro-0.8.0/lintro/models/core/tool_config.py +27 -0
- lintro-0.8.0/lintro/parsers/darglint/__init__.py +1 -0
- lintro-0.8.0/lintro/parsers/darglint/darglint_issue.py +20 -0
- lintro-0.8.0/lintro/parsers/prettier/__init__.py +1 -0
- lintro-0.8.0/lintro/parsers/prettier/prettier_issue.py +22 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/ruff/ruff_parser.py +6 -2
- lintro-0.8.0/lintro/parsers/yamllint/__init__.py +1 -0
- lintro-0.8.0/lintro/tools/core/__init__.py +1 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/core/tool_base.py +32 -6
- lintro-0.8.0/lintro/tools/implementations/__init__.py +1 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_bandit.py +11 -22
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_darglint.py +3 -1
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/tool_enum.py +2 -0
- lintro-0.8.0/lintro/utils/__init__.py +1 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/ascii_normalize_cli.py +5 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/tool_utils.py +6 -10
- {lintro-0.7.0 → lintro-0.8.0/lintro.egg-info}/PKG-INFO +1 -1
- {lintro-0.7.0 → lintro-0.8.0}/lintro.egg-info/SOURCES.txt +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/pyproject.toml +6 -3
- {lintro-0.7.0 → lintro-0.8.0}/tests/conftest.py +2 -2
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_darglint_integration.py +21 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_prettier_integration.py +8 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_ruff_black_policy.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_ruff_integration.py +1 -2
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_extract_version.py +21 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_ghcr_prune_untagged.py +30 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_github_comment_utilities.py +1 -3
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_script_environment.py +3 -3
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_semantic_release_compute_next.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_ascii_normalize.py +8 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_bandit_command_building.py +3 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_bandit_config_hydration.py +10 -1
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_black_formatter.py +5 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_black_parser.py +5 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_black_tool.py +32 -1
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_black_tool_more.py +7 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_cli_commands.py +3 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_cli_commands_more.py +17 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_cli_programmatic.py +17 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_compatibility_ruff_black.py +79 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_config_loader.py +8 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_config_loader_more.py +6 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_console_logger.py +14 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_console_logger_more.py +7 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_enums_and_normalizers.py +6 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_exceptions.py +3 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_formatters_tables.py +22 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_output_manager_reports.py +27 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_parsers_actionlint.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_ruff_parser_additional.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_ruff_parser_more.py +7 -1
- lintro-0.8.0/tests/unit/test_subprocess_validator.py +78 -0
- lintro-0.8.0/tests/unit/test_tool_base_subprocess.py +93 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_executor.py +146 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_executor_fmt_exclusion.py +1 -1
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_executor_post_checks.py +42 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_manager.py +9 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_utils.py +14 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_utils_fallbacks.py +2 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_utils_more.py +12 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/utils/test_output_manager.py +28 -0
- lintro-0.7.0/lintro/enums/__init__.py +0 -0
- lintro-0.7.0/lintro/exceptions/__init__.py +0 -0
- lintro-0.7.0/lintro/formatters/__init__.py +0 -0
- lintro-0.7.0/lintro/formatters/core/__init__.py +0 -0
- lintro-0.7.0/lintro/models/__init__.py +0 -0
- lintro-0.7.0/lintro/models/core/__init__.py +0 -0
- lintro-0.7.0/lintro/models/core/tool_config.py +0 -23
- lintro-0.7.0/lintro/parsers/darglint/__init__.py +0 -0
- lintro-0.7.0/lintro/parsers/darglint/darglint_issue.py +0 -9
- lintro-0.7.0/lintro/parsers/prettier/__init__.py +0 -0
- lintro-0.7.0/lintro/parsers/prettier/prettier_issue.py +0 -10
- lintro-0.7.0/lintro/parsers/yamllint/__init__.py +0 -0
- lintro-0.7.0/lintro/tools/core/__init__.py +0 -0
- lintro-0.7.0/lintro/tools/implementations/__init__.py +0 -0
- lintro-0.7.0/lintro/utils/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/LICENSE +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/MANIFEST.in +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/README.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/assets/images/lintro.png +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/README.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/configuration.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/contributing.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/coverage-setup.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/docker.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/getting-started.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/github-integration.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/lintro-self-use.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/security/assurance.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/security/requirements.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/style-guide.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/README.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/actionlint-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/bandit-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/black-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/darglint-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/hadolint-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/prettier-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/ruff-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/docs/tool-analysis/yamllint-analysis.md +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/__main__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/ascii-art/fail.txt +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/ascii-art/success.txt +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/cli_utils/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/cli_utils/commands/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/cli_utils/commands/check.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/cli_utils/commands/format.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/cli_utils/commands/list_tools.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/action.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/group_by.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/output_format.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/tool_name.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/enums/tool_type.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/exceptions/errors.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/styles/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/actionlint_formatter.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/formatters/tools/bandit_formatter.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/models/core/tool.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/models/core/tool_result.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/actionlint/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/actionlint/actionlint_issue.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/actionlint/actionlint_parser.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/black/black_issue.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/black/black_parser.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/darglint/darglint_parser.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/hadolint/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/hadolint/hadolint_issue.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/hadolint/hadolint_parser.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/prettier/prettier_parser.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/ruff/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/ruff/ruff_issue.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/yamllint/yamllint_issue.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/parsers/yamllint/yamllint_parser.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/core/tool_manager.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_actionlint.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_black.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_hadolint.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_prettier.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_ruff.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/tools/implementations/tool_yamllint.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/config.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/console_logger.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/formatting.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/output_manager.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/path_utils.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro/utils/tool_executor.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro.egg-info/dependency_links.txt +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro.egg-info/entry_points.txt +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro.egg-info/requires.txt +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/lintro.egg-info/top_level.txt +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/setup.cfg +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/Dockerfile.violations +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/actionlint_violations.yml +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/bandit_violations.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/darglint_violations.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/prettier_violations.js +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/ruff_black_e501_wrappable.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/ruff_clean.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/ruff_violations.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/test_samples/yaml_violations.yml +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/cli/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/cli/conftest.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/cli/test_cli.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/formatters/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/formatters/conftest.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/formatters/test_formatters.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/conftest.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_actionlint_integration.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_bandit_integration.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_hadolint_integration.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/integration/test_yamllint_integration.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_ci_post_pr_comment.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_delete_previous_lintro_comments.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/scripts/test_shell_scripts.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/test_documentation.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_bandit_formatter_mapping.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_bandit_parsing.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/unit/test_tool_executor_more.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/utils/__init__.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/utils/conftest.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/utils/test_formatting.py +0 -0
- {lintro-0.7.0 → lintro-0.8.0}/tests/utils/test_path_utils.py +0 -0
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
</clipPath>
|
|
10
10
|
<g clip-path="url(#a)">
|
|
11
11
|
<path fill="#555" d="M0 0h63v20H0z"/>
|
|
12
|
-
<path fill="#
|
|
12
|
+
<path fill="#4c1" d="M63 0h36v20H63z"/>
|
|
13
13
|
<path fill="url(#b)" d="M0 0h99v20H0z"/>
|
|
14
14
|
</g>
|
|
15
15
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
|
16
16
|
<text x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">coverage</text>
|
|
17
17
|
<text x="325" y="140" transform="scale(.1)" textLength="530">coverage</text>
|
|
18
|
-
<text x="800" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="260">83.
|
|
19
|
-
<text x="800" y="140" transform="scale(.1)" textLength="260">83.
|
|
18
|
+
<text x="800" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="260">83.9%</text>
|
|
19
|
+
<text x="800" y="140" transform="scale(.1)" textLength="260">83.9%</text>
|
|
20
20
|
</g>
|
|
21
21
|
</svg>
|
|
@@ -9,6 +9,12 @@ from lintro.cli_utils.commands.list_tools import list_tools_command
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class LintroGroup(click.Group):
|
|
12
|
+
"""Custom Click group with enhanced help rendering.
|
|
13
|
+
|
|
14
|
+
This group prints command aliases alongside their canonical names to make
|
|
15
|
+
the CLI help output more discoverable.
|
|
16
|
+
"""
|
|
17
|
+
|
|
12
18
|
def format_commands(
|
|
13
19
|
self,
|
|
14
20
|
ctx: click.Context,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Enumeration types used throughout the Lintro codebase."""
|
|
@@ -6,6 +6,8 @@ from enum import StrEnum, auto
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class DarglintStrictness(StrEnum):
|
|
9
|
+
"""Strictness levels recognized by Darglint checks."""
|
|
10
|
+
|
|
9
11
|
SHORT = auto()
|
|
10
12
|
LONG = auto()
|
|
11
13
|
FULL = auto()
|
|
@@ -14,6 +16,14 @@ class DarglintStrictness(StrEnum):
|
|
|
14
16
|
def normalize_darglint_strictness(
|
|
15
17
|
value: str | DarglintStrictness,
|
|
16
18
|
) -> DarglintStrictness:
|
|
19
|
+
"""Normalize a strictness value, defaulting to FULL on error.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
value: String or enum member representing strictness.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
DarglintStrictness: Normalized strictness enum value.
|
|
26
|
+
"""
|
|
17
27
|
if isinstance(value, DarglintStrictness):
|
|
18
28
|
return value
|
|
19
29
|
try:
|
|
@@ -6,6 +6,8 @@ from enum import StrEnum, auto
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class HadolintFormat(StrEnum):
|
|
9
|
+
"""Supported output formats for Hadolint."""
|
|
10
|
+
|
|
9
11
|
TTY = auto()
|
|
10
12
|
JSON = auto()
|
|
11
13
|
CHECKSTYLE = auto()
|
|
@@ -18,6 +20,8 @@ class HadolintFormat(StrEnum):
|
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
class HadolintFailureThreshold(StrEnum):
|
|
23
|
+
"""Hadolint failure thresholds used to gate exit status."""
|
|
24
|
+
|
|
21
25
|
ERROR = auto()
|
|
22
26
|
WARNING = auto()
|
|
23
27
|
INFO = auto()
|
|
@@ -27,6 +31,15 @@ class HadolintFailureThreshold(StrEnum):
|
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
def normalize_hadolint_format(value: str | HadolintFormat) -> HadolintFormat:
|
|
34
|
+
"""Normalize user input to a HadolintFormat.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
value: Existing enum member or string name of the format.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
HadolintFormat: Canonical enum value, defaulting to ``TTY`` when
|
|
41
|
+
parsing fails.
|
|
42
|
+
"""
|
|
30
43
|
if isinstance(value, HadolintFormat):
|
|
31
44
|
return value
|
|
32
45
|
try:
|
|
@@ -38,6 +51,15 @@ def normalize_hadolint_format(value: str | HadolintFormat) -> HadolintFormat:
|
|
|
38
51
|
def normalize_hadolint_threshold(
|
|
39
52
|
value: str | HadolintFailureThreshold,
|
|
40
53
|
) -> HadolintFailureThreshold:
|
|
54
|
+
"""Normalize user input to a HadolintFailureThreshold.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
value: Existing enum member or string name of the threshold.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
HadolintFailureThreshold: Canonical enum value, defaulting to ``INFO``
|
|
61
|
+
when parsing fails.
|
|
62
|
+
"""
|
|
41
63
|
if isinstance(value, HadolintFailureThreshold):
|
|
42
64
|
return value
|
|
43
65
|
try:
|
|
@@ -6,6 +6,8 @@ from enum import StrEnum, auto
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class YamllintFormat(StrEnum):
|
|
9
|
+
"""Output styles supported by Yamllint's CLI."""
|
|
10
|
+
|
|
9
11
|
PARSABLE = auto()
|
|
10
12
|
STANDARD = auto()
|
|
11
13
|
COLORED = auto()
|
|
@@ -14,6 +16,15 @@ class YamllintFormat(StrEnum):
|
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
def normalize_yamllint_format(value: str | YamllintFormat) -> YamllintFormat:
|
|
19
|
+
"""Normalize a value to a YamllintFormat enum member.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
value: Existing enum member or string name of the format.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
YamllintFormat: Canonical enum value, defaulting to ``PARSABLE`` when
|
|
26
|
+
parsing fails.
|
|
27
|
+
"""
|
|
17
28
|
if isinstance(value, YamllintFormat):
|
|
18
29
|
return value
|
|
19
30
|
try:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Project-specific exception classes and error helpers."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Formatters for converting tool outputs into human-friendly tables."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Core formatting abstractions for tool-agnostic table rendering."""
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
"""Output style abstraction for rendering tabular data.
|
|
2
|
+
|
|
3
|
+
Defines a minimal interface consumed by format-specific implementations.
|
|
4
|
+
"""
|
|
5
|
+
|
|
1
6
|
from abc import ABC, abstractmethod
|
|
2
7
|
from typing import Any
|
|
3
8
|
|
|
4
9
|
|
|
5
10
|
class OutputStyle(ABC):
|
|
11
|
+
"""Abstract base class for output style renderers.
|
|
12
|
+
|
|
13
|
+
Implementations convert tabular data into a concrete textual
|
|
14
|
+
representation (e.g., grid, markdown, plain).
|
|
15
|
+
"""
|
|
16
|
+
|
|
6
17
|
@abstractmethod
|
|
7
18
|
def format(
|
|
8
19
|
self,
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
"""Interfaces for describing table columns and rows for tool issues."""
|
|
2
|
+
|
|
1
3
|
from abc import ABC, abstractmethod
|
|
2
4
|
from typing import Any
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
class TableDescriptor(ABC):
|
|
8
|
+
"""Describe how to extract tabular data for a tool's issues.
|
|
9
|
+
|
|
10
|
+
Concrete implementations define column ordering and how to map issue
|
|
11
|
+
objects into a list of column values.
|
|
12
|
+
"""
|
|
13
|
+
|
|
6
14
|
@abstractmethod
|
|
7
15
|
def get_columns(self) -> list[str]:
|
|
8
16
|
"""Return the list of column names in order."""
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from lintro.formatters.core.table_descriptor import TableDescriptor
|
|
6
5
|
from lintro.formatters.styles.csv import CsvStyle
|
|
7
6
|
from lintro.formatters.styles.grid import GridStyle
|
|
8
7
|
from lintro.formatters.styles.html import HtmlStyle
|
|
9
8
|
from lintro.formatters.styles.json import JsonStyle
|
|
10
9
|
from lintro.formatters.styles.markdown import MarkdownStyle
|
|
11
10
|
from lintro.formatters.styles.plain import PlainStyle
|
|
12
|
-
from lintro.parsers.black.black_issue import BlackIssue
|
|
13
11
|
from lintro.utils.path_utils import normalize_file_path_for_display
|
|
14
12
|
|
|
15
13
|
FORMAT_MAP = {
|
|
@@ -22,11 +20,26 @@ FORMAT_MAP = {
|
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
|
|
25
|
-
class BlackTableDescriptor
|
|
23
|
+
class BlackTableDescriptor:
|
|
24
|
+
"""Column layout for Black issues in tabular output."""
|
|
25
|
+
|
|
26
26
|
def get_columns(self) -> list[str]:
|
|
27
|
+
"""Return ordered column headers for Black output rows.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
list[str]: Column names for the formatted table.
|
|
31
|
+
"""
|
|
27
32
|
return ["File", "Message"]
|
|
28
33
|
|
|
29
|
-
def get_rows(self, issues: list
|
|
34
|
+
def get_rows(self, issues: list) -> list[list[str]]:
|
|
35
|
+
"""Return formatted rows for Black issues.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
issues: Parsed Black issues to render.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
list[list[str]]: Table rows with normalized file paths and messages.
|
|
42
|
+
"""
|
|
30
43
|
rows: list[list[str]] = []
|
|
31
44
|
for issue in issues:
|
|
32
45
|
rows.append(
|
|
@@ -38,7 +51,16 @@ class BlackTableDescriptor(TableDescriptor):
|
|
|
38
51
|
return rows
|
|
39
52
|
|
|
40
53
|
|
|
41
|
-
def format_black_issues(issues
|
|
54
|
+
def format_black_issues(issues, format: str) -> str:
|
|
55
|
+
"""Format Black issues according to the chosen style.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
issues: Parsed Black issues.
|
|
59
|
+
format: Output style identifier.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
str: Rendered table string.
|
|
63
|
+
"""
|
|
42
64
|
descriptor = BlackTableDescriptor()
|
|
43
65
|
formatter = FORMAT_MAP.get(format, GridStyle())
|
|
44
66
|
columns = descriptor.get_columns()
|
|
@@ -21,13 +21,28 @@ FORMAT_MAP = {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class DarglintTableDescriptor(TableDescriptor):
|
|
24
|
+
"""Describe columns and rows for Darglint issues."""
|
|
25
|
+
|
|
24
26
|
def get_columns(self) -> list[str]:
|
|
27
|
+
"""Return column headers for the Darglint issues table.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
list[str]: Column names for the formatted table.
|
|
31
|
+
"""
|
|
25
32
|
return ["File", "Line", "Code", "Message"]
|
|
26
33
|
|
|
27
34
|
def get_rows(
|
|
28
35
|
self,
|
|
29
36
|
issues: list[DarglintIssue],
|
|
30
37
|
) -> list[list[str]]:
|
|
38
|
+
"""Return rows for the Darglint table.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
issues: Parsed Darglint issues to format.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
list[list[str]]: Table rows with normalized path, line, code, message.
|
|
45
|
+
"""
|
|
31
46
|
rows = []
|
|
32
47
|
for issue in issues:
|
|
33
48
|
rows.append(
|
|
@@ -52,7 +67,7 @@ def format_darglint_issues(
|
|
|
52
67
|
format: Output format (plain, grid, markdown, html, json, csv).
|
|
53
68
|
|
|
54
69
|
Returns:
|
|
55
|
-
Formatted string representation of the issues.
|
|
70
|
+
str: Formatted string representation of the issues.
|
|
56
71
|
"""
|
|
57
72
|
descriptor = DarglintTableDescriptor()
|
|
58
73
|
columns = descriptor.get_columns()
|
|
@@ -19,6 +19,11 @@ class HadolintTableDescriptor(TableDescriptor):
|
|
|
19
19
|
"""Describe hadolint issue columns and row extraction."""
|
|
20
20
|
|
|
21
21
|
def get_columns(self) -> list[str]:
|
|
22
|
+
"""Return ordered column headers for the Hadolint table.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
list[str]: Column names for the formatted table.
|
|
26
|
+
"""
|
|
22
27
|
return [
|
|
23
28
|
"File",
|
|
24
29
|
"Line",
|
|
@@ -32,6 +37,14 @@ class HadolintTableDescriptor(TableDescriptor):
|
|
|
32
37
|
self,
|
|
33
38
|
issues: list[HadolintIssue],
|
|
34
39
|
) -> list[list[Any]]:
|
|
40
|
+
"""Return rows for the Hadolint issues table.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
issues: Parsed Hadolint issues to render.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
list[list[Any]]: Table rows with normalized file path and fields.
|
|
47
|
+
"""
|
|
35
48
|
rows: list[list[Any]] = []
|
|
36
49
|
for issue in issues:
|
|
37
50
|
rows.append(
|
|
@@ -21,13 +21,28 @@ FORMAT_MAP = {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class PrettierTableDescriptor(TableDescriptor):
|
|
24
|
+
"""Describe columns and rows for Prettier issues."""
|
|
25
|
+
|
|
24
26
|
def get_columns(self) -> list[str]:
|
|
27
|
+
"""Return ordered column headers for the Prettier table.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
list[str]: Column names for the formatted table.
|
|
31
|
+
"""
|
|
25
32
|
return ["File", "Line", "Column", "Code", "Message"]
|
|
26
33
|
|
|
27
34
|
def get_rows(
|
|
28
35
|
self,
|
|
29
36
|
issues: list[PrettierIssue],
|
|
30
37
|
) -> list[list[str]]:
|
|
38
|
+
"""Return rows for the Prettier issues table.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
issues: Parsed Prettier issues to render.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
list[list[str]]: Table rows with normalized file path and fields.
|
|
45
|
+
"""
|
|
31
46
|
rows = []
|
|
32
47
|
for issue in issues:
|
|
33
48
|
rows.append(
|
|
@@ -21,13 +21,28 @@ FORMAT_MAP = {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class RuffTableDescriptor(TableDescriptor):
|
|
24
|
+
"""Describe columns and rows for Ruff issues."""
|
|
25
|
+
|
|
24
26
|
def get_columns(self) -> list[str]:
|
|
27
|
+
"""Return ordered column headers for the Ruff table.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
list[str]: Column names for the formatted table.
|
|
31
|
+
"""
|
|
25
32
|
return ["File", "Line", "Column", "Code", "Message"]
|
|
26
33
|
|
|
27
34
|
def get_rows(
|
|
28
35
|
self,
|
|
29
36
|
issues: list[RuffIssue | RuffFormatIssue],
|
|
30
37
|
) -> list[list[str]]:
|
|
38
|
+
"""Return rows for the Ruff issues table.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
issues: Parsed Ruff issues to render.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
list[list[str]]: Table rows with normalized file path and fields.
|
|
45
|
+
"""
|
|
31
46
|
rows = []
|
|
32
47
|
for issue in issues:
|
|
33
48
|
if isinstance(issue, RuffIssue):
|
|
@@ -69,7 +84,7 @@ def format_ruff_issues(
|
|
|
69
84
|
format: Output format (plain, grid, markdown, html, json, csv).
|
|
70
85
|
|
|
71
86
|
Returns:
|
|
72
|
-
Formatted string (one or two tables depending on format).
|
|
87
|
+
str: Formatted string (one or two tables depending on format).
|
|
73
88
|
"""
|
|
74
89
|
descriptor = RuffTableDescriptor()
|
|
75
90
|
formatter = FORMAT_MAP.get(format, GridStyle())
|
|
@@ -19,6 +19,11 @@ class YamllintTableDescriptor(TableDescriptor):
|
|
|
19
19
|
"""Describe yamllint issue columns and row extraction."""
|
|
20
20
|
|
|
21
21
|
def get_columns(self) -> list[str]:
|
|
22
|
+
"""Return ordered column headers for the Yamllint table.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
list[str]: Column names for the formatted table.
|
|
26
|
+
"""
|
|
22
27
|
return [
|
|
23
28
|
"File",
|
|
24
29
|
"Line",
|
|
@@ -32,6 +37,14 @@ class YamllintTableDescriptor(TableDescriptor):
|
|
|
32
37
|
self,
|
|
33
38
|
issues: list[YamllintIssue],
|
|
34
39
|
) -> list[list[Any]]:
|
|
40
|
+
"""Return rows for the Yamllint issues table.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
issues: Parsed Yamllint issues to render.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
list[list[Any]]: Table rows with normalized file path and fields.
|
|
47
|
+
"""
|
|
35
48
|
rows: list[list[Any]] = []
|
|
36
49
|
for issue in issues:
|
|
37
50
|
rows.append(
|
|
@@ -61,7 +74,7 @@ def format_yamllint_issues(
|
|
|
61
74
|
tool_name: Tool name for JSON metadata.
|
|
62
75
|
|
|
63
76
|
Returns:
|
|
64
|
-
Rendered string for the issues table.
|
|
77
|
+
str: Rendered string for the issues table.
|
|
65
78
|
"""
|
|
66
79
|
descriptor = YamllintTableDescriptor()
|
|
67
80
|
columns = descriptor.get_columns()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Model package containing issue types and configuration structures."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Core data models used across tool integrations."""
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Core model for tool configuration used by Lintro tools."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
|
|
5
|
+
from lintro.enums.tool_type import ToolType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class ToolConfig:
|
|
10
|
+
"""Configuration container for a tool.
|
|
11
|
+
|
|
12
|
+
This dataclass defines the static configuration associated with a tool,
|
|
13
|
+
including its priority, file targeting, type flags, and default options.
|
|
14
|
+
|
|
15
|
+
Attributes:
|
|
16
|
+
priority: int: Priority used when ordering tools.
|
|
17
|
+
conflicts_with: list[str]: Names of tools that conflict with this one.
|
|
18
|
+
file_patterns: list[str]: Glob patterns to select applicable files.
|
|
19
|
+
tool_type: ToolType: Bitmask describing tool capabilities.
|
|
20
|
+
options: dict[str, object]: Default tool options applied at runtime.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
priority: int = 0
|
|
24
|
+
conflicts_with: list[str] = field(default_factory=list)
|
|
25
|
+
file_patterns: list[str] = field(default_factory=list)
|
|
26
|
+
tool_type: ToolType = ToolType.LINTER
|
|
27
|
+
options: dict[str, object] = field(default_factory=dict)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Parsing utilities and types for Darglint output."""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Typed structure representing a single Darglint issue."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class DarglintIssue:
|
|
8
|
+
"""Simple container for Darglint findings.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
file: File path where the issue occurred.
|
|
12
|
+
line: Line number of the issue.
|
|
13
|
+
code: Darglint error code.
|
|
14
|
+
message: Human-readable description of the issue.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
file: str
|
|
18
|
+
line: int
|
|
19
|
+
code: str
|
|
20
|
+
message: str
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Parsing utilities and types for Prettier output."""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Typed structure representing a single Prettier issue."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class PrettierIssue:
|
|
8
|
+
"""Simple container for Prettier findings.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
file: File path where the issue occurred.
|
|
12
|
+
line: Line number, if provided by Prettier.
|
|
13
|
+
code: Tool-specific code identifying the rule.
|
|
14
|
+
message: Human-readable description of the issue.
|
|
15
|
+
column: Column number, if provided by Prettier.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
file: str
|
|
19
|
+
line: int | None
|
|
20
|
+
code: str
|
|
21
|
+
message: str
|
|
22
|
+
column: int | None = None
|
|
@@ -129,8 +129,12 @@ def parse_ruff_format_check_output(output: str) -> list[str]:
|
|
|
129
129
|
if not output:
|
|
130
130
|
return []
|
|
131
131
|
files = []
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
import re
|
|
133
|
+
|
|
134
|
+
ansi_re = re.compile(r"\x1b\[[0-9;]*m")
|
|
135
|
+
for raw in output.splitlines():
|
|
136
|
+
# Strip ANSI color codes for stable parsing across environments
|
|
137
|
+
line = ansi_re.sub("", raw).strip()
|
|
134
138
|
# Ruff format --check output: 'Would reformat: path/to/file.py' or
|
|
135
139
|
# 'Would reformat path/to/file.py'
|
|
136
140
|
if line.startswith("Would reformat: "):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Parsing utilities and types for Yamllint output."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Base classes and utilities for tool implementations."""
|
|
@@ -147,6 +147,9 @@ class BaseTool(ABC):
|
|
|
147
147
|
TimeoutExpired: If command times out.
|
|
148
148
|
FileNotFoundError: If command executable is not found.
|
|
149
149
|
"""
|
|
150
|
+
# Validate command arguments for safety prior to execution
|
|
151
|
+
self._validate_subprocess_command(cmd=cmd)
|
|
152
|
+
|
|
150
153
|
try:
|
|
151
154
|
result = subprocess.run( # nosec B603 - args list, shell=False
|
|
152
155
|
cmd,
|
|
@@ -157,7 +160,6 @@ class BaseTool(ABC):
|
|
|
157
160
|
"timeout",
|
|
158
161
|
self._default_timeout,
|
|
159
162
|
),
|
|
160
|
-
check=False,
|
|
161
163
|
cwd=cwd,
|
|
162
164
|
)
|
|
163
165
|
return result.returncode == 0, result.stdout + result.stderr
|
|
@@ -184,6 +186,31 @@ class BaseTool(ABC):
|
|
|
184
186
|
f"Please ensure it is installed and in your PATH.",
|
|
185
187
|
) from e
|
|
186
188
|
|
|
189
|
+
def _validate_subprocess_command(self, cmd: list[str]) -> None:
|
|
190
|
+
"""Validate a subprocess command argument list for safety.
|
|
191
|
+
|
|
192
|
+
Ensures that the command is a non-empty list of strings and that no
|
|
193
|
+
argument contains shell metacharacters that could enable command
|
|
194
|
+
injection when passed to subprocess (even with ``shell=False``).
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
cmd: list[str]: Command and arguments to validate.
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
ValueError: If the command list is empty, contains non-strings,
|
|
201
|
+
or contains unsafe characters.
|
|
202
|
+
"""
|
|
203
|
+
if not cmd or not isinstance(cmd, list):
|
|
204
|
+
raise ValueError("Command must be a non-empty list of strings")
|
|
205
|
+
|
|
206
|
+
unsafe_chars: set[str] = {";", "&", "|", ">", "<", "`", "$", "\\", "\n", "\r"}
|
|
207
|
+
|
|
208
|
+
for arg in cmd:
|
|
209
|
+
if not isinstance(arg, str):
|
|
210
|
+
raise ValueError("All command arguments must be strings")
|
|
211
|
+
if any(ch in arg for ch in unsafe_chars):
|
|
212
|
+
raise ValueError("Unsafe character detected in command argument")
|
|
213
|
+
|
|
187
214
|
def set_options(self, **kwargs) -> None:
|
|
188
215
|
"""Set core options.
|
|
189
216
|
|
|
@@ -233,11 +260,10 @@ class BaseTool(ABC):
|
|
|
233
260
|
self,
|
|
234
261
|
paths: list[str],
|
|
235
262
|
) -> str | None:
|
|
236
|
-
"""Return the common parent directory for the given paths
|
|
237
|
-
applicable.
|
|
263
|
+
"""Return the common parent directory for the given paths.
|
|
238
264
|
|
|
239
265
|
Args:
|
|
240
|
-
paths: list[str]:
|
|
266
|
+
paths: list[str]: Paths to compute a common parent directory for.
|
|
241
267
|
|
|
242
268
|
Returns:
|
|
243
269
|
str | None: Common parent directory path, or None if not applicable.
|
|
@@ -300,10 +326,10 @@ class BaseTool(ABC):
|
|
|
300
326
|
if tool_name in python_tools_prefer_uv:
|
|
301
327
|
if shutil.which(tool_name):
|
|
302
328
|
return [tool_name]
|
|
303
|
-
if shutil.which("uv"):
|
|
304
|
-
return ["uv", "run", tool_name]
|
|
305
329
|
if shutil.which("uvx"):
|
|
306
330
|
return ["uvx", tool_name]
|
|
331
|
+
if shutil.which("uv"):
|
|
332
|
+
return ["uv", "run", tool_name]
|
|
307
333
|
return [tool_name]
|
|
308
334
|
|
|
309
335
|
# Default: prefer direct system executable (node/binary tools like
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Concrete tool integrations (Ruff, Black, Prettier, etc.)."""
|