allow packages/modules as args with files in cfg #9834
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently only files can be specified on the command line if files are
specified in mypy.ini. This looks a great deal like a bug, especially
since packages and modules cannot be specified in the configuration
file.
This PR changes the logic to only use the files from the ini
file if none of (modules/packages/files) are specified on the command
line and adds tests to verify the new behavior.
I would also like to add packages and modules keys to the configuration file so a project I work on can use packages as its default without arguments, but want to gauge interest in that first, where this looked like it was probably a mistake with a straightforward solution.
Test Plan
Three new tests have been added to the codlin.test file that test that the conflict is still noted when both are placed on the command line, as well as two tests that ensure the right package/module is selected and checked when a package or module is on the command line with files in the config.
This is my first time working with this test format, pytest runs them and gives reliable results on my machine for these new tests, but if these are outside of style or similar I'll be happy to fix them.