findcdn icon indicating copy to clipboard operation
findcdn copied to clipboard

Code Cleanup

Open mcdonnnj opened this issue 5 years ago • 1 comments

Proposal

The codebase could use another pass to cleanup/adjust to improve future maintainability.

Motivation

The codebase should more strictly follow Python convention to hopefully improve maintainability.

Work

I created a branch and added pylint to the pre-commit configuration with a slightly tweaked configuration file (.pylintrc) to pare down to more "essential" tests. The lint run can be found at https://github.com/cisagov/findcdn/runs/894966344?check_suite_focus=true

mcdonnnj avatar Jul 21 '20 16:07 mcdonnnj

To add to this, the Chef class probably should not exist.

  • All of the chef's operations are actually operations on DomainPot, or Domain
  • All of the args passed to Chef are then just passed to run_checks and ultimately down the line
  • It's honestly incredibly confusing with the number of functions that just get daisey chained without the reader really understanding why, IMO: global run checks-> chef run checks -> chef grab_cdn -> global chef_executor (huh?) -> detectCDN.cdnCheck() -> all_checks() is a lot more complicated than it could be, to do what amounts to a single operation. The last item in that chain, all_checks already runs on a domain object, so why do I pass the arguments through so many layers that don't really do anything?
  • There's a lot of things that could be broken out into separate files for easier readability

S4lt5 avatar Oct 28 '22 04:10 S4lt5