When should run Rubocop / Lint Tool? • CI(Jenkins) -> Too late... • Manual execution -> Sometimes forgot... • Before git commit/push(overcommit) -> Best
Introducing overcommit • A fully configurable and extendable Git hook manager • Run automatically Rubocop, Brakeman, etc when you execute "Git commands"
Profits of overcommit? • Readability • You can get some suggestions to adjust coding rule in only changed files by Rubocop, EsLint(JS), etc • Vulnerability Scan • You can scan vulnerability in your project by Brakeman, bundle-audit, etc. • Share "Git Best Practice” • Check for illegal pushes to protected branches, commit message matches expected pattern, etc
overcommit tips • If you want to disable overcommit, you can use the follows: $ OVERCOMMIT_DISABLE=1 git commit $ export GIT_TEMPLATE_DIR=`overcommit --template-dir` • If you want to install automatically Overcommit Hooks, please run:
Usage for Local/GitHub # Analyze *all* changes since the *initial* commit (may take some time): $ pronto run --commit=$(git log -- pretty=format:%H | head -1) # if you want comments to appear on pull request diff: $ GITHUB_ACCESS_TOKEN=token pronto run -f github_pr -c origin/master
Configuration for GitLab • The behavior of Pronto can be controlled via the .pronto.yml: all: exclude: - 'spec**/*' gitlab: slug: 445 # Project id api_private_token: 46751 # Get by Profile Seeting api_endpoint: https://gitlabcomapiv3 max_warnings: 150 verbose: false
Usage for GitLab # Get the results as comments on GitLab commits $ GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master