Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate global state, reducing technical debt #100

Merged
merged 50 commits into from
Jun 29, 2018
Merged

Eliminate global state, reducing technical debt #100

merged 50 commits into from
Jun 29, 2018

Conversation

vergeev
Copy link
Contributor

@vergeev vergeev commented Apr 7, 2018

The PR eliminates global state, making every parameterization possible by passing arguments to validate.

Once merged, the will close #7, #9, #39, #40, #95, #99 and #102. It will also allow to work on #45, which was blocked by #9.

Changelog:

  • ParsedPyFile class was introduced, combining all the info about file location as well as the parsed ast of the file.
  • The complicated logic of get_ast_trees was removed and the method was was substituted with a simpler get_parsed_py_files.
  • All currently implemented validators are now using get_parsed_py_files
  • LocalRepositoryInfo was split into two classes: ProjectFolder and LocalRepository. This allows for validation of simple project folders without git repository in them.
  • validate_repo function is now simply validate.
  • The class CodeValidator is eliminated.
  • config.py is renamed to defaults.py and is used as such: not a modifiable config, but immutable defaults that are used in case nothing is specified.
  • Now all validators and pre-validators respect the directories_to_skip parameter.
  • Whitelists and blacklists are no different from usual validation parameters.
  • Improve the speed and resource management of the tests
  • if a folder is not found, fiasko will gracefully fail
  • has_no_directories_from_blacklist now only inspects tracked directories, as it was intended.

@codecov
Copy link

codecov bot commented Apr 7, 2018

Codecov Report

Merging #100 into master will decrease coverage by 92.67%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #100       +/-   ##
=========================================
- Coverage   92.67%     0%   -92.68%     
=========================================
  Files          28     28               
  Lines         846    815       -31     
=========================================
- Hits          784      0      -784     
- Misses         62    815      +753
Impacted Files Coverage Δ
fiasko_bro/pre_validation_checks/__init__.py 0% <ø> (-100%) ⬇️
fiasko_bro/validators/readme.py 0% <0%> (-85.72%) ⬇️
fiasko_bro/defaults.py 0% <0%> (ø)
fiasko_bro/validators/commits.py 0% <0%> (-100%) ⬇️
fiasko_bro/code_helpers.py 0% <0%> (-97.3%) ⬇️
fiasko_bro/repository_info.py 0% <0%> (-98.79%) ⬇️
fiasko_bro/validators/requirements.py 0% <0%> (-100%) ⬇️
fiasko_bro/validators/pythonic.py 0% <0%> (-99%) ⬇️
fiasko_bro/validators/naming.py 0% <0%> (-100%) ⬇️
fiasko_bro/validators/other_languages.py 0% <0%> (-100%) ⬇️
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 86d302f...2ff25f0. Read the comment docs.

@vergeev vergeev changed the title Big refactoring of the validator interface Technical debt reduction Apr 9, 2018
@vergeev vergeev changed the title Technical debt reduction Eliminate global state, reducing technical debt Apr 10, 2018
Paul Vergeev added 21 commits April 13, 2018 16:46
Previously it ignored the files with names starting with '.'
This will be needed for some of the validators in the general group
We avoid redundant test runs with the "session" scope
and remove the .git folder so it doesn't grow infinitely large.
Some of the validators, like has_no_bom, will try to analyze the
contents of the .git folder, which shouldn't happen.

This is a quick fix. The more long term solution would be to rewrite the
validators to use ProjectFolder methods that ignore the files of
inappropriate extensions.
The error occurred if some of the tests failed and the .git/index.lock
file was not deleted.
@vergeev
Copy link
Contributor Author

vergeev commented Apr 30, 2018

codecov is showing the error

Unable to compare commits because the base of the compare did not upload a coverage report

This is probably due to the failing build in the master branch (https://docs.codecov.io/docs/error-reference#section-missing-base-commit):

This issue occurs when the base commit (the parent commit of the first commit on the pull request) did not upload coverage and/or failed CI tests.

pytest --cov fiasko_bro --cov-report html command gives 91% coverage.

@vergeev vergeev mentioned this pull request May 3, 2018
@Melevir Melevir merged commit 2ff25f0 into devmanorg:master Jun 29, 2018
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.

Refactor get_ast_trees
2 participants