mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	lint: Include pep8 checks in pre-commit hook.
This commit is contained in:
		@@ -136,6 +136,8 @@ def check_pep8(files):
 | 
				
			|||||||
        # Fixing these would probably reduce readability in most cases.
 | 
					        # Fixing these would probably reduce readability in most cases.
 | 
				
			||||||
        'E731',
 | 
					        'E731',
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					    if len(files) == 0:
 | 
				
			||||||
 | 
					        return False
 | 
				
			||||||
    pep8 = subprocess.Popen(
 | 
					    pep8 = subprocess.Popen(
 | 
				
			||||||
        ['pycodestyle'] + files + ['--ignore={rules}'.format(rules=','.join(ignored_rules))],
 | 
					        ['pycodestyle'] + files + ['--ignore={rules}'.format(rules=','.join(ignored_rules))],
 | 
				
			||||||
        stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
 | 
					        stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,10 +10,10 @@
 | 
				
			|||||||
# will automatically be run through `vagrant ssh`.
 | 
					# will automatically be run through `vagrant ssh`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
 | 
					if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
 | 
				
			||||||
    vcmd='/srv/zulip/tools/lint-all --force $(cd /srv/zulip && git diff --cached --name-only --diff-filter=ACM) || true'
 | 
					    vcmd='/srv/zulip/tools/lint-all --pep8 --force $(cd /srv/zulip && git diff --cached --name-only --diff-filter=ACM) || true'
 | 
				
			||||||
    echo "Running lint-all using vagrant..."
 | 
					    echo "Running lint-all using vagrant..."
 | 
				
			||||||
    vagrant ssh -c "$vcmd"
 | 
					    vagrant ssh -c "$vcmd"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    ./tools/lint-all --force $(git diff --cached --name-only --diff-filter=ACM) || true
 | 
					    ./tools/lint-all --pep8 --force $(git diff --cached --name-only --diff-filter=ACM) || true
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user