Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def do_test(self):
arglist = ['--exclude=migrations', filepath]
pep8.process_options(arglist)
pep8.input_dir(filepath)
output = pep8.get_statistics()
# print "PEP8 OUTPUT: " + str(output)
self.assertEqual(len(output), 0)
def runpep8():
# Hook into stdout.
old_stdout = sys.stdout
sys.stdout = mystdout = StringIO()
# Run Pep8 checks.
pep8.options, pep8.args = pep8.process_options()
pep8.input_dir(MODULE)
# Restore stdout.
sys.stdout = old_stdout
# Save result to pep8.txt.
result = mystdout.getvalue()
output = open('pep8.txt', 'w')
output.write(result)
output.close()
# Return Pep8 result
return result
def runpep8(package):
# Hook into stdout.
old_stdout = sys.stdout
sys.stdout = mystdout = StringIO()
# Run Pep8 checks.
pep8.options, pep8.args = pep8.process_options()
pep8.options.repeat = True
pep8.input_dir(package)
# Restore stdout.
sys.stdout = old_stdout
# Save result to pep8.txt.
result = mystdout.getvalue()
output = open('pep8.txt', 'w')
output.write(result)
output.close()
# Return Pep8 result
if result:
return result
else:
return None
'--statistics',
'--filename=*.py',
'--show-source',
'--benchmark',
'--repeat',
'--show-pep8',
# '--qq',
# '-v',
BASE_DIR, ]
options, args = pep8.process_options(arglist)
runner = pep8.input_file
for path in args:
if os.path.isdir(path):
pep8.input_dir(path, runner=runner)
elif not pep8.excluded(path):
options.counters['files'] += 1
runner(path)
pep8.print_statistics()
errors = pep8.get_count('E')
warnings = pep8.get_count('W')
message = 'pep8: %d errors / %d warnings' % (errors, warnings)
print(message)
assert errors + warnings == 0, message
def main():
"""
Parse options and run checks on Python source.
"""
pep8.options = options()
repo = dirname(dirname(abspath(__file__)))
pep8.input_dir(repo)
def main():
"""
Parse options and run checks on Python source.
"""
pep8.options = options()
repo = dirname(dirname(abspath(__file__)))
pep8.input_dir(repo)