-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Create and use a function for module stats initialization #5271
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
Conversation
Pull Request Test Coverage Report for Build 1432495452
π - Coveralls |
Change seems fine, but why would we want this to be possible? I didn't really understand why this was problematic in #4720: don't we always want to |
Yes, it's better to set the current module (actually the functional result is a lot better after handling your comment properly with a nice output with the name of the config file). It's just a refactor to reduce coupling between Pylinter and pylint.util that felt better separated from the TOML changes. |
Shall we say something about that in the docstring? Like |
It's probably a good thing that we can use stats from outside the Pylinter, for example if we want to create stats from each checker class (?) or from the OptionMixinManager without instancing a Pylinter. It's expected that you have to use the name again later to increase the module stats, right ? Worst case scenario there is a ModuleStats with zero violations in it ? Maybe we could even create the ModuleStats when someone try to increment it for the first time ? This means the usage is simpler as you don't have to initialize it anymore : it's transparent for you. |
I don't think you can use a checker class without instantiating a You will need the self.reporter.on_set_current_module(modname, filepath)
self.current_name = modname
self.current_file = filepath or modname
Perhaps we should. I'm not sure.. |
Right, I thought there was an
I think letting the LinterStats class really handle the stats would remove complexity from Pylinter but it does seem like it's only used through Pylinter so it's not strictly necessary right now. Disentangling it would be theoretically beneficial but also eat up a lot of time and Pylinter would still be a god class handling everything. I'm going to simply add the comment you were suggesting. There's more efficient thing to do to make Pylinter more manageable. Let me know what you think :) |
This permit to reduce the coupling between Pylinter and linterstats. Refactor prior to #4720
cfe4df9
to
4702343
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pierre-Sassoulas Perfect!
The new Literal
is a nice touch! π
Type of Changes
Description
This permit to reduce the coupling between Pylinter and linterstats.
Refactor prior to #4720