Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name = 'Trimming trailing whitespace'
matching_files_command = '%s | xargs egrep -l "[[:space:]]$"' % ALL_FILES
def fix_file(self, file):
subprocess.check_call(['sed', '-i', '-e', 's/[[:space:]]*$//', file])
class FixLineEndings(FixAllBase):
name = 'Fixing line endings'
matching_files_command = "%s | xargs egrep -l $'\\r'\\$" % ALL_FILES
def fix_file(self, file):
subprocess.check_call(['dos2unix', file])
subprocess.check_call(['mac2unix', file])
FIXERS = [
FixTrailingWhitespace,
FixLineEndings,
]
def run_tests():
passed = True
for test in TESTS:
run_test = get_git_config('hooks.%s' % test.config)
if run_test == 'false':
print 'Skipping "%s" due to git config.' % test.name
continue
try:
retcode = 0
output = subprocess.check_output(
test.command, shell=True, stderr=subprocess.STDOUT
)
name = 'Trimming trailing whitespace'
matching_files_command = '%s | xargs egrep -l "[[:space:]]$"' % ALL_FILES
def fix_file(self, file):
subprocess.check_call(['sed', '-i', '-e', 's/[[:space:]]*$//', file])
class FixLineEndings(FixAllBase):
name = 'Fixing line endings'
matching_files_command = "%s | xargs egrep -l $'\\r'\\$" % ALL_FILES
def fix_file(self, file):
subprocess.check_call(['dos2unix', file])
subprocess.check_call(['mac2unix', file])
FIXERS = [
FixTrailingWhitespace,
FixLineEndings,
]
def run_tests():
passed = True
for test in TESTS:
run_test = get_git_config('hooks.%s' % test.config)
if run_test == 'false':
print 'Skipping "%s" due to git config.' % test.name
continue
try:
retcode = 0
output = subprocess.check_output(
test.command, shell=True, stderr=subprocess.STDOUT
)