Skip to content

Commit

Permalink
Merge pull request #111 from emonty/master
Browse files Browse the repository at this point in the history
 Allow exclude patterns to match directory paths.
  • Loading branch information
florentx committed Dec 9, 2012
2 parents 7f2d5a3 + b7f18dc commit 504660c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ def input_dir(self, dirname):
print('directory ' + root)
counters['directories'] += 1
for subdir in sorted(dirs):
if self.excluded(subdir):
if self.excluded(os.path.join(root, subdir)):
dirs.remove(subdir)
for filename in sorted(files):
# contain a pattern that matches?
Expand All @@ -1626,7 +1626,10 @@ def excluded(self, filename):
Check if options.exclude contains a pattern that matches filename.
"""
basename = os.path.basename(filename)
return filename_match(basename, self.options.exclude, default=False)
return any((filename_match(filename, self.options.exclude,
default=False),
filename_match(basename, self.options.exclude,
default=False)))

def ignore_code(self, code):
"""
Expand Down

0 comments on commit 504660c

Please sign in to comment.