sds / overcommit

A fully configurable and extendable Git hook manager
MIT License
3.91k stars 280 forks source link

Help For Using Overcommit With A Dockerized Application #794

Closed santosral closed 2 years ago

santosral commented 2 years ago

Hi Guys,

I hope you're doing well!

I need help or guidance on how I will implement the overcommit if our application is in a Docker Container.

Looking forward to your suggestions/ideas.

dickdavis commented 2 years ago

Since the git hooks aren't invoked within the context of the docker container, you'll need to have the overcommit gem installed on your local system.

Also, you'll need to modify the commands used to execute the hooks. Here's an example config:

PreCommit:
  CustomRuboCop:
    enabled: true
    on_warn: fail
    command: ['docker-compose', 'exec', '-T', 'app', 'bundle', 'exec', 'rubocop', '.']

  CustomReek:
    enabled: true
    command: ['docker-compose', 'exec', '-T', 'app', 'bundle', 'exec', 'reek']

PrePush:
  CustomBrakeman:
    enabled: true
    command: ['docker-compose', 'exec', '-T', 'app', 'bundle', 'exec', 'brakeman', '--force']

PostCheckout:
  ALL:
    quiet: true

  IndexTags:
    enabled: true