Skip to content
Permalink
Browse files

DEV: Replace Overcommit with Lefthook (#7826)

Overcommit uses prebuilt hooks and require global installation.
To avoid this issues replace it with Lefthook.
Lefthook will be installed with npm packages. New contributors
will have fully consistent git hooks.
  • Loading branch information...
Arkweid authored and ZogStriP committed Jul 2, 2019
1 parent 1b45096 commit 0872a1182d5702cf24bfce8958fc7cf12339c5ae
Showing with 59 additions and 52 deletions.
  1. +0 −45 .overcommit.yml
  2. +1 −7 .travis.yml
  3. +1 −0 Gemfile
  4. +2 −0 Gemfile.lock
  5. +49 −0 lefthook.yml
  6. +1 −0 package.json
  7. +5 −0 yarn.lock

This file was deleted.

@@ -74,13 +74,7 @@ script:
- |
bash -c "
if [ '$RUN_LINT' == '1' ]; then
bundle exec rubocop --parallel && \
yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6"
yarn eslint --ext .es6 app/assets/javascripts && \
yarn eslint --ext .es6 test/javascripts && \
yarn eslint --ext .es6 plugins/**/assets/javascripts && \
yarn eslint --ext .es6 plugins/**/test/javascripts && \
yarn eslint app/assets/javascripts test/javascripts
npx lefthook run lints
else
if [ '$QUNIT_RUN' == '1' ]; then
bundle exec rake qunit:test['1200000'] && \
@@ -152,6 +152,7 @@ group :development do
gem 'bullet', require: !!ENV['BULLET']
gem 'better_errors'
gem 'binding_of_caller'
gem 'yaml-lint'

# waiting on 2.7.5 per: https://github.com/ctran/annotate_models/pull/595
if rails_master?
@@ -412,6 +412,7 @@ GEM
webpush (0.3.8)
hkdf (~> 0.2)
jwt (~> 2.0)
yaml-lint (0.0.10)

PLATFORMS
ruby
@@ -533,6 +534,7 @@ DEPENDENCIES
unicorn
webmock
webpush
yaml-lint

BUNDLED WITH
1.17.3
@@ -0,0 +1,49 @@
pre-commit:
parallel: true
commands:
rubocop:
glob: '*.rb'
run: bundle exec rubocop {staged_files}
eslint:
glob: '*.{js,es6}'
run: yarn eslint --ext .es6 -f compact {staged_files}
yaml-syntax:
glob: '*.{yaml,yml}'
run: bundle exec yaml-lint {staged_files}

commands: &commands
bundle-install:
files: git diff --name-only HEAD master
glob: '{Gemfile,Gemfile.lock,*.gemspec}'
run: bundle install
yarn-install:
files: git diff --name-only HEAD master
glob: '{package.json,yarn.lock}'
run: yarn install

post-checkout:
commands: *commands

post-merge:
commands: *commands

post-rewrite:
commands: *commands

lints:
parallel: true
commands:
rubocop:
run: bundle exec rubocop --parallel
prettier:
run: yarn prettier --list-different app/assets/stylesheets/**/*.scss app/assets/javascripts/**/*.es6 test/javascripts/**/*.es6
eslint-assets:
run: yarn eslint --ext .es6 app/assets/javascripts
eslint-test:
run: yarn eslint --ext .es6 test/javascripts
eslint-plugins-assets:
run: yarn eslint --ext .es6 plugins/**/assets/javascripts
eslint-plugins-test:
run: yarn eslint --ext .es6 plugins/**/test/javascripts
eslint-assets-tests:
run: yarn eslint app/assets/javascripts test/javascripts
@@ -33,6 +33,7 @@
"spectrum-colorpicker": "1.8.0"
},
"devDependencies": {
"@arkweid/lefthook": "^0.5.6",
"babel-eslint": "^8.2",
"chrome-launcher": "^0.10",
"chrome-remote-interface": "^0.25",
@@ -2,6 +2,11 @@
# yarn lockfile v1


"@arkweid/lefthook@^0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@arkweid/lefthook/-/lefthook-0.5.6.tgz#6c44bc257c2ea2c2498c25df1757fd224a69a088"
integrity sha512-hnzXNq/tq7LZGOFE1CigEdSOd1lkhJpUX83pyseIQg7hzrwytnm3+qVLqnMAY/Zk/L7kvWVLXiYxJofDc+2TNg==

"@babel/code-frame@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"

0 comments on commit 0872a11

Please sign in to comment.
You can’t perform that action at this time.