mirror of https://github.com/zulip/zulip.git
Check for whitespace in check-all.
Exit with a failing status if any of your non-excluded JS/Python files have trailing whitespace. (imported from commit 0aa184fa85a4a1ddeef6ea40dff57ce43c10e459)
This commit is contained in:
parent
303b8174ac
commit
322128a771
|
@ -55,8 +55,11 @@ for filepath in git_files:
|
|||
|
||||
by_lang[exn].append(filepath)
|
||||
|
||||
def has_trailing_whitespace(fn):
|
||||
return any(re.search('\s+$', line.strip('\n')) for line in open(fn))
|
||||
|
||||
# Invoke the appropriate lint checker for each language
|
||||
# Invoke the appropriate lint checker for each language,
|
||||
# and also check files for extra whitespace.
|
||||
|
||||
try:
|
||||
failed = False
|
||||
|
@ -71,6 +74,11 @@ try:
|
|||
except subprocess.CalledProcessError:
|
||||
failed = True
|
||||
|
||||
for fn in by_lang['.js'] + by_lang['.py']:
|
||||
if has_trailing_whitespace(fn):
|
||||
sys.stdout.write('Fix whitespace in %s\n' % fn)
|
||||
failed = True
|
||||
|
||||
pyflakes = subprocess.Popen(['pyflakes'] + by_lang['.py'],
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE)
|
||||
|
|
Loading…
Reference in New Issue