data-to-insight / csc-validator-be-cin

1 stars 1 forks source link

Refactor/registry #456

Closed tab1tha closed 1 year ago

tab1tha commented 1 year ago

The changes in this pull request:

  1. Get rid of the custom registry class, which added avoidable fuzziness, and replaces it with a pure python dictionary.
  2. Ensures that all rule codes are processes as strings even if they're entered as ints in their rule files. This enforces consistency in how rules are addressed.
  3. Replaces print statements in the command line tool with click.echo
  4. Gets rid of the central create_registry functionality pulled in rules from multiple years and figured out how to merge them together. Now that is done in the initfiles of the respective rule folders.
  5. Adds python type-hinting to functions and variables as we came across them.
  6. Adjusts the rpc_main handler such that the collectionYear can be deduced from the metadata instead of being filled in as an additional parameter.
  7. The rule list displayed in the landing page of the frontend must be generated by specifying the collectionYear. As such we are sure that it is up-to-date.
  8. Adds tests to check that the new way of generating the registry of rules works.

They were done all at once to sync with the incremental changes that were done on the lac_validator repo.

codecov-commenter commented 1 year ago

Codecov Report

Merging #456 (9a96065) into main (e2f7a21) will increase coverage by 0.19%. The diff coverage is 78.04%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #456      +/-   ##
==========================================
+ Coverage   92.93%   93.13%   +0.19%     
==========================================
  Files         123      123              
  Lines        5099     5083      -16     
==========================================
- Hits         4739     4734       -5     
+ Misses        360      349      -11     
Files Changed Coverage Δ
cin_validator/rule_engine/__registry.py 100.00% <ø> (+8.57%) :arrow_up:
cin_validator/rules/cin2023_24/rule_1530.py 18.36% <ø> (ø)
cin_validator/__main__.py 51.35% <14.28%> (+1.98%) :arrow_up:
cin_validator/cin_validator.py 12.94% <50.00%> (-0.63%) :arrow_down:
cin_validator/rules/ruleset_utils.py 90.00% <90.00%> (ø)
cin_validator/rule_engine/__api.py 94.59% <100.00%> (+2.92%) :arrow_up:
cin_validator/rule_engine/__init__.py 100.00% <100.00%> (ø)
cin_validator/rules/cin2022_23/__init__.py 100.00% <100.00%> (ø)
cin_validator/rules/cin2023_24/__init__.py 100.00% <100.00%> (ø)
cin_validator/test_engine/__init__.py 100.00% <100.00%> (ø)
... and 2 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more