mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	pre-commit: Fix shellcheck warnings.
In tools/pre-commit line 18:
if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
                            ^-- SC2092: Remove backticks to avoid executing output.
                            ^-- SC2006: Use $(..) instead of legacy `..`.
                             ^-- SC2230: which is non-standard. Use builtin 'command -v' instead.
In tools/pre-commit line 23:
    ./tools/lint --no-gitlint --force $changed_files || true
                                      ^-- SC2086: Double quote to prevent globbing and word splitting.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							695d8d0bd1
						
					
				
				
					commit
					49ae9c1e44
				
			@@ -9,17 +9,20 @@
 | 
				
			|||||||
# contains your provisioned Zulip development environment, the linter
 | 
					# contains your provisioned Zulip development environment, the linter
 | 
				
			||||||
# will automatically be run through `vagrant ssh`.
 | 
					# will automatically be run through `vagrant ssh`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
changed_files=$(git diff --cached --name-only --diff-filter=ACM)
 | 
					changed_files=()
 | 
				
			||||||
if [ -z "$changed_files" ]; then
 | 
					while read -r -d '' f; do
 | 
				
			||||||
 | 
					    changed_files+=("$f")
 | 
				
			||||||
 | 
					done < <(git diff -z --cached --name-only --diff-filter=ACM)
 | 
				
			||||||
 | 
					if [ ${#changed_files} -eq 0 ]; then
 | 
				
			||||||
    echo "No changed files to lint."
 | 
					    echo "No changed files to lint."
 | 
				
			||||||
    exit 0
 | 
					    exit 0
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -z "$VIRTUAL_ENV" ] && `which vagrant > /dev/null` && [ -e .vagrant ]; then
 | 
					if [ -z "$VIRTUAL_ENV" ] && command -v vagrant > /dev/null && [ -e .vagrant ]; then
 | 
				
			||||||
    vcmd="/srv/zulip/tools/lint --no-gitlint --force $changed_files || true"
 | 
					    vcmd="/srv/zulip/tools/lint --no-gitlint --force $(printf '%q ' "${changed_files[@]}") || true"
 | 
				
			||||||
    echo "Running lint using vagrant..."
 | 
					    echo "Running lint using vagrant..."
 | 
				
			||||||
    vagrant ssh -c "$vcmd"
 | 
					    vagrant ssh -c "$vcmd"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    ./tools/lint --no-gitlint --force $changed_files || true
 | 
					    ./tools/lint --no-gitlint --force "${changed_files[@]}" || true
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user