Skip to content

Nethaniel/fix issue 13#785

Open
Neth766 wants to merge 3 commits intoOWASP:mainfrom
Neth766:nethaniel/fix-issue-13
Open

Nethaniel/fix issue 13#785
Neth766 wants to merge 3 commits intoOWASP:mainfrom
Neth766:nethaniel/fix-issue-13

Conversation

@Neth766
Copy link

@Neth766 Neth766 commented Mar 5, 2026

Title
Fix Issue #13 – Implement pre-commit hooks, resolve pytest failures, and restore test coverage

Description
This PR resolves Issue #13 by implementing the required pre-commit hooks and fixing the issues that previously caused the hooks and tests to fail.
While implementing the hooks, several underlying issues in the test suite and codebase surfaced. These were resolved to ensure that all checks run successfully.

Changes Made

  1. Implemented pre-commit hooks
    Added a .pre-commit-config.yaml to enforce repository quality checks before commits:
    black for automatic code formatting
    mypy --strict for static type checking
    Flask test execution
    Coverage validation (minimum threshold remains 70%, as defined in the repository)
  2. Fixed failing pytest tests
    Several tests were failing before the hooks could run successfully. These were debugged and corrected so that the entire test suite now runs successfully without failures.
  3. Resolved mypy strict type errors
    Addressed strict typing errors across the codebase so that mypy --strict passes successfully.
  4. Improved overall test stability
    Adjusted portions of the test setup and related files to ensure reliable execution across the test suite.
  5. Increased test coverage
    While the project requires a minimum coverage of 70%, the fixes improved coverage to approximately 86%, allowing the coverage check to pass comfortably.
    Verification
    The following commands were run locally to confirm that all checks pass:

pre-commit install
pre-commit run --all-files
Results:
Black formatting: Pass
Mypy strict checks: Pass
Flask tests: Pass
Coverage check: Pass (≈86%)

Notes
All hooks execute successfully when the project environment is properly set up (virtual environment activated and dependencies installed).
No functional behavior of the application was intentionally modified beyond what was necessary to resolve the failing tests and type errors.
Related Issue
Fixes #13

@Neth766 Neth766 force-pushed the nethaniel/fix-issue-13 branch from 9125c27 to 5adf88d Compare March 5, 2026 12:52
@dataclass(eq=False)
class Code(Node):
doctype: Credoctypes = Credoctypes.Code
import re
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a complete rewrite? how come? there shouldn't be any linting error here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a rewrite. The Code class itself is unchanged; import ordering/noise came from merge/reformat. 're' is required for CRE id validation (re.match at cre_defs.py:442), so there isn’t a lint issue to fix here.

@Neth766 Neth766 requested a review from northdpole March 6, 2026 12:45
@Neth766
Copy link
Author

Neth766 commented Mar 14, 2026

Hi @northdpole,

Just checking in regarding Issue #13 (pre-commit hooks and failing checks). I opened a PR addressing this and incorporated the review feedback that was previously mentioned.

Whenever you have time, I’d appreciate it if you could take another look and let me know if the changes align with what you had in mind.

PR: #785
Thanks again for your guidance on this.

@Neth766 Neth766 mentioned this pull request Mar 14, 2026
Neth766 added 3 commits March 15, 2026 10:52
- Add black formatting hook
- Add mypy strict type checking
- Add Flask test hook
- Enforce minimum 70% coverage
- Fix pytest failures
- Resolve mypy strict errors

All pre-commit checks pass.
- Add black formatting hook
- Add mypy strict type checking
- Add Flask test hook
- Resolve test failures and increase coverage to 86%+ (passes 70% threshold)
- Fix all pytest failures (Passes successfully now)
- Resolve mypy strict errors

All pre-commit checks pass.
@Neth766 Neth766 force-pushed the nethaniel/fix-issue-13 branch from 659b9f8 to c1b6ede Compare March 15, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pre-commit hooks

2 participants