Skip to content

Commit

Permalink
Update CI and RuboCop linter
Browse files Browse the repository at this point in the history
  • Loading branch information
hasghari committed May 9, 2020
1 parent b5a9d64 commit 6d8faa7
Show file tree
Hide file tree
Showing 14 changed files with 255 additions and 181 deletions.
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2.1

orbs:
ruby: g2crowd/[email protected]

workflows:
version: 2
build:
jobs:
- ruby/build:
context: g2crowd-global
ruby: '2.6.6'
redis: '2.8'
postgres: '12.2'
3 changes: 1 addition & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ plugins:
fixme:
enabled: true
rubocop:
enabled: true
channel: rubocop-0-80
enabled: false
18 changes: 18 additions & 0 deletions .github/config/rubocop_linter_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
check_name: 'RuboCop'

# Instead of installing gems from rubygems, we can run `bundle install` on your project,
# you would need to do this if you are using something like 'rubocop-github' or if you don't
# want to list out dependencies with the `versions` key.
# Valid options: true || false
# Default: false
bundle: true

gemfile: .overcommit_gems.rb

# The scope of code that Rubocop should lint. Use this if you only want to lint changed files. If this is not set
# or not equal to 'modified', Rubocop is run against the entire codebase. Note that this will not work on the master branch.
# Valid options: 'modified'
# Default: nil
check_scope: 'modified'

rubocop_force_exclusion: true
17 changes: 17 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linters

on:
push:
branches-ignore:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Rubocop Linter
uses: g2crowd/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 0 additions & 56 deletions .github/workflows/ruby.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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.

gemfile: '.overcommit_gems.rb'
verify_signatures: false

CommitMsg:
TrailingPeriod:
enabled: false
SingleLineSubject:
enabled: true
TextWidth:
enabled: true
max_subject_width: 70
max_body_width: 70

PrePush:
ProtectedBranches:
enabled: true
branches:
- master

PreCommit:
RuboCop:
enabled: true
on_warn: fail # Treat all warnings as failures

TrailingWhitespace:
enabled: true

HardTabs:
enabled: true

FixMe:
enabled: true
on_warn: fail
keywords: ['FIXME', 'TODO']
exclude:
- '.overcommit.yml'

ForbiddenBranches:
enabled: true
branch_patterns:
- master
5 changes: 5 additions & 0 deletions .overcommit_gems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'
ruby '2.6.6'

gem 'overcommit'
gem 'rubocop-g2'
63 changes: 63 additions & 0 deletions .overcommit_gems.rb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.0)
childprocess (3.0.0)
concurrent-ruby (1.1.6)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
iniparse (1.5.0)
jaro_winkler (1.5.4)
minitest (5.14.0)
overcommit (0.52.1)
childprocess (>= 0.6.3, < 4)
iniparse (~> 1.4)
parallel (1.19.1)
parser (2.7.1.2)
ast (~> 2.4.0)
rack (2.2.2)
rainbow (3.0.0)
rexml (3.2.4)
rubocop (0.82.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-g2 (1.1.0)
rubocop (= 0.82.0)
rubocop-rails (= 2.5.2)
rubocop-rspec (= 1.39.0)
rubocop-rails (2.5.2)
activesupport
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop-rspec (1.39.0)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
zeitwerk (2.3.0)

PLATFORMS
ruby

DEPENDENCIES
overcommit
rubocop-g2

RUBY VERSION
ruby 2.6.6p146

BUNDLED WITH
1.17.3
36 changes: 4 additions & 32 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
inherit_gem:
rubocop-g2:
- config/ruby/default.yml

AllCops:
Exclude:
- spec/dummy/**/*

Layout/LineLength:
Max: 120

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented_relative_to_receiver

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

Style/Documentation:
Enabled: false

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/HashTransformValues:
Enabled: true

Style/NumericLiterals:
Enabled: false

Style/PercentLiteralDelimiters:
PreferredDelimiters:
default: ()
'%w': '()'
'%W': '()'
'%i': '()'
'%I': '()'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.5
2.6.6
8 changes: 0 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use a debugger
# gem 'byebug', group: [:development, :test]
Loading

0 comments on commit 6d8faa7

Please sign in to comment.