Skip filename pattern check for provided files

By default, when discovering files for users, we use the filename
patterns to determine whether or not we should check that file. However,
when a user provides the path to a file, we should instead skip checking
the name against the filename patterns provided.

For example, in Flake8 2.6 this worked:

    $ flake8 bin/
    $ flake8 bin/script

But prior to this commit only

    $ flake8 bin/

works. This commit will skip the filename pattern check if the user
provides the path explicitly which allows

    $ flake8 bin/script

to work again as expected.

Closes #266
parent 3f6cb392
......@@ -275,7 +275,14 @@ class Manager(object):
for argument in paths
for filename in utils.filenames_from(argument,
if should_create_file_checker(filename)
# NOTE(sigmavirus24): If a user explicitly specifies something,
# e.g, ``flake8 bin/script`` then we should run Flake8 against
# that. Since should_create_file_checker looks to see if the
# filename patterns match the filename, we want to skip that in
# the event that the argument and the filename are identical.
# If it was specified explicitly, the user intended for it to be
# checked.
if argument == filename or should_create_file_checker(filename)
]'Checking %d files', len(self.checkers))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment