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

Fixed loading the rules twice #980

Merged
merged 2 commits into from
Jun 27, 2019
Merged

Conversation

fatbasstard
Copy link
Contributor

Noticed that Rules are loaded twice when playing around a bit, the _init__ called called twice.

Found that we load the rules from disk twice, since this process loads all Python files from disk dynamically, the Rules actually get initialized twice. Waste of resources and confusion.

I removed this double loading behaviour before, but it looks like to got re-introduced in the following commit: 878f9d7

This PR "restores" this, the Rules are only loaded in in the get_args_filenames if the rules need to be printed.

Some findings:

  • If there is a "reason" that the rules should be loaded in the get_args_filenames, that would mean that code technically something is "wrong" (like doing something else than loading the rules)... So "assumed" this changed cannot harm anything (backed by the tests BTW 😛 )
  • Recently we added a new method to the rules: initialize(), this is a guaranteed and controlled method from the linter called when processing the rules. Might be an option to enforce using this in rules to as well...

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Jun 27, 2019

Codecov Report

Merging #980 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #980      +/-   ##
==========================================
- Coverage   86.85%   86.84%   -0.02%     
==========================================
  Files         133      133              
  Lines        7874     7874              
  Branches     1935     1935              
==========================================
- Hits         6839     6838       -1     
- Misses        638      639       +1     
  Partials      397      397
Impacted Files Coverage Δ
src/cfnlint/core.py 56.6% <0%> (-0.95%) ⬇️

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 adb21ef...4b31293. Read the comment docs.

@kddejong kddejong merged commit 71262e6 into aws-cloudformation:master Jun 27, 2019
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.

2 participants