Skip to content

Commit

Permalink
Add linters configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
abdelp committed Jun 9, 2020
1 parent f31504d commit b285756
Show file tree
Hide file tree
Showing 7 changed files with 10,833 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Linters

on: pull_request

env:
FORCE_COLOR: 1

jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Setup Rubocop
run: |
gem install --no-document rubocop:'~>0.81.0' # https://docs.rubocop.org/en/stable/installation/
[ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.rubocop.yml
- name: Rubocop Report
run: rubocop --color
stylelint:
name: Stylelint
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Setup Stylelint
run: |
npm install --save-dev [email protected] [email protected] [email protected]
[ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.stylelintrc.json
- name: Stylelint Report
run: npx stylelint "**/*.{css,scss}"
59 changes: 59 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
AllCops:
Exclude:
- "db/**/*"
- "bin/*"
- "config/**/*"
- "Guardfile"
- "Rakefile"
- "node_modules/**/*"

DisplayCopNames: true

Layout/LineLength:
Max: 120
Metrics/MethodLength:
Include:
- "app/controllers/*"
- "app/models/*"
Max: 20
Metrics/AbcSize:
Include:
- "app/controllers/*"
- "app/models/*"
Max: 50
Metrics/ClassLength:
Max: 150
Metrics/BlockLength:
ExcludedMethods: ['describe']
Max: 30

Style/Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/EachForSimpleLoop:
Enabled: false
Style/AndOr:
Enabled: false
Style/DefWithParentheses:
Enabled: false
Style/FrozenStringLiteralComment:
EnforcedStyle: never

Layout/HashAlignment:
EnforcedColonStyle: key
Layout/ExtraSpacing:
AllowForAlignment: false
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
Lint/RaiseException:
Enabled: false
Lint/StructNewOverride:
Enabled: false
Style/HashEachMethods:
Enabled: false
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: false
14 changes: 14 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ["stylelint-config-standard"],
"plugins": ["stylelint-scss"],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true
},
"ignoreFiles": [
"build/**",
"dist/**",
"**/reset*.css",
"**/bootstrap*.css"
]
}
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'rubocop', '~>0.8'
end

group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
gem 'web-console', '>= 3.3.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
21 changes: 21 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.0)
bindex (0.8.1)
bootsnap (1.4.6)
msgpack (~> 1.0)
Expand Down Expand Up @@ -90,6 +91,9 @@ GEM
nio4r (2.5.2)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
parallel (1.19.1)
parser (2.7.1.3)
ast (~> 2.4.0)
pg (1.2.3)
puma (4.3.5)
nio4r (~> 2.0)
Expand Down Expand Up @@ -124,10 +128,25 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (1.7.1)
rexml (3.2.4)
rubocop (0.85.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.0.3)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)
parser (>= 2.7.0.1)
ruby-progressbar (1.10.1)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
Expand Down Expand Up @@ -157,6 +176,7 @@ GEM
turbolinks-source (5.2.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
web-console (4.0.2)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand All @@ -182,6 +202,7 @@ DEPENDENCIES
pg (>= 0.18, < 2.0)
puma (~> 4.1)
rails (~> 6.0.3, >= 6.0.3.1)
rubocop (~> 0.8)
sass-rails (>= 6)
spring
spring-watcher-listen (~> 2.0.0)
Expand Down
Loading

0 comments on commit b285756

Please sign in to comment.