cobalt-rubocop 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c08db73a41f4beaee02f72349ba019f38884ed65030ca622cffb6e2bb76d0dfe
4
+ data.tar.gz: '06588084616ac4a8e65741a3c251de8988faf4e2157bef50a8f290f64c7a5dd4'
5
+ SHA512:
6
+ metadata.gz: ccf9019e8758ea7b9c170c89a6f4cda9417251a114776b0682e9dd08da99df921641efd67d1bb4e64746af9d895576ddebe3cd6d56430ddc3011ed9c92958335
7
+ data.tar.gz: 35fdb07709b25dbb699f730a8aa3c13d30a244aad2d7745f1db4542d03e063dd8cc5dc7922fed21311faf941ab9e8982e479110af7b97fe1e57d8a22d92e862d
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # 0.1.0
2
+
3
+ * Introduce default rules
4
+ * Introduce rails rules
5
+ * Introduce rspec rules
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Cobalt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Cobalt RuboCop
2
+
3
+ This repository provides recommended linting rules for Ruby repositories.
4
+
5
+ ## Installation
6
+
7
+ ### Gemfile
8
+
9
+ ```ruby
10
+ group :development do
11
+ gem 'cobalt-rubocop', require: false, git: 'https://github.com/cobalthq/cobalt-rubocop', branch: :main
12
+ end
13
+ ```
14
+
15
+ ### .rubocop.yml
16
+
17
+ ```yaml
18
+ inherit_gem:
19
+ cobalt-rubocop:
20
+ - 'config/default.yml'
21
+ - 'config/rails.yml'
22
+ - 'config/rspec.yml'
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```shell
28
+ bundle install
29
+ bundle exec rubocop
30
+ ```
31
+
32
+ When installing rules on an older project it is possible to generate a todo list:
33
+
34
+ ```shell
35
+ bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 40000
36
+ ```
37
+
38
+ The number of offences can be counted:
39
+
40
+ ```shell
41
+ grep "Offense count" .rubocop_todo.yml | awk -F: '{sum+=$2} END {print sum}'
42
+ ```
43
+
44
+ ## Development
45
+ ```shell
46
+ git clone git@github.com:cobalthq/cobalt-rubocop.git
47
+ gem install bundler:2.2.2
48
+ bundle _2.2.2_
49
+ ```
50
+
51
+ ### Testing locally
52
+ In your application, use the `path` attribute to point to your local copy of the gem
53
+ ```ruby
54
+ # Use the relative path from your application, to the cobalt-rubocop folder
55
+ gem 'cobalt-rubocop', path: '../cobalt-rubocop', require: false
56
+ ```
57
+
58
+ ### Publishing the gem
59
+ If you have access to publish the gem on rubygems:
60
+ ```shell
61
+ rake build
62
+ cd pkg
63
+ gem push cobalt-rubocop-<version_number>.gem
64
+ ```
@@ -0,0 +1,59 @@
1
+ require:
2
+ - rubocop-performance
3
+
4
+ AllCops:
5
+ NewCops: enable
6
+
7
+ Naming/MethodName:
8
+ EnforcedStyle: snake_case
9
+
10
+ Layout/ArgumentAlignment:
11
+ EnforcedStyle: with_fixed_indentation
12
+
13
+ Layout/DotPosition:
14
+ EnforcedStyle: leading
15
+
16
+ Layout/FirstArrayElementIndentation:
17
+ EnforcedStyle: consistent
18
+
19
+ Layout/LineLength:
20
+ Enabled: false
21
+
22
+ Layout/ParameterAlignment:
23
+ EnforcedStyle: with_fixed_indentation
24
+
25
+ Layout/SpaceInsideHashLiteralBraces:
26
+ EnforcedStyle: no_space
27
+
28
+ Layout/MultilineOperationIndentation:
29
+ EnforcedStyle: indented
30
+
31
+ Layout/MultilineMethodCallIndentation:
32
+ EnforcedStyle: indented
33
+
34
+ Layout/FirstHashElementIndentation:
35
+ EnforcedStyle: consistent
36
+
37
+ Metrics/MethodLength:
38
+ Max: 20
39
+
40
+ Metrics/AbcSize:
41
+ Enabled: false
42
+
43
+ Style/Documentation:
44
+ Enabled: false
45
+
46
+ Style/EachWithObject:
47
+ Enabled: false
48
+
49
+ Style/MutableConstant:
50
+ Enabled: false
51
+
52
+ Style/GuardClause:
53
+ Enabled: false
54
+
55
+ Style/IfUnlessModifier:
56
+ Enabled: false
57
+
58
+ Style/ClassAndModuleChildren:
59
+ EnforcedStyle: nested
data/config/rails.yml ADDED
@@ -0,0 +1,7 @@
1
+ require:
2
+ - rubocop-rails
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - 'db/migrate/*'
7
+ - 'Rakefile'
data/config/rspec.yml ADDED
@@ -0,0 +1,25 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ Metrics/BlockLength:
5
+ Exclude:
6
+ - 'spec/**/*.rb'
7
+
8
+ RSpec/ExampleLength:
9
+ Enabled: false
10
+
11
+ RSpec/MessageSpies:
12
+ EnforcedStyle: receive
13
+
14
+ RSpec/VariableName:
15
+ IgnoredPatterns:
16
+ - ^Authorization
17
+
18
+ RSpec/MultipleMemoizedHelpers:
19
+ Max: 17
20
+
21
+ RSpec/NamedSubject:
22
+ Enabled: true
23
+
24
+ RSpec/NestedGroups:
25
+ Max: 5
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cobalt-rubocop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cobalt Engineering
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.9.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.9.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-performance
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.9.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.9.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.9.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.9.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.2.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.2.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.2.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.2.2
83
+ description: Ruby code linting for Cobalt Ruby repositories
84
+ email:
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - CHANGELOG.md
90
+ - LICENSE
91
+ - README.md
92
+ - config/default.yml
93
+ - config/rails.yml
94
+ - config/rspec.yml
95
+ homepage: https://github.com/cobalthq/cobalt-rubocop
96
+ licenses:
97
+ - MIT
98
+ metadata:
99
+ allowed_push_host: https://rubygems.org
100
+ homepage_uri: https://github.com/cobalthq/cobalt-rubocop
101
+ source_code_uri: https://github.com/cobalthq/cobalt-rubocop
102
+ changelog_uri: https://github.com/cobalthq/cobalt-rubocop/blob/main/CHANGELOG.md
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: 2.5.0
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubygems_version: 3.1.2
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Cobalt RuboCop
122
+ test_files: []