theforeman-rubocop 0.0.4 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +4 -8
- data/README.md +25 -7
- data/default.yml +3 -1
- data/docs/github_action.md +51 -0
- data/lenient.yml +4 -0
- data/lib/theforeman/rubocop/version.rb +1 -1
- data/minitest.yml +2 -0
- data/rules/minitest.yml +3 -0
- data/rules/minitest_lenient.yml +2 -0
- data/rules/style.yml +7 -0
- data/rules/{style_permissive.yml → style_lenient.yml} +9 -0
- data/rules/to_decide.yml +3 -0
- data/{all.yml → strict.yml} +2 -1
- data/strictest.yml +5 -0
- data/theforeman-rubocop.gemspec +5 -4
- metadata +37 -18
- 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: 3b23533cc1c2840595ce95428c7257398a1304359180f2315f48711a5e2523d5
|
4
|
+
data.tar.gz: bf0688392785412597d665321895354a6f08931ee03e7a8eba761f45a3e0c87e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9743933fb61cdd5dc31ec345dc8b317375d742b3b3cb64f99595ceb1428f5dff8ef897aba4188e755c363feb76762ec683ca4de94bfb38aa80798e4e0cc63df
|
7
|
+
data.tar.gz: c80ded9bdf978a0c12e620e488c64eb35b50351b82c602b2c46a33ff03c3a31e4029d76ee18cd036a47b7f01c2e250ce4d4afbf647e06e71819038a3b4206f64
|
@@ -1,8 +1,9 @@
|
|
1
1
|
name: Publish RubyGem
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
4
|
+
create:
|
5
|
+
tags:
|
6
|
+
- v*
|
6
7
|
|
7
8
|
jobs:
|
8
9
|
publish_ghp:
|
@@ -40,11 +41,6 @@ jobs:
|
|
40
41
|
|
41
42
|
- run: gem build *.gemspec
|
42
43
|
- name: Publish to RubyGems
|
43
|
-
run:
|
44
|
-
mkdir -p $HOME/.gem
|
45
|
-
touch $HOME/.gem/credentials
|
46
|
-
chmod 0600 $HOME/.gem/credentials
|
47
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
48
|
-
gem push *.gem
|
44
|
+
run: gem push *.gem
|
49
45
|
env:
|
50
46
|
GEM_HOST_API_KEY: "Bearer ${{secrets.RUBYGEM_API_KEY}}"
|
data/README.md
CHANGED
@@ -14,6 +14,8 @@ 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
21
|
gem 'theforeman-rubocop', '~> 0.0.4'
|
@@ -21,26 +23,39 @@ gem 'theforeman-rubocop', '~> 0.0.4'
|
|
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/minitest.yml
CHANGED
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,6 +25,10 @@ Style/Documentation:
|
|
22
25
|
Style/EmptyMethod:
|
23
26
|
EnforcedStyle: expanded
|
24
27
|
|
28
|
+
# Enforce ruby19 style
|
29
|
+
Style/HashSyntax:
|
30
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
31
|
+
|
25
32
|
Style/TernaryParentheses:
|
26
33
|
EnforcedStyle: require_parentheses_when_complex
|
27
34
|
|
@@ -1,7 +1,13 @@
|
|
1
|
+
Naming/VariableNumber:
|
2
|
+
Enabled: false
|
3
|
+
|
1
4
|
# Don't prefer is_a? over kind_of?
|
2
5
|
Style/ClassCheck:
|
3
6
|
Enabled: false
|
4
7
|
|
8
|
+
Style/HashAsLastArrayItem:
|
9
|
+
Enabled: false
|
10
|
+
|
5
11
|
# Support both, Ruby 1.9 hashmap and hash-rocket syntax
|
6
12
|
Style/HashSyntax:
|
7
13
|
EnforcedStyle: no_mixed_keys
|
@@ -14,6 +20,9 @@ Style/LineEndConcatenation:
|
|
14
20
|
Style/StringLiterals:
|
15
21
|
Enabled: false
|
16
22
|
|
23
|
+
Style/StringConcatenation:
|
24
|
+
Enabled: false
|
25
|
+
|
17
26
|
Style/SymbolArray:
|
18
27
|
EnforcedStyle: brackets
|
19
28
|
MinSize: 1
|
data/rules/to_decide.yml
ADDED
data/{all.yml → strict.yml}
RENAMED
@@ -1,11 +1,12 @@
|
|
1
1
|
inherit_from:
|
2
2
|
- rules/base.yml
|
3
|
+
- rules/ruby_target.yml
|
3
4
|
- rules/style.yml
|
4
5
|
- rules/performance.yml
|
5
6
|
- rules/metrics.yml
|
6
|
-
- rules/ruby_target.yml
|
7
7
|
- rules/rails.yml
|
8
8
|
- rules/minitest.yml
|
9
|
+
- rules/to_decide.yml
|
9
10
|
|
10
11
|
AllCops:
|
11
12
|
NewCops: disable
|
data/strictest.yml
ADDED
data/theforeman-rubocop.gemspec
CHANGED
@@ -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.
|
4
|
+
version: 0.1.1
|
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-09 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,23 +146,28 @@ 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
|
139
154
|
- rules/base.yml
|
140
155
|
- rules/metrics.yml
|
141
156
|
- rules/minitest.yml
|
157
|
+
- rules/minitest_lenient.yml
|
142
158
|
- rules/performance.yml
|
143
159
|
- rules/rails.yml
|
144
160
|
- rules/ruby_target.yml
|
145
161
|
- rules/style.yml
|
146
|
-
- rules/
|
162
|
+
- rules/style_lenient.yml
|
163
|
+
- rules/to_decide.yml
|
164
|
+
- strict.yml
|
165
|
+
- strictest.yml
|
147
166
|
- theforeman-rubocop.gemspec
|
148
167
|
homepage: https://github.com/theforeman/theforeman-rubocop
|
149
168
|
licenses: []
|
150
169
|
metadata: {}
|
151
|
-
post_install_message:
|
170
|
+
post_install_message:
|
152
171
|
rdoc_options: []
|
153
172
|
require_paths:
|
154
173
|
- lib
|
@@ -163,8 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
182
|
- !ruby/object:Gem::Version
|
164
183
|
version: '0'
|
165
184
|
requirements: []
|
166
|
-
rubygems_version: 3.1.
|
167
|
-
signing_key:
|
185
|
+
rubygems_version: 3.1.6
|
186
|
+
signing_key:
|
168
187
|
specification_version: 4
|
169
188
|
summary: Shared Rubocop configuration for theforeman.org family of projects.
|
170
189
|
test_files: []
|