Unify formatting and linting
Ensures optimal formatting in addition to linting during manual deploys and during pre-commit actions.
This commit is contained in:
		@@ -4,11 +4,9 @@ pushd $( git rev-parse --show-toplevel ) &>/dev/null
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ex=0
 | 
					ex=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Linting
 | 
					./prepare
 | 
				
			||||||
echo "Linting..."
 | 
					 | 
				
			||||||
./lint
 | 
					 | 
				
			||||||
if [[ $? -ne 0 ]]; then
 | 
					if [[ $? -ne 0 ]]; then
 | 
				
			||||||
    echo "Aborting commit due to linting errors."
 | 
					    echo "Aborting commit due to formatting or linting errors."
 | 
				
			||||||
    ex=1
 | 
					    ex=1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,9 @@ fi
 | 
				
			|||||||
HOSTS=( ${@} )
 | 
					HOSTS=( ${@} )
 | 
				
			||||||
echo "> Deploying to host(s): ${HOSTS[@]}"
 | 
					echo "> Deploying to host(s): ${HOSTS[@]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Lint to prevent deploying bad code
 | 
					# Prepare code
 | 
				
			||||||
echo -n "Linting code for errors... "
 | 
					echo "Preparing code (format and lint)..."
 | 
				
			||||||
./lint || exit
 | 
					./prepare || exit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build the packages
 | 
					# Build the packages
 | 
				
			||||||
echo -n "Building packages... "
 | 
					echo -n "Building packages... "
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								format
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								format
									
									
									
									
									
								
							@@ -5,6 +5,7 @@ if ! which black &>/dev/null; then
 | 
				
			|||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Formatting..."
 | 
				
			||||||
black --safe --exclude api-daemon/migrations .
 | 
					black --safe --exclude api-daemon/migrations .
 | 
				
			||||||
ret=$?
 | 
					ret=$?
 | 
				
			||||||
if [[ $ret -eq 0 ]]; then
 | 
					if [[ $ret -eq 0 ]]; then
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								lint
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								lint
									
									
									
									
									
								
							@@ -5,6 +5,7 @@ if ! which flake8 &>/dev/null; then
 | 
				
			|||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Linting..."
 | 
				
			||||||
flake8
 | 
					flake8
 | 
				
			||||||
ret=$?
 | 
					ret=$?
 | 
				
			||||||
if [[ $ret -eq 0 ]]; then
 | 
					if [[ $ret -eq 0 ]]; then
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user