generated from daniil-berg/boilerplate-py
	Initial commit
This commit is contained in:
		
							
								
								
									
										16
									
								
								scripts/lint.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								scripts/lint.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| #!/usr/bin/env bash | ||||
| # Runs type checker and linters. | ||||
|  | ||||
| # Ensure that we return to the current working directory | ||||
| # and exit the script immediately in case of an error: | ||||
| trap "cd $(realpath ${PWD}); exit 1" ERR | ||||
| # Change into project root directory: | ||||
| cd "$(dirname $(dirname $(realpath $0)))" | ||||
|  | ||||
| echo 'Performing type checks...' | ||||
| mypy | ||||
| echo | ||||
|  | ||||
| echo 'Linting source and test files...' | ||||
| flake8 src/ tests/ | ||||
| echo -e 'No issues found.' | ||||
							
								
								
									
										17
									
								
								scripts/test.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								scripts/test.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| #!/usr/bin/env bash | ||||
| # Runs unit tests and prints only coverage percentage, if successful. | ||||
| # If an error occurs, prints the entire unit tests progress output. | ||||
|  | ||||
| # Ensure that we return to the current working directory in case of an error: | ||||
| trap "cd $(realpath ${PWD})" ERR | ||||
| # Change into project root directory: | ||||
| cd "$(dirname $(dirname $(realpath $0)))" | ||||
|  | ||||
| coverage erase | ||||
| # Capture the test progression in a variable: | ||||
| typeset progress | ||||
| progress=$(coverage run 2>&1) | ||||
| # If tests failed or produced errors, write progress/messages to stderr and exit: | ||||
| [[ $? -eq 0 ]] || { >&2 echo "${progress}"; exit 1; } | ||||
| # Otherwise extract the total coverage percentage from the produced report and write it to stdout: | ||||
| coverage report | awk '$1 == "TOTAL" {print $NF; exit}' | ||||
		Reference in New Issue
	
	Block a user