Skip to content

Instantly share code, notes, and snippets.

@jayczech23
Last active May 4, 2020 15:52
Show Gist options
  • Save jayczech23/21c923a0a44ae7eb77a532c6974721e1 to your computer and use it in GitHub Desktop.
Save jayczech23/21c923a0a44ae7eb77a532c6974721e1 to your computer and use it in GitHub Desktop.
Run python Linter with a minimum passing score
"""
Wrapper for Pylint to
specify a minimum Pylint
score required to pass
'static_analysis' job.
"""
import sys
from pylint import lint
THRESHOLD = 8
if len(sys.argv) < 2:
raise ArgumentError('Module/Package to evaluate needs to be first argument')
run = lint.Run([sys.argv[1]], do_exit=False)
score = run.linter.stats['global_note']
if score < THRESHOLD:
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment