theforeman-rubocop 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +3 -2
- data/README.md +26 -8
- data/default.yml +3 -4
- data/docs/github_action.md +51 -0
- data/lenient.yml +3 -0
- data/lib/theforeman/rubocop/version.rb +1 -1
- data/minitest.yml +2 -0
- data/rules/base.yml +5 -0
- data/rules/metrics.yml +8 -0
- data/rules/style.yml +5 -6
- data/rules/style_lenient.yml +31 -0
- data/strict.yml +11 -0
- data/strictest.yml +5 -0
- data/theforeman-rubocop.gemspec +6 -5
- metadata +38 -18
- data/all.yml +0 -6
- data/edge.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f933f45fd6966bc09f46ba494268c9e93a26b1817ee530cf9967098f5ebaed4a
|
4
|
+
data.tar.gz: e6743de32b593b8c307908395e5b86dd6367f0265a4249f1f435a79d29b94663
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fefc5ca7d7899ec5882cc2d204c2b37892614746781e3762ecaecd370e5348c2d4320157ac19d3b15d0c759f8662ce8489226b77468566d0f6045f516673836
|
7
|
+
data.tar.gz: d402190a05d300b66a913af3bc7bb263442e90643dae4c45dbc961f95f99e925a6da0f67e12b755f7fbdb7d5d310cfef12ae1cab4b03132f23003f3feaaaf451
|
data/README.md
CHANGED
@@ -14,33 +14,48 @@ Instead of defining the rules for plugin per plugin, plugins can include default
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
+
There is also a [guide how to run this in GH action](docs/github_action.md)
|
18
|
+
|
17
19
|
```ruby
|
18
20
|
# Gemfile
|
19
|
-
gem 'theforeman-rubocop', '~> 0.0.
|
21
|
+
gem 'theforeman-rubocop', '~> 0.0.4'
|
20
22
|
```
|
21
23
|
|
22
24
|
And configure in the `.rubocop.yml`.
|
23
25
|
|
24
|
-
### Easiest config -
|
26
|
+
### Easiest config - all opinionated Cops `strict`
|
27
|
+
|
28
|
+
```yaml
|
29
|
+
inherit_gem:
|
30
|
+
theforeman-rubocop:
|
31
|
+
- strict.yml
|
32
|
+
```
|
25
33
|
|
34
|
+
### Basic style - `default`, performance and rails cops
|
26
35
|
```yaml
|
27
36
|
inherit_gem:
|
28
37
|
theforeman-rubocop:
|
29
|
-
-
|
38
|
+
- default.yml
|
30
39
|
```
|
31
40
|
|
32
|
-
###
|
41
|
+
### Not intrusive style - `lenient`
|
42
|
+
It is similar to default, but has some not as important cops disabled.
|
43
|
+
See `rules/style_lenient.yml` for disabled cops.
|
44
|
+
|
33
45
|
```yaml
|
34
46
|
inherit_gem:
|
35
47
|
theforeman-rubocop:
|
36
|
-
-
|
48
|
+
- lenient.yml
|
37
49
|
```
|
38
50
|
|
39
|
-
### All cops
|
51
|
+
### All opinionated cops with new ones - `strictest`
|
52
|
+
If you want to closely follow what RuboCop introduces in its new versions, use this level.
|
53
|
+
It is the same as `strict`, but enables the newly introduced cops.
|
54
|
+
|
40
55
|
```yaml
|
41
56
|
inherit_gem:
|
42
57
|
theforeman-rubocop:
|
43
|
-
-
|
58
|
+
- strictest.yml
|
44
59
|
```
|
45
60
|
|
46
61
|
### Choose just some cops
|
@@ -51,11 +66,14 @@ Cops are splited in categories for your convenience, so you can opt-out some cop
|
|
51
66
|
```yaml
|
52
67
|
inherit_gem:
|
53
68
|
theforeman-rubocop:
|
54
|
-
- rules/
|
69
|
+
- rules/base.yml
|
55
70
|
- rules/ruby_target.yml
|
71
|
+
- rules/style.yml
|
72
|
+
- rules/metrics.yml
|
56
73
|
- rules/performance.yml
|
57
74
|
- rules/rails.yml
|
58
75
|
- rules/minitest.yml
|
76
|
+
- rules/style_lenient.yml
|
59
77
|
|
60
78
|
AllCops:
|
61
79
|
NewCops: disable
|
data/default.yml
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# How to run RuboCop in GH action
|
2
|
+
|
3
|
+
## Foreman plugin
|
4
|
+
|
5
|
+
We will cover how to do use this in Foreman plugin. It should work for any rubygem the same tho.
|
6
|
+
|
7
|
+
Rubocop doesn't benefit from running in the full Foreman environment so it is actually better to have own dependency in Gemfile on it.
|
8
|
+
We are then able to run the rubocop directly in the plugin folder, which is much faster as we install only the plugin dependencies, not the full foreman dependencies.
|
9
|
+
|
10
|
+
In theory, you can just `gem install theforeman-foreman` in the action, but it is discouraged as it is then hard to synchronize what version you use in the CI.
|
11
|
+
|
12
|
+
### Plugin `Gemfile`
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
source 'https://rubygems.org'
|
16
|
+
gemspec
|
17
|
+
|
18
|
+
# We use special group rubocop so we can opt out from all dependencies but rubocop.
|
19
|
+
gem 'theforeman-rubocop', '~> 0.1.0', groups: %i[development rubocop]
|
20
|
+
```
|
21
|
+
|
22
|
+
### GH action
|
23
|
+
|
24
|
+
Following GH action will run
|
25
|
+
|
26
|
+
```yaml
|
27
|
+
name: Ruby Testing
|
28
|
+
on:
|
29
|
+
pull_request:
|
30
|
+
push:
|
31
|
+
branches:
|
32
|
+
- master
|
33
|
+
jobs:
|
34
|
+
rubocop:
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
env:
|
37
|
+
BUNDLE_WITHOUT: development:test
|
38
|
+
steps:
|
39
|
+
- uses: actions/checkout@v2
|
40
|
+
- name: Setup Ruby
|
41
|
+
uses: ruby/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: 2.7 # Currently supported ruby verion
|
44
|
+
bundler-cache: true
|
45
|
+
- name: Run rubocop
|
46
|
+
run: bundle exec rubocop -P --format github
|
47
|
+
view_specs:
|
48
|
+
runs-on: ubuntu-latest
|
49
|
+
needs: rubocop
|
50
|
+
# .... Whatever you run as tests if you run them in GH actions
|
51
|
+
```
|
data/lenient.yml
ADDED
data/minitest.yml
ADDED
data/rules/base.yml
ADDED
data/rules/metrics.yml
ADDED
data/rules/style.yml
CHANGED
@@ -5,6 +5,9 @@ Layout/ArgumentAlignment:
|
|
5
5
|
EnforcedStyle: with_fixed_indentation
|
6
6
|
IndentationWidth: 2
|
7
7
|
|
8
|
+
Layout/FirstArgumentIndentation:
|
9
|
+
EnforcedStyle: consistent
|
10
|
+
|
8
11
|
Style/Alias:
|
9
12
|
EnforcedStyle: prefer_alias_method
|
10
13
|
|
@@ -22,13 +25,9 @@ Style/Documentation:
|
|
22
25
|
Style/EmptyMethod:
|
23
26
|
EnforcedStyle: expanded
|
24
27
|
|
25
|
-
#
|
28
|
+
# Enforce ruby19 style
|
26
29
|
Style/HashSyntax:
|
27
|
-
EnforcedStyle:
|
28
|
-
|
29
|
-
# Both double and single quotes are OK
|
30
|
-
Style/StringLiterals:
|
31
|
-
Enabled: false
|
30
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
32
31
|
|
33
32
|
Style/TernaryParentheses:
|
34
33
|
EnforcedStyle: require_parentheses_when_complex
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Naming/VariableNumber:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
# Don't prefer is_a? over kind_of?
|
5
|
+
Style/ClassCheck:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Style/HashAsLastArrayItem:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# Support both, Ruby 1.9 hashmap and hash-rocket syntax
|
12
|
+
Style/HashSyntax:
|
13
|
+
EnforcedStyle: no_mixed_keys
|
14
|
+
|
15
|
+
# disabled until we can configure "+" as concat sign
|
16
|
+
Style/LineEndConcatenation:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
# Both double and single quotes are OK
|
20
|
+
Style/StringLiterals:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/StringConcatenation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/SymbolArray:
|
27
|
+
EnforcedStyle: brackets
|
28
|
+
MinSize: 1
|
29
|
+
|
30
|
+
Style/WordArray:
|
31
|
+
Enabled: false
|
data/strict.yml
ADDED
data/strictest.yml
ADDED
data/theforeman-rubocop.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = IO.readlines('AUTHORS', encoding: 'utf-8').map(&:strip)
|
11
11
|
spec.email = ['foreman-dev@googlegroups.com']
|
12
12
|
|
13
|
-
spec.summary = '
|
13
|
+
spec.summary = 'Shared Rubocop configuration for theforeman.org family of projects.'
|
14
14
|
spec.homepage = 'https://github.com/theforeman/theforeman-rubocop'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -20,12 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'rubocop', '~>
|
23
|
+
spec.add_dependency 'rubocop', '~> 1.23.0'
|
24
24
|
spec.add_dependency 'rubocop-checkstyle_formatter', '~> 0.4.0'
|
25
|
-
spec.add_dependency 'rubocop-rspec', '~>
|
26
|
-
spec.add_dependency 'rubocop-minitest', '~> 0.
|
25
|
+
spec.add_dependency 'rubocop-rspec', '~> 2.0'
|
26
|
+
spec.add_dependency 'rubocop-minitest', '~> 0.17.0'
|
27
27
|
spec.add_dependency 'rubocop-performance', '~> 1.8.1'
|
28
|
-
spec.add_dependency 'rubocop-rails', '~> 2.
|
28
|
+
spec.add_dependency 'rubocop-rails', '~> 2.12.4'
|
29
|
+
spec.add_dependency 'rubocop-graphql', '~> 0.11.2'
|
29
30
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
30
31
|
spec.add_development_dependency 'rake', '~> 13.0'
|
31
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theforeman-rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.23.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.23.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-checkstyle_formatter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop-minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.17.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.17.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-performance
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
89
|
+
version: 2.12.4
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
96
|
+
version: 2.12.4
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-graphql
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.11.2
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.11.2
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: bundler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +136,7 @@ dependencies:
|
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '13.0'
|
125
|
-
description:
|
139
|
+
description:
|
126
140
|
email:
|
127
141
|
- foreman-dev@googlegroups.com
|
128
142
|
executables: []
|
@@ -132,20 +146,26 @@ files:
|
|
132
146
|
- ".github/workflows/gem-push.yml"
|
133
147
|
- AUTHORS
|
134
148
|
- README.md
|
135
|
-
- all.yml
|
136
149
|
- default.yml
|
137
|
-
-
|
150
|
+
- docs/github_action.md
|
151
|
+
- lenient.yml
|
138
152
|
- lib/theforeman/rubocop/version.rb
|
153
|
+
- minitest.yml
|
154
|
+
- rules/base.yml
|
155
|
+
- rules/metrics.yml
|
139
156
|
- rules/minitest.yml
|
140
157
|
- rules/performance.yml
|
141
158
|
- rules/rails.yml
|
142
159
|
- rules/ruby_target.yml
|
143
160
|
- rules/style.yml
|
161
|
+
- rules/style_lenient.yml
|
162
|
+
- strict.yml
|
163
|
+
- strictest.yml
|
144
164
|
- theforeman-rubocop.gemspec
|
145
165
|
homepage: https://github.com/theforeman/theforeman-rubocop
|
146
166
|
licenses: []
|
147
167
|
metadata: {}
|
148
|
-
post_install_message:
|
168
|
+
post_install_message:
|
149
169
|
rdoc_options: []
|
150
170
|
require_paths:
|
151
171
|
- lib
|
@@ -160,8 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
180
|
- !ruby/object:Gem::Version
|
161
181
|
version: '0'
|
162
182
|
requirements: []
|
163
|
-
rubygems_version: 3.1.
|
164
|
-
signing_key:
|
183
|
+
rubygems_version: 3.1.6
|
184
|
+
signing_key:
|
165
185
|
specification_version: 4
|
166
|
-
summary:
|
186
|
+
summary: Shared Rubocop configuration for theforeman.org family of projects.
|
167
187
|
test_files: []
|
data/all.yml
DELETED