summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-11-19 08:21:36 -0600
committerIan Cordasco <graffatcolmingov@gmail.com>2016-11-19 08:21:36 -0600
commit78e8165b06ada2a027f4c9976889bbe863c24cbd (patch)
treee6ef4b496bca8775b125e9b38f18b6e87e1e6f1b /src
parent3f6cb392191bb1124cce2ef8d0286b5729e7c0fe (diff)
downloadflake8-78e8165b06ada2a027f4c9976889bbe863c24cbd.tar.gz
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/script.py $ flake8 bin/script But prior to this commit only $ flake8 bin/script.py 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
Diffstat (limited to 'src')
-rw-r--r--src/flake8/checker.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index b4e22b2..cf25117 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -275,7 +275,14 @@ class Manager(object):
for argument in paths
for filename in utils.filenames_from(argument,
self.is_path_excluded)
- 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)
]
LOG.info('Checking %d files', len(self.checkers))