Commit dbe9d92c authored by Nick Stalter's avatar Nick Stalter

inital commit

parents
module Overcommit
module Hook
module PreCommit
# Gherkin Validator that makes sure all the gherkin is parsable and doesnt cause issues
class GherkinValidator < Base
def run
puts 'Starting Gherking Validation'
status = system('bundle', 'exec', 'cucumber', '-t', '@gherkin_validation')
puts 'Gherkin Validated' if status
status ? :pass : :fail
end
end
end
end
end
\ No newline at end of file
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/brigade/overcommit/blob/master/config/default.yml
#
# At the topmost level of this YAML file is a key representing type of hook
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
# customize each hook, such as whether to only run it on certain files (via
# `include`), whether to only display output if it fails (via `quiet`), etc.
#
# For a complete list of hooks, see:
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
#
# For a complete list of options that you can use to customize hooks, see:
# https://github.com/brigade/overcommit#configuration
#
# Uncomment the following lines to make the configuration take effect.
verify_signatures: false
PreCommit:
ALL:
problem_on_unmodified_line: ignore
required: false
BrokenSymlinks:
enabled: false
RuboCop:
enabled: true
command: [rubocop', '-c', '.rubocop.yml']
GherkinValidator:
enabled: true
description: 'Makes sure that gherkin isnt broken'
include: '**/*.feature'
\ No newline at end of file
# Rubocop version - 0.49.1
AllCops:
Include:
- Gemfile
- Rakefile
Exclude:
- bin/**/*
- vendor/**/*
- tmp/**/*
- script/**/*
Metrics/ClassLength:
Max: 200
CountComments: false
Lint/RescueException:
Enabled: false
Metrics/AbcSize:
Max: 43
Metrics/CyclomaticComplexity:
Max: 18
Metrics/PerceivedComplexity:
Max: 12
Lint/AmbiguousRegexpLiteral:
Enabled: false
CollectionMethods:
Enabled: false
Encoding:
Enabled: false
LineLength:
Max: 420
Documentation:
Enabled: false
CaseIndentation:
Enabled: false
DotPosition:
Enabled: false
MethodLength:
CountComments: false
Max: 25
AlignParameters:
Enabled: false
IfUnlessModifier:
Enabled: false
TrailingCommaInLiteral:
Enabled: false
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 172
EndOfLine:
Enabled: false
Style/Semicolon:
Enabled: false
Style/RegexpLiteral:
AllowInnerSlashes: true
Metrics/ParameterLists:
Max: 6
\ No newline at end of file
# Rubocop Config
### Purpose
The purpose of this repo is to have a standardized code quality process.
We use [overcommit](https://github.com/brigade/overcommit) and [rubocop](https://github.com/bbatsov/rubocop) to sure that new code being added to the project maintains the common vision of coding standards.
### Requirements
* Rubocop - latest(0.49.x) - The Rubocop project has been renaming their cops and can cause conflicts with older versions.
* Overcommit - latest(0.39.x)
### Initial Setup
To get setup with overcommit please run the following:
* `gem install rubocop`
* `gem install overcommit`
* `overcommit --install`
* Copy over the files in this repo in to the root of your project
* `rm ./.git/hooks/commit-msg`
* `mv ./.git/hooks/old-hooks/commit-msg ./.git/hooks/` | __note__: the setup script stops after this command
* `overcommit --sign` | __note__: any changes made to the overcommit.yml needs to run `overcommit --sign` before new changes to be taken.
You can now `git add` your files and `git commit -m` your message
### Existing setup
Once the initial setup has been completed and pushed to your repo you can run the following script `ruby bin/overcommit_setup.rb`
### Git hooks
* Rubocop - using the provided style guide - please tweak to your projects needs
* Gherkin Validator - Simple command to parse the gherkin and make sure there are no formatting issues.
### Contibuting
* Fork the repo
* Make your changes on your fork
* Submit merge request
\ No newline at end of file
puts 'Installing rubocop gem...'
`gem install rubocop`
puts 'Installing overcommit gem...'
`gem install overcommit`
puts 'Running "overcommit --install"...'
`overcommit --install`
puts 'Removing commit-msg from git hooks...'
`rm ./.git/hooks/commit-msg`
puts 'Moving old commit message file back into git hooks...'
`mv ./.git/hooks/old-hooks/commit-msg ./.git/hooks/`
puts 'Signing overcommit...'
`overcommit --sign`
puts 'Finished.'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment