syntopica-codeality-py 0.2.3__tar.gz → 0.2.5__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.
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/CHANGELOG.md +32 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/LICENSE +1 -1
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/PKG-INFO +19 -2
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/README.md +17 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/pyproject.toml +2 -2
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/assets/codeality-py-ci.yml +1 -1
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/assets/pyproject-sections.toml +1 -1
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/baseline_config.py +3 -0
- syntopica_codeality_py-0.2.5/src/codeality_py/config/environment_test_budget.py +36 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/load_config.py +12 -1
- syntopica_codeality_py-0.2.5/src/codeality_py/gate/budget_note.py +13 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/build_stage_result.py +2 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/gate_stages.py +1 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/over_budget_detail.py +2 -1
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/run_stage.py +8 -1
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/stage.py +2 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/stage_result.py +2 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/render_gate_report.py +6 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/stage_document.py +2 -0
- syntopica_codeality_py-0.2.5/src/codeality_py/rules/entrypoint_unit_findings.py +19 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/one_primary_unit.py +3 -0
- syntopica_codeality_py-0.2.5/src/codeality_py/units/snake_case_word.py +22 -0
- syntopica_codeality_py-0.2.5/src/codeality_py/units/to_snake_case.py +14 -0
- syntopica_codeality_py-0.2.5/tests/commands/test_gate_command.py +19 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/config/test_load_config.py +43 -3
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/gate/test_gate_stages.py +16 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/gate/test_run_gate.py +28 -2
- syntopica_codeality_py-0.2.5/tests/report/test_render_gate_report.py +45 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_one_primary_unit.py +14 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/units/test_to_snake_case.py +6 -0
- syntopica_codeality_py-0.2.5/uv.lock +1138 -0
- syntopica_codeality_py-0.2.3/src/codeality_py/units/to_snake_case.py +0 -20
- syntopica_codeality_py-0.2.3/uv.lock +0 -1061
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/.gitignore +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/codeality-py.toml +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/mypy.ini +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/ruff.toml +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/assets/codeality-py.toml +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/assets/importlinter.ini +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/assets/mypy.ini +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/assets/ruff.toml +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/baseline_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/classified_findings.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/classify_findings.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/finding_context.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/fingerprint.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/fingerprint_context.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/read_baseline.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/baseline/write_baseline.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/cli.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/baseline_check_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/baseline_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/baseline_update_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/check_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/checked_project.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/gate_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/init_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/commands/project_option.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/check_schema_version.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/config_error.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/default_generated_globs.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/discover_source_roots.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/discover_test_roots.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/limits.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/module_role.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/override.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/parse_overrides.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/parse_roles.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/parse_rule_codes.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/pyproject_layout_hints.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/read_config_document.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/reject_duplicate_role_claims.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/reject_unknown_keys.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/engine/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/engine/check_project.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/engine/check_result.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/engine/check_source_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/engine/fingerprint_findings.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/engine/rule_registry.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/gate_result.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/run_gate.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/stage_kind.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/stage_status.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/add_missing_rules.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/apply_init.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/current_branch.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/first_party_packages.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/has_ruff_table.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/managed_asset_files.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/managed_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/merge_pyproject_sections.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/merge_quality_group.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/merge_ruff_config.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/plan_asset_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/plan_disposition.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/plan_init.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/plan_pyproject.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/plan_ruff.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/plan_shadowed_ruff.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/python_floor_minor.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/read_asset.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/read_requires_python.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/render_asset.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/render_nested_workflow.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/repository_root.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/init/workflow_target.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/model/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/model/finding.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/model/location.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/model/rule_code.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/model/severity.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/parsing/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/parsing/infrastructure_error.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/parsing/parse_source_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/parsing/read_source_text.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/parsing/source_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/parsing/syntax_error_finding.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/exit_code.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/finding_document.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/findings_summary.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/render_json_report.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/report/render_text_report.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/roles/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/roles/assign_module_role.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/roles/compile_glob.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/roles/matches_any_pattern.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/roles/matches_glob.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/roles/test_file_patterns.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/barrel_only_init.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/count_code_lines.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/data_unit_findings.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/docstring_line_spans.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/file_matches_unit.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/grab_bag_names.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/is_allowed_barrel_statement.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/is_column_list.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/is_docstring_statement.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/is_sql_literal.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/is_static_dunder_assignment.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/is_type_checking_block.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/joined_string_text.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/looks_like_sql.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/max_file_lines.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/no_grab_bag_names.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/no_inline_sql.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/ordinary_unit_findings.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/sql_subject.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/rules/unit_finding.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/apply_suppressions.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/build_suppression.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/covering_suppression.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/is_overridden.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/parse_suppression_line.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/parse_suppressions.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/suppression/suppression.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/traversal/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/traversal/collect_source_files.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/traversal/default_excludes.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/traversal/gitignore_matcher.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/traversal/walk_root.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/__init__.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/coalesce_overloads.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/coalesce_singledispatch.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/collect_declarations.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/count_primary_declarations.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/declaration.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/declaration_for.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/declaration_kind.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/decorator_name.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/decorator_names.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/is_main_guard.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/is_private_local_handler.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/legacy_type_alias.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/literal_string_names.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/merge_stray_letters.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/named_declaration.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/overload_family_length.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/resolve_exported_names.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/units/top_level_statements.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/baseline/test_classify_findings.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/commands/test_baseline_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/commands/test_check_command.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/config/test_pyproject_layout_hints.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/conftest.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/init/test_merge_ruff_config.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/init/test_plan_init.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/init/test_render_asset.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/model/test_finding.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/model/test_rule_code.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/parsing/test_parse_source_file.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/roles/test_assign_module_role.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/roles/test_matches_glob.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_barrel_only_init.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_file_matches_unit.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_max_file_lines.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_no_grab_bag_names.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_no_inline_sql.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/test_cli_version.py +0 -0
- {syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/traversal/test_collect_source_files.py +0 -0
|
@@ -4,6 +4,38 @@ All notable changes to `syntopica-codeality-py` are documented here. The format
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 0.2.5
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- `BPY002` keeps the underscores a name already has: `is_a_step` belongs in
|
|
12
|
+
`is_a_step.py`, no longer `is_astep.py`. Only a letter left alone by the
|
|
13
|
+
case-boundary split (the `o` of `OAuth`) is folded into the next word.
|
|
14
|
+
- A plural acronym is one word: `URLs` belongs in `urls.py` and
|
|
15
|
+
`DownloadedURLsSQL` in `downloaded_urls_sql.py`, not `ur_ls.py`. A one-letter
|
|
16
|
+
interface prefix (`IFileHandler` to `ifile_handler.py`) is unchanged: it
|
|
17
|
+
cannot be told apart from `OAuthClient`.
|
|
18
|
+
- `BPY001` accepts an `entrypoint` module that declares nothing: a `__main__.py`
|
|
19
|
+
that imports its entry function and calls it under the `__main__` guard is the
|
|
20
|
+
shape the role exists for. Two declarations are still reported.
|
|
21
|
+
|
|
22
|
+
## 0.2.4
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `CODEALITY_PY_TEST_BUDGET_SECONDS` overrides `test-budget-seconds` for one
|
|
27
|
+
run. The budget is a regression guard tuned to the developer's machine, and a
|
|
28
|
+
suite that takes 75 s there took 292-347 s on GitHub's 4-core runners, where
|
|
29
|
+
Python 3.11 and 3.13 fall back to coverage's slow tracer (spectalive/qlctool,
|
|
30
|
+
2026-09-25); the only fix was to raise the committed number and blunt the
|
|
31
|
+
guard everywhere. Unset or empty, nothing changes; a value that is not a
|
|
32
|
+
positive integer is a configuration error (exit 2).
|
|
33
|
+
- The pytest stage says which budget applied and where it came from: its text
|
|
34
|
+
line ends in `[budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS]`, a passing
|
|
35
|
+
stage's detail carries the same note, the over-budget header names the source,
|
|
36
|
+
and `gate --json` gains `budget_seconds` and `budget_source` on every stage
|
|
37
|
+
(`null` when unbudgeted).
|
|
38
|
+
|
|
7
39
|
## 0.2.3
|
|
8
40
|
|
|
9
41
|
### Added
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: syntopica-codeality-py
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Structural linter and config scaffolder for Python: atomic files, placement, size caps, no inline SQL
|
|
5
5
|
Project-URL: Homepage, https://github.com/syntopica/codeality
|
|
6
6
|
Project-URL: Issues, https://github.com/syntopica/codeality/issues
|
|
7
7
|
Author: Cristian Deluxe
|
|
8
8
|
License: MIT License
|
|
9
9
|
|
|
10
|
-
Copyright (c)
|
|
10
|
+
Copyright (c) Syntopica
|
|
11
11
|
|
|
12
12
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
13
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -95,6 +95,23 @@ procedure - profile, make the unit under test cheaper, parallelise, serialise
|
|
|
95
95
|
what must stay shared - is in
|
|
96
96
|
[docs/standards/testing.md](https://github.com/syntopica/codeality/blob/main/docs/standards/testing.md#suite-time-budget).
|
|
97
97
|
|
|
98
|
+
The budget is tuned to the machine the suite is developed on. A slower
|
|
99
|
+
environment, such as a CI runner, sets its own for the run instead of raising
|
|
100
|
+
the committed number for everyone:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
# .github/workflows/quality.yml
|
|
104
|
+
env:
|
|
105
|
+
CODEALITY_PY_TEST_BUDGET_SECONDS: '600'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
When `CODEALITY_PY_TEST_BUDGET_SECONDS` is set it replaces
|
|
109
|
+
`test-budget-seconds`; unset or empty, it changes nothing. A value that is not a
|
|
110
|
+
positive integer is a configuration error (exit 2), never silently ignored. The
|
|
111
|
+
pytest stage names the budget it was held to and where it came from -
|
|
112
|
+
`budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS` - in its text line, its
|
|
113
|
+
detail, and the `budget_seconds` and `budget_source` fields of `gate --json`.
|
|
114
|
+
|
|
98
115
|
## Exit codes
|
|
99
116
|
|
|
100
117
|
| Code | Meaning |
|
|
@@ -52,6 +52,23 @@ procedure - profile, make the unit under test cheaper, parallelise, serialise
|
|
|
52
52
|
what must stay shared - is in
|
|
53
53
|
[docs/standards/testing.md](https://github.com/syntopica/codeality/blob/main/docs/standards/testing.md#suite-time-budget).
|
|
54
54
|
|
|
55
|
+
The budget is tuned to the machine the suite is developed on. A slower
|
|
56
|
+
environment, such as a CI runner, sets its own for the run instead of raising
|
|
57
|
+
the committed number for everyone:
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
# .github/workflows/quality.yml
|
|
61
|
+
env:
|
|
62
|
+
CODEALITY_PY_TEST_BUDGET_SECONDS: '600'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
When `CODEALITY_PY_TEST_BUDGET_SECONDS` is set it replaces
|
|
66
|
+
`test-budget-seconds`; unset or empty, it changes nothing. A value that is not a
|
|
67
|
+
positive integer is a configuration error (exit 2), never silently ignored. The
|
|
68
|
+
pytest stage names the budget it was held to and where it came from -
|
|
69
|
+
`budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS` - in its text line, its
|
|
70
|
+
detail, and the `budget_seconds` and `budget_source` fields of `gate --json`.
|
|
71
|
+
|
|
55
72
|
## Exit codes
|
|
56
73
|
|
|
57
74
|
| Code | Meaning |
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "syntopica-codeality-py"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.5"
|
|
8
8
|
description = "Structural linter and config scaffolder for Python: atomic files, placement, size caps, no inline SQL"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -33,7 +33,7 @@ Issues = "https://github.com/syntopica/codeality/issues"
|
|
|
33
33
|
[dependency-groups]
|
|
34
34
|
dev = [
|
|
35
35
|
"deptry>=0.20,<1",
|
|
36
|
-
"mypy>=1.11,<
|
|
36
|
+
"mypy>=1.11,<3",
|
|
37
37
|
"pip-audit>=2.7,<3",
|
|
38
38
|
"pytest>=8,<10",
|
|
39
39
|
"pytest-cov>=5,<8",
|
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
46
46
|
|
|
47
47
|
- name: Upload the pyrefly shadow report
|
|
48
48
|
if: always()
|
|
49
|
-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
49
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
50
50
|
with:
|
|
51
51
|
name: pyrefly-shadow-${{ matrix.python-version }}
|
|
52
52
|
path: pyrefly.json
|
|
@@ -28,3 +28,6 @@ class BaselineConfig:
|
|
|
28
28
|
# Seconds the pytest stage may take before the gate reports it. Zero
|
|
29
29
|
# leaves the suite unbudgeted.
|
|
30
30
|
test_budget_seconds: int = 0
|
|
31
|
+
# Where that budget came from: the configuration file, or the environment
|
|
32
|
+
# variable that overrides it for one machine. Reported beside the budget.
|
|
33
|
+
test_budget_source: str = "codeality-py.toml"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Read the per-environment override of ``test-budget-seconds``."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
|
|
5
|
+
from codeality_py.config.config_error import ConfigError
|
|
6
|
+
|
|
7
|
+
TEST_BUDGET_ENV_VAR = "CODEALITY_PY_TEST_BUDGET_SECONDS"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def environment_test_budget(environ: Mapping[str, str]) -> int | None:
|
|
11
|
+
"""Return the budget the environment sets, or None when it sets none.
|
|
12
|
+
|
|
13
|
+
``test-budget-seconds`` is a regression guard tuned to the machine the
|
|
14
|
+
suite is developed on, and one number cannot hold for every machine: a
|
|
15
|
+
suite that takes 75 s locally took 292-347 s on GitHub's 4-core runners,
|
|
16
|
+
where Python 3.11 and 3.13 fall back to coverage's slow tracer
|
|
17
|
+
(spectalive/qlctool, 2026-09-25). Raising the committed number would blunt
|
|
18
|
+
the guard everywhere, so the environment that is slower says so for
|
|
19
|
+
itself. A value that is not a positive integer is refused rather than
|
|
20
|
+
ignored: a mistyped override that silently kept the committed budget, or
|
|
21
|
+
a zero that silently removed it, is the failure the gate exists to catch.
|
|
22
|
+
"""
|
|
23
|
+
raw = environ.get(TEST_BUDGET_ENV_VAR, "").strip()
|
|
24
|
+
if not raw:
|
|
25
|
+
return None
|
|
26
|
+
try:
|
|
27
|
+
seconds = int(raw)
|
|
28
|
+
except ValueError as error:
|
|
29
|
+
raise ConfigError(
|
|
30
|
+
f"{TEST_BUDGET_ENV_VAR} must be a positive integer of seconds, found {raw!r}"
|
|
31
|
+
) from error
|
|
32
|
+
if seconds <= 0:
|
|
33
|
+
raise ConfigError(
|
|
34
|
+
f"{TEST_BUDGET_ENV_VAR} must be a positive integer of seconds, found {raw!r}"
|
|
35
|
+
)
|
|
36
|
+
return seconds
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/config/load_config.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Read and validate ``codeality-py.toml`` for one project."""
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
from codeality_py.config.baseline_config import BaselineConfig
|
|
@@ -9,6 +10,10 @@ from codeality_py.config.check_schema_version import (
|
|
|
9
10
|
)
|
|
10
11
|
from codeality_py.config.discover_source_roots import discover_source_roots
|
|
11
12
|
from codeality_py.config.discover_test_roots import discover_test_roots
|
|
13
|
+
from codeality_py.config.environment_test_budget import (
|
|
14
|
+
TEST_BUDGET_ENV_VAR,
|
|
15
|
+
environment_test_budget,
|
|
16
|
+
)
|
|
12
17
|
from codeality_py.config.limits import Limits
|
|
13
18
|
from codeality_py.config.parse_overrides import parse_overrides
|
|
14
19
|
from codeality_py.config.parse_roles import parse_roles
|
|
@@ -46,6 +51,7 @@ def load_config(project_root: Path) -> BaselineConfig:
|
|
|
46
51
|
audit = document.get("audit", {})
|
|
47
52
|
reject_unknown_keys(audit, _AUDIT_KEYS, "[audit]")
|
|
48
53
|
source_roots = tuple(document.get("source-roots", ())) or discover_source_roots(project_root)
|
|
54
|
+
budget_override = environment_test_budget(os.environ)
|
|
49
55
|
return BaselineConfig(
|
|
50
56
|
project_root=project_root,
|
|
51
57
|
schema_version=SUPPORTED_SCHEMA_VERSION,
|
|
@@ -62,5 +68,10 @@ def load_config(project_root: Path) -> BaselineConfig:
|
|
|
62
68
|
import_package=document.get("import-package"),
|
|
63
69
|
coverage_threshold=int(document.get("coverage-threshold", 0)),
|
|
64
70
|
audit_ignore_vulns=tuple(audit.get("ignore-vulns", ())),
|
|
65
|
-
test_budget_seconds=
|
|
71
|
+
test_budget_seconds=(
|
|
72
|
+
budget_override
|
|
73
|
+
if budget_override is not None
|
|
74
|
+
else int(document.get("test-budget-seconds", 0))
|
|
75
|
+
),
|
|
76
|
+
test_budget_source=TEST_BUDGET_ENV_VAR if budget_override is not None else CONFIG_FILENAME,
|
|
66
77
|
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Say which time budget a stage was held to, and where it came from."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def budget_note(budget_seconds: float, budget_source: str) -> str:
|
|
5
|
+
"""Return ``budget 600s from <source>``, or nothing for an unbudgeted stage.
|
|
6
|
+
|
|
7
|
+
The budget can come from the configuration file or from an environment
|
|
8
|
+
variable that overrides it on one machine, so a log that shows only the
|
|
9
|
+
number leaves the reader guessing which of the two was in force.
|
|
10
|
+
"""
|
|
11
|
+
if budget_seconds <= 0.0:
|
|
12
|
+
return ""
|
|
13
|
+
return f"budget {budget_seconds:g}s from {budget_source}"
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/gate_stages.py
RENAMED
|
@@ -51,6 +51,7 @@ def gate_stages(config: BaselineConfig) -> tuple[Stage, ...]:
|
|
|
51
51
|
"--durations=10",
|
|
52
52
|
),
|
|
53
53
|
budget_seconds=float(config.test_budget_seconds),
|
|
54
|
+
budget_source=config.test_budget_source if config.test_budget_seconds else "",
|
|
54
55
|
),
|
|
55
56
|
Stage("pyrefly", StageKind.SHADOW, ("pyrefly", "check")),
|
|
56
57
|
)
|
|
@@ -18,7 +18,8 @@ def over_budget_detail(stage: Stage, elapsed: float, output: str) -> str:
|
|
|
18
18
|
"""
|
|
19
19
|
header = (
|
|
20
20
|
f"{stage.name} passed in {elapsed:.1f}s, over its budget of "
|
|
21
|
-
f"{stage.budget_seconds:g}s
|
|
21
|
+
f"{stage.budget_seconds:g}s (from {stage.budget_source}). "
|
|
22
|
+
f"Profile before adding hardware: {PROCEDURE_URL}"
|
|
22
23
|
)
|
|
23
24
|
tail = output[-2000:].strip()
|
|
24
25
|
return f"{header}\n{tail}" if tail else header
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/src/codeality_py/gate/run_stage.py
RENAMED
|
@@ -5,6 +5,7 @@ import subprocess
|
|
|
5
5
|
import time
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
|
+
from codeality_py.gate.budget_note import budget_note
|
|
8
9
|
from codeality_py.gate.build_stage_result import build_stage_result
|
|
9
10
|
from codeality_py.gate.over_budget_detail import over_budget_detail
|
|
10
11
|
from codeality_py.gate.stage import Stage
|
|
@@ -49,7 +50,13 @@ def run_stage(stage: Stage, project_root: Path) -> StageResult:
|
|
|
49
50
|
output = "\n".join(
|
|
50
51
|
part.strip() for part in (completed.stdout, completed.stderr) if part.strip()
|
|
51
52
|
)
|
|
52
|
-
|
|
53
|
+
# A passing budgeted stage names the budget it was held to and where
|
|
54
|
+
# that came from, so a CI log shows whether an override was in force.
|
|
55
|
+
detail = (
|
|
56
|
+
budget_note(stage.budget_seconds, stage.budget_source)
|
|
57
|
+
if completed.returncode == 0
|
|
58
|
+
else output[-2000:]
|
|
59
|
+
)
|
|
53
60
|
# A suite that passes but takes longer than it may is a finding of its
|
|
54
61
|
# own: the tail of its output holds pytest's slowest-durations table,
|
|
55
62
|
# which is where fixing it starts.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
|
|
5
|
+
from codeality_py.gate.budget_note import budget_note
|
|
5
6
|
from codeality_py.gate.gate_result import GateResult
|
|
6
7
|
from codeality_py.report.stage_document import stage_document
|
|
7
8
|
|
|
@@ -17,5 +18,10 @@ def render_gate_report(result: GateResult, as_json: bool) -> str:
|
|
|
17
18
|
return "\n".join(
|
|
18
19
|
f"{stage.status.value:>22} {stage.name:<12} "
|
|
19
20
|
f"{stage.duration_seconds:>7.2f}s {' '.join(stage.command)}"
|
|
21
|
+
+ (
|
|
22
|
+
f" [{note}]"
|
|
23
|
+
if (note := budget_note(stage.budget_seconds, stage.budget_source))
|
|
24
|
+
else ""
|
|
25
|
+
)
|
|
20
26
|
for stage in result.stages
|
|
21
27
|
)
|
|
@@ -13,4 +13,6 @@ def stage_document(stage: StageResult) -> dict[str, object]:
|
|
|
13
13
|
"exit_code": stage.exit_code,
|
|
14
14
|
"duration_seconds": stage.duration_seconds,
|
|
15
15
|
"detail": stage.detail,
|
|
16
|
+
"budget_seconds": stage.budget_seconds or None,
|
|
17
|
+
"budget_source": stage.budget_source or None,
|
|
16
18
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Judge an entrypoint module against the one-unit rule."""
|
|
2
|
+
|
|
3
|
+
from codeality_py.model.finding import Finding
|
|
4
|
+
from codeality_py.rules.ordinary_unit_findings import ordinary_unit_findings
|
|
5
|
+
from codeality_py.units.declaration import Declaration
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def entrypoint_unit_findings(
|
|
9
|
+
relative_path: str, declarations: tuple[Declaration, ...]
|
|
10
|
+
) -> tuple[Finding, ...]:
|
|
11
|
+
"""Return the finding for an entrypoint module, or nothing when it is clean.
|
|
12
|
+
|
|
13
|
+
An entrypoint may declare nothing: a ``__main__.py`` that imports the entry
|
|
14
|
+
function and calls it under the ``__main__`` guard is the shape the role
|
|
15
|
+
exists for. Otherwise it holds its one unit, like an ordinary module.
|
|
16
|
+
"""
|
|
17
|
+
if not declarations:
|
|
18
|
+
return ()
|
|
19
|
+
return ordinary_unit_findings(relative_path, declarations)
|
|
@@ -5,6 +5,7 @@ from codeality_py.config.module_role import ModuleRole
|
|
|
5
5
|
from codeality_py.model.finding import Finding
|
|
6
6
|
from codeality_py.parsing.source_file import SourceFile
|
|
7
7
|
from codeality_py.rules.data_unit_findings import data_unit_findings
|
|
8
|
+
from codeality_py.rules.entrypoint_unit_findings import entrypoint_unit_findings
|
|
8
9
|
from codeality_py.rules.ordinary_unit_findings import ordinary_unit_findings
|
|
9
10
|
from codeality_py.units.count_primary_declarations import count_primary_declarations
|
|
10
11
|
|
|
@@ -19,4 +20,6 @@ def one_primary_unit(source: SourceFile, config: BaselineConfig) -> tuple[Findin
|
|
|
19
20
|
declarations = count_primary_declarations(source.tree, source.relative_path)
|
|
20
21
|
if source.role is ModuleRole.DATA:
|
|
21
22
|
return data_unit_findings(source.relative_path, declarations)
|
|
23
|
+
if source.role is ModuleRole.ENTRYPOINT:
|
|
24
|
+
return entrypoint_unit_findings(source.relative_path, declarations)
|
|
22
25
|
return ordinary_unit_findings(source.relative_path, declarations)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Convert one underscore-free word of a declaration name to snake_case."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from codeality_py.units.merge_stray_letters import merge_stray_letters
|
|
6
|
+
|
|
7
|
+
_PLURAL_ACRONYM = re.compile(r"([A-Z]{2,})s(?=[A-Z0-9]|$)")
|
|
8
|
+
_ACRONYM_THEN_WORD = re.compile(r"([A-Z]+)([A-Z][a-z])")
|
|
9
|
+
_WORD_THEN_CAPITAL = re.compile(r"([a-z0-9])([A-Z])")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def snake_case_word(word: str) -> str:
|
|
13
|
+
"""Return the snake_case form of a word holding no underscore.
|
|
14
|
+
|
|
15
|
+
A plural acronym (URLs, IDs) is one word, so it is marked off before the
|
|
16
|
+
case-boundary split would cut it into ur and ls.
|
|
17
|
+
"""
|
|
18
|
+
separated = _PLURAL_ACRONYM.sub(lambda match: f"_{match.group(1).lower()}s_", word)
|
|
19
|
+
separated = _ACRONYM_THEN_WORD.sub(r"\1_\2", separated)
|
|
20
|
+
separated = _WORD_THEN_CAPITAL.sub(r"\1_\2", separated)
|
|
21
|
+
segments = [segment for segment in separated.lower().split("_") if segment]
|
|
22
|
+
return "_".join(merge_stray_letters(segments)) if segments else word.lower()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Convert a declaration name to the file name that must hold it."""
|
|
2
|
+
|
|
3
|
+
from codeality_py.units.snake_case_word import snake_case_word
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def to_snake_case(name: str) -> str:
|
|
7
|
+
"""Return the snake_case form of a declaration name.
|
|
8
|
+
|
|
9
|
+
One algorithm, pinned by fixtures: HTTP2Client to http2_client,
|
|
10
|
+
OAuthClient to oauth_client, IPv6Address to ipv6_address, HTTPServer to
|
|
11
|
+
http_server, DownloadedURLsSQL to downloaded_urls_sql. An underscore the
|
|
12
|
+
name already has is kept, so is_a_step stays is_a_step.
|
|
13
|
+
"""
|
|
14
|
+
return "_".join(snake_case_word(word) for word in name.split("_"))
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""gate refuses a bad configuration before running any stage."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from click.testing import CliRunner
|
|
7
|
+
|
|
8
|
+
from codeality_py.cli import cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_a_bad_budget_variable_is_a_configuration_error_not_a_crash(
|
|
12
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
13
|
+
) -> None:
|
|
14
|
+
(tmp_path / "src").mkdir()
|
|
15
|
+
monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", "ten minutes")
|
|
16
|
+
result = CliRunner().invoke(cli, ["gate", "--project", str(tmp_path)])
|
|
17
|
+
assert result.exit_code == 2
|
|
18
|
+
assert result.exception is None or isinstance(result.exception, SystemExit)
|
|
19
|
+
assert "configuration error: CODEALITY_PY_TEST_BUDGET_SECONDS" in result.output
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/config/test_load_config.py
RENAMED
|
@@ -88,11 +88,51 @@ def test_an_unknown_rule_code_in_an_override_is_fatal(tmp_path: Path) -> None:
|
|
|
88
88
|
load_config(tmp_path)
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
def test_the_suite_is_unbudgeted_unless_the_project_says_otherwise(
|
|
91
|
+
def test_the_suite_is_unbudgeted_unless_the_project_says_otherwise(
|
|
92
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
93
|
+
) -> None:
|
|
94
|
+
monkeypatch.delenv("CODEALITY_PY_TEST_BUDGET_SECONDS", raising=False)
|
|
92
95
|
(tmp_path / "src").mkdir()
|
|
93
96
|
assert load_config(tmp_path).test_budget_seconds == 0
|
|
94
97
|
|
|
95
98
|
|
|
96
|
-
def test_the_test_budget_is_read(tmp_path: Path) -> None:
|
|
99
|
+
def test_the_test_budget_is_read(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
100
|
+
monkeypatch.delenv("CODEALITY_PY_TEST_BUDGET_SECONDS", raising=False)
|
|
97
101
|
_write(tmp_path, "schema-version = 1\ntest-budget-seconds = 300\n")
|
|
98
|
-
|
|
102
|
+
config = load_config(tmp_path)
|
|
103
|
+
assert config.test_budget_seconds == 300
|
|
104
|
+
assert config.test_budget_source == "codeality-py.toml"
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def test_the_environment_overrides_the_test_budget(
|
|
108
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
109
|
+
) -> None:
|
|
110
|
+
"""2026-09-25: spectalive/qlctool's suite takes 75 s on the developer's
|
|
111
|
+
machine and 292-347 s on GitHub's 4-core runners, where 3.11 and 3.13 fall
|
|
112
|
+
back to coverage's slow tracer. One committed number cannot guard both.
|
|
113
|
+
"""
|
|
114
|
+
monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", "600")
|
|
115
|
+
_write(tmp_path, "schema-version = 1\ntest-budget-seconds = 120\n")
|
|
116
|
+
config = load_config(tmp_path)
|
|
117
|
+
assert config.test_budget_seconds == 600
|
|
118
|
+
assert config.test_budget_source == "CODEALITY_PY_TEST_BUDGET_SECONDS"
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_an_empty_budget_variable_changes_nothing(
|
|
122
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
123
|
+
) -> None:
|
|
124
|
+
monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", "")
|
|
125
|
+
_write(tmp_path, "schema-version = 1\ntest-budget-seconds = 120\n")
|
|
126
|
+
config = load_config(tmp_path)
|
|
127
|
+
assert config.test_budget_seconds == 120
|
|
128
|
+
assert config.test_budget_source == "codeality-py.toml"
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@pytest.mark.parametrize("value", ["ten", "1.5", "0", "-30"])
|
|
132
|
+
def test_a_budget_variable_that_is_not_a_positive_integer_is_fatal(
|
|
133
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, value: str
|
|
134
|
+
) -> None:
|
|
135
|
+
monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", value)
|
|
136
|
+
_write(tmp_path, "schema-version = 1\ntest-budget-seconds = 120\n")
|
|
137
|
+
with pytest.raises(ConfigError, match="CODEALITY_PY_TEST_BUDGET_SECONDS"):
|
|
138
|
+
load_config(tmp_path)
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/gate/test_gate_stages.py
RENAMED
|
@@ -80,3 +80,19 @@ def test_the_test_budget_reaches_the_pytest_stage_and_no_other() -> None:
|
|
|
80
80
|
budgets = {stage.name: stage.budget_seconds for stage in gate_stages(config)}
|
|
81
81
|
assert budgets["pytest"] == 300.0
|
|
82
82
|
assert all(budget == 0.0 for name, budget in budgets.items() if name != "pytest")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_the_pytest_stage_carries_where_its_budget_came_from() -> None:
|
|
86
|
+
config = BaselineConfig(
|
|
87
|
+
project_root=Path("/p"),
|
|
88
|
+
test_budget_seconds=600,
|
|
89
|
+
test_budget_source="CODEALITY_PY_TEST_BUDGET_SECONDS",
|
|
90
|
+
)
|
|
91
|
+
sources = {stage.name: stage.budget_source for stage in gate_stages(config)}
|
|
92
|
+
assert sources["pytest"] == "CODEALITY_PY_TEST_BUDGET_SECONDS"
|
|
93
|
+
assert all(source == "" for name, source in sources.items() if name != "pytest")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_an_unbudgeted_pytest_stage_names_no_source() -> None:
|
|
97
|
+
config = BaselineConfig(project_root=Path("/p"))
|
|
98
|
+
assert {stage.name: stage.budget_source for stage in gate_stages(config)}["pytest"] == ""
|
|
@@ -92,11 +92,17 @@ def test_a_passing_stage_past_its_budget_is_over_budget(tmp_path: Path) -> None:
|
|
|
92
92
|
took it to four minutes; parallel workers took it to 32 seconds. The
|
|
93
93
|
gate has to be what says the number is too big.
|
|
94
94
|
"""
|
|
95
|
-
stage = Stage(
|
|
95
|
+
stage = Stage(
|
|
96
|
+
"sleep",
|
|
97
|
+
StageKind.REQUIRED,
|
|
98
|
+
("sleep", "0.2"),
|
|
99
|
+
budget_seconds=0.05,
|
|
100
|
+
budget_source="codeality-py.toml",
|
|
101
|
+
)
|
|
96
102
|
result = run_stage(stage, tmp_path)
|
|
97
103
|
assert result.status is StageStatus.OVER_BUDGET
|
|
98
104
|
assert result.exit_code == 0
|
|
99
|
-
assert "over its budget of 0.05s" in result.detail
|
|
105
|
+
assert "over its budget of 0.05s (from codeality-py.toml)" in result.detail
|
|
100
106
|
assert "testing.md#suite-time-budget" in result.detail
|
|
101
107
|
|
|
102
108
|
|
|
@@ -118,3 +124,23 @@ def test_over_budget_in_a_required_stage_exits_1() -> None:
|
|
|
118
124
|
def test_over_budget_in_a_shadow_stage_does_not_fail_the_gate() -> None:
|
|
119
125
|
result = GateResult(stages=(_stage_result(StageKind.SHADOW, StageStatus.OVER_BUDGET),))
|
|
120
126
|
assert result.exit_code() is ExitCode.OK
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def test_a_passing_budgeted_stage_names_its_budget_and_its_source(tmp_path: Path) -> None:
|
|
130
|
+
"""A CI log has to show whether the environment's override was in force."""
|
|
131
|
+
stage = Stage(
|
|
132
|
+
"true",
|
|
133
|
+
StageKind.REQUIRED,
|
|
134
|
+
("true",),
|
|
135
|
+
budget_seconds=600.0,
|
|
136
|
+
budget_source="CODEALITY_PY_TEST_BUDGET_SECONDS",
|
|
137
|
+
)
|
|
138
|
+
result = run_stage(stage, tmp_path)
|
|
139
|
+
assert result.status is StageStatus.PASSED
|
|
140
|
+
assert result.detail == "budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS"
|
|
141
|
+
assert result.budget_seconds == 600.0
|
|
142
|
+
assert result.budget_source == "CODEALITY_PY_TEST_BUDGET_SECONDS"
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_a_passing_unbudgeted_stage_has_no_detail(tmp_path: Path) -> None:
|
|
146
|
+
assert run_stage(Stage("true", StageKind.REQUIRED, ("true",)), tmp_path).detail == ""
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""The report says which suite budget applied, in both of its forms."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
from codeality_py.gate.gate_result import GateResult
|
|
6
|
+
from codeality_py.gate.stage_kind import StageKind
|
|
7
|
+
from codeality_py.gate.stage_result import StageResult
|
|
8
|
+
from codeality_py.gate.stage_status import StageStatus
|
|
9
|
+
from codeality_py.report.render_gate_report import render_gate_report
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _result(budget_seconds: float, budget_source: str) -> GateResult:
|
|
13
|
+
stage = StageResult(
|
|
14
|
+
name="pytest",
|
|
15
|
+
kind=StageKind.REQUIRED,
|
|
16
|
+
command=("pytest",),
|
|
17
|
+
status=StageStatus.PASSED,
|
|
18
|
+
exit_code=0,
|
|
19
|
+
duration_seconds=292.0,
|
|
20
|
+
budget_seconds=budget_seconds,
|
|
21
|
+
budget_source=budget_source,
|
|
22
|
+
)
|
|
23
|
+
return GateResult(stages=(stage,))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_the_json_names_the_budget_and_its_source() -> None:
|
|
27
|
+
report = render_gate_report(_result(600.0, "CODEALITY_PY_TEST_BUDGET_SECONDS"), as_json=True)
|
|
28
|
+
stage = json.loads(report)["stages"][0]
|
|
29
|
+
assert stage["budget_seconds"] == 600.0
|
|
30
|
+
assert stage["budget_source"] == "CODEALITY_PY_TEST_BUDGET_SECONDS"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_the_json_marks_an_unbudgeted_stage_with_nulls() -> None:
|
|
34
|
+
stage = json.loads(render_gate_report(_result(0.0, ""), as_json=True))["stages"][0]
|
|
35
|
+
assert stage["budget_seconds"] is None
|
|
36
|
+
assert stage["budget_source"] is None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_the_text_line_names_the_budget_and_its_source() -> None:
|
|
40
|
+
report = render_gate_report(_result(600.0, "CODEALITY_PY_TEST_BUDGET_SECONDS"), as_json=False)
|
|
41
|
+
assert report.endswith("[budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS]")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_the_text_line_of_an_unbudgeted_stage_is_unchanged() -> None:
|
|
45
|
+
assert "budget" not in render_gate_report(_result(0.0, ""), as_json=False)
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/rules/test_one_primary_unit.py
RENAMED
|
@@ -218,3 +218,17 @@ def test_test_stub_generated_and_barrel_roles_are_exempt(make_source, config) ->
|
|
|
218
218
|
ModuleRole.BARREL,
|
|
219
219
|
):
|
|
220
220
|
assert _clean(make_source, config, body, role)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def test_an_entrypoint_calling_an_imported_function_is_clean(make_source, config) -> None:
|
|
224
|
+
body = 'from pkg.run import run\n\nif __name__ == "__main__":\n run()\n'
|
|
225
|
+
assert _clean(make_source, config, body, ModuleRole.ENTRYPOINT)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def test_an_entrypoint_with_two_units_is_reported(make_source, config) -> None:
|
|
229
|
+
body = "def main() -> None:\n return None\n\n\ndef helper() -> None:\n return None\n"
|
|
230
|
+
assert not _clean(make_source, config, body, ModuleRole.ENTRYPOINT)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def test_an_ordinary_module_without_a_declaration_is_reported(make_source, config) -> None:
|
|
234
|
+
assert not _clean(make_source, config, "from pkg.run import run\n\nrun()\n")
|
{syntopica_codeality_py-0.2.3 → syntopica_codeality_py-0.2.5}/tests/units/test_to_snake_case.py
RENAMED
|
@@ -15,6 +15,12 @@ CASES = [
|
|
|
15
15
|
("A", "a"),
|
|
16
16
|
("HTTPServer", "http_server"),
|
|
17
17
|
("SQLiteStore", "sq_lite_store"),
|
|
18
|
+
("is_a_step", "is_a_step"),
|
|
19
|
+
("stage_x_positions", "stage_x_positions"),
|
|
20
|
+
("URLs", "urls"),
|
|
21
|
+
("DownloadedURLsSQL", "downloaded_urls_sql"),
|
|
22
|
+
("IDsToFetch", "ids_to_fetch"),
|
|
23
|
+
("_private_name", "_private_name"),
|
|
18
24
|
]
|
|
19
25
|
|
|
20
26
|
|