Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a default overcommit config file #335

Merged
merged 1 commit into from
Apr 11, 2017
Merged

Provide a default overcommit config file #335

merged 1 commit into from
Apr 11, 2017

Conversation

vinzent
Copy link
Contributor

@vinzent vinzent commented Apr 8, 2017

Hooks are only enabled if you take action.

To enable the hooks run:

bundle install
bundle exec overcommit --install
bundle exec overcommit --sign

(it will manage the .git/hooks directory):

Examples howto skip a test for a commit or push:

SKIP=RuboCop git commit
SKIP=PuppetLint git commit
SKIP=RakeTask git push

Don't invoke overcommit at all:

OVERCOMMIT_DISABLE=1 git commit

Read more about overcommit: https://github.com/brigade/overcommit

Things to discuss:

  • what to run on PrePush (see hook list on github)
  • what to run on PrePreCommit (see hook list on github)
  • there are also few that are enabled by default (see github overcommit README.md
    • the ones with * prefix in the hook list)
  • do we need to exclude some directories by default (consider: the non-rake
    tasks are only run if a changed file matches an include rule)?
  • i thought about making it configureable with .sync.yml but then decided to do
    it when its really required (maybe only few will use this overcommit thing
    because it needs manual action to enable it)

Hooks are only enabled if you take action.

To enable the hooks run:

```
bundle install
bundle exec overcommit --install
bundle exec overcommit --sign
```

(it will manage the .git/hooks directory):

Examples howto skip a test for a commit or push:

```
SKIP=RuboCop git commit
SKIP=PuppetLint git commit
SKIP=RakeTask git push
```

Don't invoke overcommit at all:

```
OVERCOMMIT_DISABLE=1 git commit
```

Read more about overcommit: https://github.com/brigade/overcommit

Things to dicuss:

* what to run on PrePush (see hook list on github)
* what to run on PrePreCommit (see hook list on github)
* there are also few that are enabled by default (see github overcommit README.md
  - the ones with * prefix in the hook list)
* do we need to exclude some directories by default  (consider: the non-rake
  tasks are only run if a changed file matches an include rule)?
* i thought about making it configureable with .sync.yml but then decided to do
  it when its really required (maybe only few will use this overcommit thing
  because it needs manual action to enable it)
@vinzent
Copy link
Contributor Author

vinzent commented Apr 8, 2017

I've run bundle exec msync update --namespace vinzent --message "Test modulesync" --filter puppet-selinux --branch modulesync_testto test-apply the modulesync and it prevented me to push a change to puppet-selinux because of new puppet-lint errors.

RuboCop:
enabled: true
description: 'Runs rubocop on modified files only'
command: ['bundle', 'exec', 'rubocop']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use the rake task here? Or as an alternative:
bundle exec rubocop -c .rubocop.yml -D -S

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RakeTask rubocop will run on every commit. RuboCop task will only run if there is a ruby file involved with the commit.

as commit needs to be fast i've choosen the builtin tasks instead of the file unaware rake-task.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the command is maybe missleading. overcommit will not just run plain rubocop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bastelfreak bastelfreak merged commit 96f89e2 into voxpupuli:master Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants