Commit 00ec2da5 authored by Stan Hu's avatar Stan Hu

Merge branch 'dedicated-gemfile-for-overcommit' into 'master'

Introduce a Gemfile dedicated to Overcommit to avoid conflicts

See merge request gitlab-org/gitlab!23350
parents f4aaffde eb1b96f7
...@@ -83,6 +83,7 @@ package-lock.json ...@@ -83,6 +83,7 @@ package-lock.json
jsdoc/ jsdoc/
**/tmp/rubocop_cache/** **/tmp/rubocop_cache/**
.overcommit.yml .overcommit.yml
.overcommit.yml.backup
.projections.json .projections.json
/qa/.rakeTasks /qa/.rakeTasks
webpack-dev-server.json webpack-dev-server.json
......
...@@ -15,6 +15,13 @@ ...@@ -15,6 +15,13 @@
# #
# Uncomment the following lines to make the configuration take effect. # Uncomment the following lines to make the configuration take effect.
# Make sure to run `cd tooling/overcommit && make && cd -`
gemfile: 'tooling/overcommit/gems.rb'
PostCheckout:
BundleInstall:
enabled: true
PreCommit: PreCommit:
AuthorName: AuthorName:
enabled: false enabled: false
...@@ -35,6 +42,19 @@ PreCommit: ...@@ -35,6 +42,19 @@ PreCommit:
# on_warn: fail # Treat all warnings as failures # on_warn: fail # Treat all warnings as failures
ScssLint: ScssLint:
enabled: true enabled: true
CommitMsg:
TextWidth:
enabled: true
min_subject_width: 8 # three 2-letter words with 2 spaces
max_subject_width: 72
quiet: false
EmptyMessage:
enabled: true
required: true
description: 'Checking for empty commit message'
#PostCheckout: #PostCheckout:
# ALL: # Special hook name that customizes all hooks of this type # ALL: # Special hook name that customizes all hooks of this type
# quiet: true # Change all post-checkout hooks to only display output on failure # quiet: true # Change all post-checkout hooks to only display output on failure
......
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
This is also the style used by linting tools such as This is also the style used by linting tools such as
[RuboCop](https://github.com/rubocop-hq/rubocop) and [Hound CI](https://houndci.com). [RuboCop](https://github.com/rubocop-hq/rubocop) and [Hound CI](https://houndci.com).
You can run RuboCop by hand or install a tool like [Overcommit](https://github.com/sds/overcommit) to run it for you. You can run RuboCop by hand or install a tool like [Overcommit](https://github.com/sds/overcommit) to run it for you.
Overcommit will automatically run the configured checks (like Rubocop) on every modified file before commit. You can use the example overcommit configuration found in `.overcommit.yml.example` as a quickstart.
Overcommit will automatically run the configured checks (like Rubocop) on every modified file before commit.
You can use the example overcommit configuration found in `.overcommit.yml.example` as a quickstart.
This saves you time as you don't have to wait for the same errors to be detected by the CI. This saves you time as you don't have to wait for the same errors to be detected by the CI.
--- ---
......
.PHONY: install
install:
if [ -e ../../.overcommit.yml ]; then cp -f ../../.overcommit.yml ../../.overcommit.yml.backup; fi
cp ../../.overcommit.yml.example ../../.overcommit.yml
bundle install
cd ../../ && overcommit -i
GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
childprocess (3.0.0)
ffi (1.12.1)
gitlab-styles (3.1.0)
rubocop (~> 0.74.0)
rubocop-gitlab-security (~> 0.1.0)
rubocop-performance (~> 1.4.1)
rubocop-rails (~> 2.0)
rubocop-rspec (~> 1.36)
haml (5.1.2)
temple (>= 0.8.0)
tilt
haml_lint (0.34.1)
haml (>= 4.0, < 5.2)
rainbow
rubocop (>= 0.50.0)
sysexits (~> 1.1)
iniparse (1.4.4)
jaro_winkler (1.5.4)
overcommit (0.52.1)
childprocess (>= 0.6.3, < 4)
iniparse (~> 1.4)
parallel (1.19.1)
parser (2.7.0.2)
ast (~> 2.4.0)
rack (2.1.1)
rainbow (3.0.0)
rake (12.3.3)
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
ffi (~> 1.0)
rubocop (0.74.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-gitlab-security (0.1.1)
rubocop (>= 0.51)
rubocop-performance (1.4.1)
rubocop (>= 0.71.0)
rubocop-rails (2.4.1)
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop-rspec (1.37.1)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
sass (3.5.7)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
scss_lint (0.56.0)
rake (>= 0.9, < 13)
sass (~> 3.5.3)
sysexits (1.2.0)
temple (0.8.2)
tilt (2.0.10)
unicode-display_width (1.6.1)
PLATFORMS
ruby
DEPENDENCIES
gitlab-styles (~> 3.1.0)
haml_lint (~> 0.34.0)
overcommit
scss_lint (~> 0.56.0)
BUNDLED WITH
2.1.2
# frozen_string_literal: true
# Make sure to run `bundle install --gemfile=tooling/overcommit/gems.rb` when you update this file.
source 'https://rubygems.org'
gem 'overcommit'
gem 'gitlab-styles', '~> 3.1.0', require: false
gem 'scss_lint', '~> 0.56.0', require: false
gem 'haml_lint', '~> 0.34.0', require: false
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