Skip to content

lefthook: Run RuboCop in pre-push as well

Peter Leitzen requested to merge pl-lefthook-rubocop-pre-push into master

What does this MR do and why?

Some developers tend to disable pre-commit hooks to speed up their flow so having RuboCop run in pre-push (as a safety net) is crucial.

Refs !127376 (comment 1501398064)

How to set up and validate locally

  1. Check out this branch
  2. Add a misplaced newline in lib/backup.rb, e.g. right after module Backup
  3. Commit the change skipping lefthook: LEFTHOOK=0 git commit -m "Just testing" lib/backup.rb
  4. Run lefthook run pre-push
  5. See 👇
$ be lefthook run pre-push
Lefthook v1.4.7
RUNNING HOOK: pre-push
merge_conflicts: (skip) settings

  EXECUTE > security_harness

static-verification: (skip) settings
eslint: (skip) no files for inspection
db-schema-changes: (skip) no files for inspection
docs-trailing_spaces: (skip) no files for inspection
audit_event_types_docs: (skip) no files for inspection
graphql_docs: (skip) no files for inspection
docs-deprecations: (skip) no files for inspection
prettier: (skip) no files for inspection
docs-metadata: (skip) no files for inspection
markdownlint: (skip) no files for inspection
jsonlint: (skip) no files for inspection
haml-lint: (skip) no files for inspection
stylelint: (skip) no files for inspection
sidekiq-queues: (skip) no files for inspection
gettext: (skip) no files for inspection
vale: (skip) no files for inspection

  EXECUTE > yamllint

bundler-checksum-lint: (skip) no matching push files
danger: (skip) no matching push files

  EXECUTE > rubocop
Inspecting 1 file
C

Offenses:

lib/backup.rb:4:1: C: [Correctable] Layout/EmptyLinesAroundModuleBody: Extra empty line detected at module body beginning.

1 file inspected, 1 offense detected, 1 offense autocorrectable


SUMMARY: (done in 2.54 seconds)
✔️  security_harness
✔️  yamllint
🥊  rubocop

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports