Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

Commit

Permalink
Make the default filename pattern *.py and only use this setting when
Browse files Browse the repository at this point in the history
traversing directories.
  • Loading branch information
SmileyChris committed Oct 19, 2009
1 parent abb45b1 commit 9913903
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number)
__version__ = '0.2.0'
__revision__ = '$Rev$'

DEFAULT_EXCLUDE = '.svn,CVS,*.pyc,*.pyo'
DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git'

INDENT_REGEX = re.compile(r'([ \t]*)')
RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*(,)')
Expand Down Expand Up @@ -893,7 +893,7 @@ def input_file(filename):
"""
Run all checks on a Python source file.
"""
if excluded(filename) or not filename_match(filename):
if excluded(filename):
return {}
if options.verbose:
message('checking ' + filename)
Expand Down Expand Up @@ -928,7 +928,8 @@ def input_dir(dirname):
dirs.remove(subdir)
files.sort()
for filename in files:
input_file(os.path.join(root, filename))
if filename_match(filename):
input_file(os.path.join(root, filename))


def excluded(filename):
Expand Down Expand Up @@ -1084,9 +1085,13 @@ def process_options(arglist=None):
parser.add_option('-q', '--quiet', default=0, action='count',
help="report only file names, or nothing with -qq")
parser.add_option('--exclude', metavar='patterns', default=DEFAULT_EXCLUDE,
help="skip matches (default %s)" % DEFAULT_EXCLUDE)
parser.add_option('--filename', metavar='patterns',
help="only check matching files (e.g. *.py)")
help="exclude files or directories which match these "
"comma separated patterns (default: %s)" %
DEFAULT_EXCLUDE)
parser.add_option('--filename', metavar='patterns', default='*.py',
help="when parsing directories, only check filenames "
"matching these comma separated patterns (default: "
"*.py)")
parser.add_option('--ignore', metavar='errors', default='',
help="skip errors and warnings (e.g. E4,W)")
parser.add_option('--repeat', action='store_true',
Expand Down

0 comments on commit 9913903

Please sign in to comment.