Skip to content

Reduce complexity of process_file#136

Merged
tomschr merged 2 commits intomainfrom
toms/complexity-process_file
Jan 14, 2026
Merged

Reduce complexity of process_file#136
tomschr merged 2 commits intomainfrom
toms/complexity-process_file

Conversation

@tomschr
Copy link
Copy Markdown
Contributor

@tomschr tomschr commented Jan 14, 2026

  • Introduce ValidationResult datatype
  • Break down process_file into:
    • build_shortname: Return a shortened display name for filepath.
    • run_validation: Run RNG validation using the selected method and normalize result.
    • parse_tree: Parse XML file using lxml in a background thread.
    • run_checks_and_display: Execute registered Python checks and print formatted results

Related to #135.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 14, 2026

Coverage Report

For commit 3220a82

Click to expand Coverage Report
  Name                                           Stmts   Miss Branch BrPart  Cover
  --------------------------------------------------------------------------------
+ src/docbuild/utils/pidlock.py                     79      1     14      1  97.8%
+ src/docbuild/cli/cmd_validate/process.py         178      3     52      2  97.8%
+ src/docbuild/config/xml/stitch.py                 48      1     12      1  96.7%
+ src/docbuild/models/path.py                       43      1     12      1  96.4%
+ src/docbuild/cli/callback.py                      35      0     10      2  95.6%
+ src/docbuild/models/config/env.py                118      5      2      1  95.0%
+ src/docbuild/cli/cmd_metadata/metaprocess.py     157      4     42      7  94.5%
- src/docbuild/cli/cmd_config/__init__.py            9      1      0      0  88.9%
- src/docbuild/cli/cmd_cli.py                       84     11      6      3  84.4%
- src/docbuild/cli/cmd_build/__init__.py            13      5      0      0  61.5%
- src/docbuild/cli/cmd_metadata/__init__.py         27     10      2      0  58.6%
- src/docbuild/cli/cmd_config/environment.py        11      6      2      0  38.5%
  --------------------------------------------------------------------------------
+ TOTAL                                           2520     48    594     18  97.8%
  
  44 files skipped due to complete coverage.

* Introduce ValidationResult datatype
* Break down `process_file` into:
  * `build_shortname`: Return a shortened display name for `filepath`.
  * `run_validation`: Run RNG validation using the selected method and normalize result.
  * `parse_tree`: Parse XML file using lxml in a background thread.
  * `run_checks_and_display`: Execute registered Python checks and print formatted results.
* Amend the test file `test_process_validation.py`
@tomschr tomschr force-pushed the toms/complexity-process_file branch from 0874634 to 3220a82 Compare January 14, 2026 16:58
@tomschr tomschr marked this pull request as ready for review January 14, 2026 17:10
@tomschr tomschr merged commit 87e63ee into main Jan 14, 2026
4 checks passed
@tomschr tomschr deleted the toms/complexity-process_file branch January 14, 2026 17:10
@tomschr tomschr added the kind:refactor Code cleanup without logic change. label Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:refactor Code cleanup without logic change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant