sds / overcommit

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

Using semistandard with --fix option <question> #426

Closed oleksiireshetnik closed 8 years ago

oleksiireshetnik commented 8 years ago

I want to run semistandard's code style fix procedure before each commit (so i can disregard trailing spaces errors and similar stuff). Can i achieve this behaviour now?

sds commented 8 years ago

Hey @getupandgo,

All pre-commit hooks support the flags option, allowing you to specify the list of flags passed to the command.

Looking at the default configuration for Semistandard:

  SemiStandard:
    enabled: false
    description: 'Analyze with semistandard'
    required_executable: 'semistandard'
    flags: ['--verbose']
    install_command: 'npm install -g semistandard'
    include: '**/*.js'

...you can easily add the --fix flag to the flags option. Therefore your .overcommit.yml will look like:

PreCommit:
  SemiStandard:
    enabled: true
    flags: ['--verbose', '--fix']

This is documented in the Hook Options section of the README.

oleksiireshetnik commented 8 years ago

That did a trick. Thanks a lot!