rubocop_plus 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check_pull_request.yml +55 -0
- data/CHANGELOG.md +12 -1
- data/LICENSE.md +6 -6
- data/README.md +30 -26
- data/Rakefile +3 -3
- data/config/group/style.yml +4 -0
- data/exe/rubo +8 -8
- data/lib/rubocop_plus/version.rb +2 -2
- data/rubocop_plus.gemspec +4 -4
- metadata +14 -14
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a6c4d83e0eaa313ed29e8c9db6fb5e6619ecd28318179e423b7ebde92c49534
|
4
|
+
data.tar.gz: 05f47dc020cf260502f7ff9f02bbc2b95f347dcf94a12273123e7c5a75ab0b63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89f25b7e0ffdf7a8d3dd8ca0570958b8af02065edacb13e6d9c43fcb63aab852ee2a7e10be63315dc26b4e10473ee1d7dbe142c3bbcf8f493daeb0e8c11e116d
|
7
|
+
data.tar.gz: '04848543ddb9639fbc1377d568f07218b08d673f8b0f55962e6b656dfd1254d73bab9fb55ab26045ba573de8e3948ba8303c38c2f6de3a5b6513283a913b644d'
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# This workflow will download prebuilt Ruby versions, install dependencies and run checks against Pull Requests.
|
2
|
+
|
3
|
+
name: Check Pull Request
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
branches: [ master ]
|
7
|
+
env:
|
8
|
+
# The pull request can have less than, or equal to, this number of rubocop issues and pass.
|
9
|
+
RUBOCOP_ISSUE_THRESHOLD: 5
|
10
|
+
jobs:
|
11
|
+
rspec:
|
12
|
+
name: Run RSpec
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
21
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
26
|
+
- name: Execute rspec command
|
27
|
+
run: bundle exec rspec
|
28
|
+
rubocop:
|
29
|
+
name: Run Rubocop
|
30
|
+
runs-on: ubuntu-latest
|
31
|
+
needs: rspec
|
32
|
+
strategy:
|
33
|
+
matrix:
|
34
|
+
ruby-version: ['2.6']
|
35
|
+
steps:
|
36
|
+
- uses: actions/checkout@v2
|
37
|
+
- name: Set up Ruby
|
38
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
39
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
40
|
+
uses: ruby/setup-ruby@v1
|
41
|
+
with:
|
42
|
+
ruby-version: ${{ matrix.ruby-version }}
|
43
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
44
|
+
- name: Execute rubo command
|
45
|
+
run: bundle exec rubo
|
46
|
+
- name: Evaluate rubo threshold
|
47
|
+
run: |
|
48
|
+
count=$(cat rubocop/total-violations-count.txt)
|
49
|
+
if [[ "$count" -gt $RUBOCOP_ISSUE_THRESHOLD ]]; then
|
50
|
+
echo "Failure: Found $count RuboCop issue(s). It must have $RUBOCOP_ISSUE_THRESHOLD or less. \
|
51
|
+
Run 'rubo' and resolve the issues listed in rubocop/style-issues.html"
|
52
|
+
exit 1
|
53
|
+
else
|
54
|
+
echo "Sucess: Found $count RuboCop issue(s), which is less than the limit of $RUBOCOP_ISSUE_THRESHOLD"
|
55
|
+
fi
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
Issues are tracked at https://github.com/roberts1000/rubocop_plus/issues. Changes marked as **(Internal)** support
|
3
|
+
Issues are tracked at https://github.com/roberts1000/rubocop_plus/issues. Changes marked as **(Internal)** support development or refactoring.
|
4
|
+
|
5
|
+
## 2.3.0 (Jul 29, 2021)
|
6
|
+
|
7
|
+
1. [#129](../../issues/129): Use `rubocop` `1.18.4`.
|
8
|
+
1. [#131](../../issues/131): Remove Travis CI integration. **(Internal)**
|
9
|
+
1. [#133](../../issues/133): Add GitHub action workflow to check pull requests. **(Internal)**
|
10
|
+
1. [#135](../../issues/135): Use `rubocop-performance` `1.11.4`.
|
11
|
+
1. [#137](../../issues/137): Use `rubocop-rails` `2.11.3`.
|
12
|
+
1. [#139](../../issues/139): Use `rubocop-rake` `0.6.0`.
|
13
|
+
1. [#141](../../issues/141): Use `rubocop-rspec` `2.4.0`.
|
14
|
+
1. [#143](../../issues/143): Disable the `Style/StringLiterals` cop.
|
4
15
|
|
5
16
|
## 2.2.0 (May 16, 2021)
|
6
17
|
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2021 roberts1000
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
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
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
# rubocop_plus
|
2
2
|
|
3
|
-
`rubocop_plus` is a Ruby gem that wraps around the
|
3
|
+
`rubocop_plus` is a Ruby gem that wraps around the [rubocop](https://github.com/bbatsov/rubocop) gem. It makes changes and enhancements to `rubocop` by altering configuration and code. All configuration changes can be found in the `config` folder.
|
4
4
|
|
5
|
-
|
5
|
+
**Disclaimer:** rubocop_plus was built to store **my preferred** rubocop configuration and enhancements. **There is no association with the base rubocop project.** rubocop_plus was made public so it could be used by projects that I support, and to serve as a reference gem to anyone who wants to do something similar.
|
6
6
|
|
7
|
-
|
7
|
+
## Versioning Strategy
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
Releases are versioned using [semver 2.0.0](https://semver.org/spec/v2.0.0.html).
|
12
|
-
|
13
|
-
Ruby versions that reach EOL will be removed without a major version bump.
|
9
|
+
1. Releases are versioned using [semver 2.0.0](https://semver.org/spec/v2.0.0.html).
|
10
|
+
1. Ruby versions that reach EOL are removed in a major or minor release.
|
14
11
|
|
15
12
|
## Supported Ruby Versions
|
16
13
|
|
@@ -18,43 +15,47 @@ Ruby 2.6.0+ is supported.
|
|
18
15
|
|
19
16
|
## Installation
|
20
17
|
|
21
|
-
Install
|
18
|
+
Install rubocop_plus manually by executing:
|
22
19
|
|
23
20
|
$ gem install rubocop_plus
|
24
21
|
|
25
|
-
You can also
|
22
|
+
You can also add rubocop_plus to the `:development` group of your project's `Gemfile`:
|
26
23
|
|
27
24
|
```ruby
|
28
|
-
|
25
|
+
group :development do
|
26
|
+
gem 'rubocop_plus', require: false
|
27
|
+
end
|
29
28
|
```
|
30
29
|
|
31
|
-
If
|
30
|
+
If you add rubocop_plus to your `Gemfile`, it is recommended that you use `require: false`. There's no need to load rubocop_plus files when your project runs.
|
31
|
+
|
32
|
+
**Keep in mind**, if you place rubocop_plus in a project's `Gemfile`, it will **lock** your project to the version of rubocop_plus that gets written to the `Gemfile.lock`. If you're using a CI tool like Jenkins, this will likely make the CI tool use that same version - which is not always the desired outcome.
|
32
33
|
|
33
|
-
Next,
|
34
|
+
Next, remove the `rubocop` gem if it's listed in the `Gemfile`. rubocop_plus will install the version of rubocop that it needs.
|
35
|
+
|
36
|
+
Bundle the app:
|
34
37
|
|
35
38
|
$ bundle
|
36
39
|
|
37
|
-
Initialize your project's
|
40
|
+
Initialize your project's rubocop configuration:
|
38
41
|
|
39
42
|
$ rubo --init
|
40
43
|
|
41
|
-
This will create a
|
42
|
-
|
43
|
-
**Note:** Keep in mind, if you place `rubocop_plus` in a projects Gemfile, it will **lock** your project to the version of `rubocop_plus` that gets written to the Gemfile.lock file. If you're using a continuous integration platform, like Jenkins or Travis, this will likely restrict the CI tool to that same version - which is not always ideal. Some people prefer to have the CI platform **tell** the project which version of `rubocop_plus` to use. In that case, you should not put the `rubocop_plus` in the project's Gemfile.
|
44
|
+
This will create a `.rubocop.yml` inside the project root. By default, this file has configuration that tells rubocop to look in the rubocop_plus gem for custom RuboCop configuration. You can add additional configuration to this file if you would like to make other changes to RuboCop.
|
44
45
|
|
45
46
|
## Usage
|
46
47
|
|
47
|
-
|
48
|
+
rubocop_plus provides a `rubo` command that you can use run to invoke rubocop in a standard manner. It will write all output to the `rubocop/` folder inside the project. You can run `rubo --help` to see a list of commands. If rubocop_plus is included the project's Gemfile, rubo will execute the locked version. Otherwise, it will execute the latest version on the system.
|
48
49
|
|
49
50
|
#### Total Violation Count
|
50
51
|
|
51
|
-
The `rubo` command
|
52
|
+
The `rubo` command creates a `rubocop/total-violations-count.txt file` as part of the output. This file holds a single number that represents the total number of violations that were found by rubocop. This file was created so continuous integration tools like Jenkins could be configured to fail builds that have "too many" violations.
|
52
53
|
|
53
54
|
## Development
|
54
55
|
|
55
56
|
### Setup
|
56
57
|
|
57
|
-
Checkout the repo, `cd` into the project and run:
|
58
|
+
Checkout the repo, then `cd` into the project and run:
|
58
59
|
|
59
60
|
$ bin/setup
|
60
61
|
|
@@ -66,25 +67,28 @@ Run the test suite:
|
|
66
67
|
|
67
68
|
### Start a Development Console
|
68
69
|
|
69
|
-
Start an interactive prompt that will allow you to experiment:
|
70
|
+
Start an interactive prompt that will allow you to experiment (choose either):
|
70
71
|
|
71
|
-
|
72
|
+
```bash
|
73
|
+
$ bin/console # for Pry
|
74
|
+
$ rake console # for IRB
|
75
|
+
```
|
72
76
|
|
73
77
|
### Workflow Advice
|
74
78
|
|
75
|
-
The easiest way to develop with the gem locally is to `cd` into another ruby project that can serve as a test bed. From the sample project's root folder, execute
|
79
|
+
The easiest way to develop with the gem locally is to `cd` into another ruby project that can serve as a test bed. From the sample project's root folder, execute `/path/to/rubocop_plus/exe/rubo` to execute the development version of rubocop_plus.
|
76
80
|
|
77
81
|
### Release a New Version
|
78
82
|
|
79
|
-
To release a new version, update the version number in `version.rb`, and then run `
|
83
|
+
To release a new version, update the version number in `version.rb`, and then run `rake release`. This will create a git tag for the version, push git commits and tags, and push the gem to [rubygems.org](https://rubygems.org).
|
80
84
|
|
81
85
|
### Run rubocop_plus on Itself
|
82
86
|
|
83
|
-
To run
|
87
|
+
To run rubocop_plus on itself, `cd` to the root of the `rubocop_plus` development folder and run `exe/rubo`. If you just run `rubo`, you will invoke the `rubo` for the latest **installed** rubocop_plus gem and not the version of `rubo` within the development folder.
|
84
88
|
|
85
89
|
## Contributing
|
86
90
|
|
87
|
-
Contributions are welcome, but please be aware that
|
91
|
+
Contributions are welcome, but please be aware that rubocop_plus was created to serve the projects and teams that I directly support. Their needs and style preferences will come first. To contribute, create an issue on the [GitHub Issue board](https://github.com/roberts1000/rubocop_plus/issues) and wait for feedback. Once the idea is approved, submit a Pull Request.
|
88
92
|
|
89
93
|
## License
|
90
94
|
|
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ RSpec::Core::RakeTask.new(:spec)
|
|
5
5
|
|
6
6
|
task :default => :spec
|
7
7
|
|
8
|
-
desc "Start
|
8
|
+
desc "Start an IRB console with rubocop_plus loaded"
|
9
9
|
task :console do
|
10
|
-
exec "pry -r rubocop_plus -I ./lib"
|
11
|
-
|
10
|
+
# exec "pry -r rubocop_plus -I ./lib"
|
11
|
+
exec "irb -r rubocop_plus -I ./lib"
|
12
12
|
end
|
data/config/group/style.yml
CHANGED
@@ -53,6 +53,10 @@ Style/MixinUsage:
|
|
53
53
|
Style/PreferredHashMethods:
|
54
54
|
EnforcedStyle: verbose
|
55
55
|
|
56
|
+
# See the commment for Style/StringLiterals.
|
57
|
+
Style/QuotedSymbols:
|
58
|
+
Enabled: false
|
59
|
+
|
56
60
|
# Style/StringLiterals enforces the use of single quotes around string literals. The major argument for using single quotes is
|
57
61
|
# they should be faster than double quotes (which need to be parsed for possible uses of interpolation). Also, they help reveal
|
58
62
|
# intention by alerting developers that there is no interpolation in the string. However, there is no performance difference
|
data/exe/rubo
CHANGED
@@ -26,14 +26,14 @@ command = Cri::Command.define do
|
|
26
26
|
usage 'rubo [options]'
|
27
27
|
# aliases :ds, :stuff
|
28
28
|
# summary 'foo'
|
29
|
-
description
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
description "rubo is an executable installed by the rubocop_plus gem. It invokes rubocop with a custom set of " \
|
30
|
+
"rules. The following status codes are returned:\n\n" \
|
31
|
+
"STATUS CODES\n\n" \
|
32
|
+
"0 - rubocop ran and results were written to the 'rubocop' folder........\n" \
|
33
|
+
"1 - the project root does not contain a .rubocop.yml file...............\n" \
|
34
|
+
"2 - the .rubocop.yml file does not have the correct content.............\n" \
|
35
|
+
"3 - the 'rubocop' command cound not be found (likely due to missing gem)\n" \
|
36
|
+
"4 - the output from the 'rubo' command is missing or corrupt............\n"
|
37
37
|
|
38
38
|
flag :h, :help, 'show help for this command' do |_value, cmd|
|
39
39
|
puts cmd.help
|
data/lib/rubocop_plus/version.rb
CHANGED
data/rubocop_plus.gemspec
CHANGED
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency "cri", "~> 2.0"
|
31
31
|
spec.add_dependency "rubocop", RubocopPlus::RUBOCOP_VERSION.to_s
|
32
|
-
spec.add_dependency "rubocop-performance", "1.11.
|
33
|
-
spec.add_dependency "rubocop-rails", "2.
|
34
|
-
spec.add_dependency "rubocop-rake", "0.
|
35
|
-
spec.add_dependency "rubocop-rspec", "2.
|
32
|
+
spec.add_dependency "rubocop-performance", "1.11.4"
|
33
|
+
spec.add_dependency "rubocop-rails", "2.11.3"
|
34
|
+
spec.add_dependency "rubocop-rake", "0.6.0"
|
35
|
+
spec.add_dependency "rubocop-rspec", "2.4.0"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- roberts1000
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,70 +86,70 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.18.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: 1.
|
96
|
+
version: 1.18.4
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-performance
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.11.
|
103
|
+
version: 1.11.4
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.11.
|
110
|
+
version: 1.11.4
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop-rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2.
|
117
|
+
version: 2.11.3
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 2.
|
124
|
+
version: 2.11.3
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop-rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.6.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.6.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rubocop-rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.
|
145
|
+
version: 2.4.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.
|
152
|
+
version: 2.4.0
|
153
153
|
description: Enhancements to the standard rubocop gem.
|
154
154
|
email:
|
155
155
|
- roberts@corlewsolutions.com
|
@@ -158,10 +158,10 @@ executables:
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
+
- ".github/workflows/check_pull_request.yml"
|
161
162
|
- ".gitignore"
|
162
163
|
- ".rspec"
|
163
164
|
- ".rubocop.yml"
|
164
|
-
- ".travis.yml"
|
165
165
|
- CHANGELOG.md
|
166
166
|
- Gemfile
|
167
167
|
- LICENSE.md
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.2.
|
217
|
+
rubygems_version: 3.2.24
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Enhancements to the standard rubocop gem.
|