Skip to content

Commit 621f4cc

Browse files
author
pierre golfier
authored
Merge pull request #1 from codeur/first-version
v0.1.0
2 parents f88d37d + 6b770ed commit 621f4cc

File tree

9 files changed

+256
-1
lines changed

9 files changed

+256
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
Gemfile.lock

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
inherit_from: default.yml

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
# Specify your gem's dependencies in attacked.gemspec.
6+
gemspec

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1-
# Codeur Rubostyle
1+
# Rubocop Codeur
22
Shared rubocop config gem for every Ruby projects at Codeur SARL
33

4+
## Installation
5+
Add this lines to your application's Gemfile:
6+
```ruby
7+
group :development do
8+
gem 'rubocop-codeur'
9+
end
10+
```
11+
12+
Or, for a Ruby library, add this to your gemspec:
13+
```ruby
14+
spec.add_development_dependency 'rubocop-codeur'
15+
```
16+
17+
## Usage
18+
Create a `.rubocop.yml` with the following directives:
19+
```yml
20+
inherit_gem:
21+
rubocop-codeur:
22+
- default.yml
23+
```
24+
25+
Then run:
26+
`bundle exec rubocop`
27+
28+
You do not need to include rubocop directly in your application's dependencies. rubocop-codeur will include `rubocop`, `rubocop-minitest`, `rubocop-performance` and `rubocop-rails` dependencies.
29+
30+
## FYI
31+
It might be necessary to override style rules set in this gem for some projects or to add specific ones. Rule inheritance provided by Rubocop works like the following:
32+
`inherit_gem → inherit_from → local rules`
33+
34+
For example:
35+
```yml
36+
inherit_gem:
37+
rubocop-codeur:
38+
- default.yml
39+
40+
inherit_from: .some_rubocop_config_file.yml
41+
42+
AllCops:
43+
Exclude:
44+
- path/to/exluded/file.rb
45+
```
46+
47+
Note that this should be limited to very project-specify needs in order to keep consistency across repos. Feel free to clone, checkout, update `default.yml` and submit a pull request if you want to suggest style rules changes.

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'bundler/gem_tasks'

default.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
require:
2+
- rubocop-minitest
3+
- rubocop-performance
4+
- rubocop-rails
5+
6+
AllCops:
7+
Exclude:
8+
- 'db/schema.rb'
9+
- 'node_modules/**/*'
10+
- 'public/**/*'
11+
- 'tmp/**/*'
12+
- 'vendor/**/*'
13+
- 'bin/*'
14+
TargetRubyVersion: 2.6
15+
TargetRailsVersion: 6.0
16+
NewCops: enable
17+
18+
Rails:
19+
Enabled: true
20+
21+
Layout/AccessModifierIndentation:
22+
EnforcedStyle: outdent
23+
IndentationWidth: 2
24+
25+
Layout/ArgumentAlignment:
26+
EnforcedStyle: with_first_argument
27+
28+
Layout/FirstArrayElementIndentation:
29+
EnforcedStyle: consistent
30+
31+
Layout/FirstHashElementIndentation:
32+
EnforcedStyle: consistent
33+
34+
Layout/HashAlignment:
35+
EnforcedHashRocketStyle: table
36+
EnforcedColonStyle: table
37+
38+
Layout/LineLength:
39+
Max: 200
40+
Exclude:
41+
- 'db/migrate/*'
42+
43+
Layout/MultilineMethodCallIndentation:
44+
EnforcedStyle: indented
45+
46+
Layout/ParameterAlignment:
47+
EnforcedStyle: with_fixed_indentation
48+
IndentationWidth: 2
49+
50+
Lint/RaiseException:
51+
Enabled: true
52+
53+
Lint/StructNewOverride:
54+
Enabled: true
55+
56+
Metrics/AbcSize:
57+
Max: 65
58+
Exclude:
59+
- 'db/migrate/*'
60+
61+
Metrics/BlockLength:
62+
Max: 60
63+
Exclude:
64+
- 'config/routes.rb'
65+
- 'lib/tasks/**/*'
66+
67+
Metrics/ClassLength:
68+
Max: 300
69+
70+
Metrics/CyclomaticComplexity:
71+
Max: 10
72+
73+
Metrics/MethodLength:
74+
Max: 60
75+
Exclude:
76+
- 'db/migrate/*'
77+
78+
Metrics/ModuleLength:
79+
Max: 300
80+
81+
Metrics/PerceivedComplexity:
82+
Max: 10
83+
84+
Minitest/TestMethodName:
85+
Enabled: false
86+
87+
Rails/BulkChangeTable:
88+
Enabled: false
89+
90+
Rails/CreateTableWithTimestamps:
91+
Exclude:
92+
- 'db/migrate/{2012,2013,2014,2015,2016,2017,2018}*.rb'
93+
94+
Rails/FilePath:
95+
EnforcedStyle: arguments
96+
97+
Rails/ReversibleMigration:
98+
Exclude:
99+
- 'db/migrate/{2012,2013,2014,2015,2016,2017,2018}*.rb'
100+
101+
Rails/SaveBang:
102+
Enabled: false
103+
# AllowedReceivers:
104+
# - 'mailchimp_list.members'
105+
106+
Rails/SkipsModelValidations:
107+
Enabled: false
108+
Exclude:
109+
- 'lib/tasks/**/*'
110+
- 'db/migrate/*.rb'
111+
112+
Rails/UnknownEnv:
113+
Environments:
114+
- development
115+
- test
116+
- staging
117+
- production
118+
119+
Style/AsciiComments:
120+
Enabled: false
121+
122+
Style/ClassAndModuleChildren:
123+
AutoCorrect: true
124+
125+
Style/ConditionalAssignment:
126+
Enabled: false
127+
128+
Style/Documentation:
129+
Enabled: false
130+
131+
Style/EmptyMethod:
132+
EnforcedStyle: expanded
133+
134+
Style/GuardClause:
135+
MinBodyLength: 3
136+
137+
Style/HashEachMethods:
138+
Enabled: true
139+
AutoCorrect: true
140+
141+
Style/HashTransformKeys:
142+
Enabled: true
143+
AutoCorrect: true
144+
145+
Style/HashTransformValues:
146+
Enabled: true
147+
AutoCorrect: true
148+
149+
Style/IfUnlessModifier:
150+
Enabled: false
151+
152+
Style/MultipleComparison:
153+
Enabled: false
154+
155+
Style/NestedTernaryOperator:
156+
Enabled: false
157+
158+
Style/NumericPredicate:
159+
Enabled: false
160+
161+
Style/SymbolArray:
162+
MinSize: 7

lib/rubocop_codeur.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
require 'rubocop_codeur/version'
4+
5+
module RubocopCodeur
6+
end

lib/rubocop_codeur/version.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
module RubocopCodeur
4+
VERSION = '0.1.0'
5+
end

rubocop-codeur.gemspec

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
lib = File.expand_path('../lib', __dir__)
4+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5+
require_relative 'lib/rubocop_codeur/version'
6+
7+
Gem::Specification.new do |spec|
8+
spec.name = 'rubocop-codeur'
9+
spec.version = RubocopCodeur::VERSION
10+
spec.authors = ['Dev-team Codeur']
11+
spec.email = ['[email protected]']
12+
spec.homepage = 'https://github.com/codeur/rubocop-codeur'
13+
spec.summary = 'Codeur rubocop config gem'
14+
spec.description = 'Shared rubocop config gem for every Ruby projects at Codeur SARL'
15+
spec.license = 'MIT'
16+
17+
spec.metadata['allowed_push_host'] = 'https://gems.codeur.com'
18+
19+
spec.metadata['homepage_uri'] = spec.homepage
20+
21+
spec.files = Dir['lib/**/*', 'MIT-LICENSE', 'README.md']
22+
23+
spec.required_ruby_version = '~> 2.6'
24+
spec.add_dependency 'rubocop'
25+
spec.add_dependency 'rubocop-minitest'
26+
spec.add_dependency 'rubocop-performance'
27+
spec.add_dependency 'rubocop-rails'
28+
end

0 commit comments

Comments
 (0)