Skip to content

Commit 8a5f5b7

Browse files
baelterwalro
andauthored
Recreate project using rubocop-extension-generator (#10)
* Recreate project using rubocop-extension-generator Also adds `EnsureRedirect` * Bump checkout version Co-authored-by: Robin Wallin <[email protected]> * Fix version nr Co-authored-by: Robin Wallin <[email protected]> * Bundle --------- Co-authored-by: Robin Wallin <[email protected]>
1 parent c5a1f07 commit 8a5f5b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+430
-991
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Ruby
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
name: Ruby ${{ matrix.ruby }}
14+
strategy:
15+
matrix:
16+
ruby:
17+
- '3.3.5'
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Ruby
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: ${{ matrix.ruby }}
25+
bundler-cache: true
26+
- name: Run the default task
27+
run: bundle exec rake

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
.vscode
10+
11+
# rspec failure tracking
12+
.rspec_status

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
--format documentation
2+
--color
13
--require spec_helper

.rubocop.yml

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
11
require:
22
- rubocop-rspec
3+
- rubocop-rake
34

4-
AllCops:
5-
TargetRubyVersion: 2.3
6-
DisplayCopNames: true
7-
DisplayStyleGuide: false
8-
9-
Metrics/BlockLength:
10-
Enabled: false
11-
12-
Metrics/LineLength:
13-
Enabled: false
14-
15-
RSpec/ExampleLength:
16-
Enabled: false
17-
18-
RSpec/FilePath:
19-
Enabled: false
20-
21-
Style/FileName:
5+
Naming/FileName:
226
Exclude:
23-
- "lib/rubocop-eightyfourcodes.rb"
24-
- "lib/rubocop/eightyfourcodes.rb"
25-
26-
Style/FormatStringToken:
27-
Enabled: false
28-
29-
Style/FrozenStringLiteralComment:
30-
Enabled: false
7+
- lib/rubocop-eightyfourcodes.rb
8+
RSpec/ExampleLength:
9+
Max: 10

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.0.3 (2024-10-23)
4+
5+
- Recreated entire project using <https://github.com/rubocop/rubocop-extension-generator>
6+
- Added `EnsureRedirect`
7+
38
## 0.0.2 (2020-09-24)
49

510
- Added `RubyVersionFile`: Ensure we read Gemfile ruby version from `.ruby-version` file

CONTRIBUTING.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

Gemfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

5+
# Specify your gem's dependencies in rubocop-eightyfourcodes.gemspec
36
gemspec
47

58
group :development, :test do
6-
gem 'pry'
7-
gem 'rspec', '~> 3.6.0'
8-
gem 'rubocop-rspec', '~> 1.21.0'
9+
gem 'rake'
10+
gem 'rspec'
11+
gem 'rubocop'
12+
gem 'rubocop-rake'
13+
gem 'rubocop-rspec'
914
end

Gemfile.lock

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,66 @@
11
PATH
22
remote: .
33
specs:
4-
rubocop-eightyfourcodes (0.0.2)
5-
rubocop (>= 0.51)
4+
rubocop-eightyfourcodes (0.0.3)
5+
rubocop
66

77
GEM
88
remote: https://rubygems.org/
99
specs:
10-
ast (2.4.0)
11-
coderay (1.1.2)
12-
diff-lcs (1.3)
13-
jaro_winkler (1.5.3)
14-
method_source (0.9.2)
15-
parallel (1.17.0)
16-
parser (2.6.4.0)
17-
ast (~> 2.4.0)
18-
pry (0.12.2)
19-
coderay (~> 1.1.0)
20-
method_source (~> 0.9.0)
21-
rainbow (3.0.0)
22-
rake (12.3.3)
23-
rspec (3.6.0)
24-
rspec-core (~> 3.6.0)
25-
rspec-expectations (~> 3.6.0)
26-
rspec-mocks (~> 3.6.0)
27-
rspec-core (3.6.0)
28-
rspec-support (~> 3.6.0)
29-
rspec-expectations (3.6.0)
10+
ast (2.4.2)
11+
diff-lcs (1.5.1)
12+
json (2.7.2)
13+
language_server-protocol (3.17.0.3)
14+
parallel (1.26.3)
15+
parser (3.3.5.0)
16+
ast (~> 2.4.1)
17+
racc
18+
racc (1.8.1)
19+
rainbow (3.1.1)
20+
rake (13.2.1)
21+
regexp_parser (2.9.2)
22+
rspec (3.13.0)
23+
rspec-core (~> 3.13.0)
24+
rspec-expectations (~> 3.13.0)
25+
rspec-mocks (~> 3.13.0)
26+
rspec-core (3.13.2)
27+
rspec-support (~> 3.13.0)
28+
rspec-expectations (3.13.3)
3029
diff-lcs (>= 1.2.0, < 2.0)
31-
rspec-support (~> 3.6.0)
32-
rspec-mocks (3.6.0)
30+
rspec-support (~> 3.13.0)
31+
rspec-mocks (3.13.2)
3332
diff-lcs (>= 1.2.0, < 2.0)
34-
rspec-support (~> 3.6.0)
35-
rspec-support (3.6.0)
36-
rubocop (0.74.0)
37-
jaro_winkler (~> 1.5.1)
33+
rspec-support (~> 3.13.0)
34+
rspec-support (3.13.1)
35+
rubocop (1.67.0)
36+
json (~> 2.3)
37+
language_server-protocol (>= 3.17.0)
3838
parallel (~> 1.10)
39-
parser (>= 2.6)
39+
parser (>= 3.3.0.2)
4040
rainbow (>= 2.2.2, < 4.0)
41+
regexp_parser (>= 2.4, < 3.0)
42+
rubocop-ast (>= 1.32.2, < 2.0)
4143
ruby-progressbar (~> 1.7)
42-
unicode-display_width (>= 1.4.0, < 1.7)
43-
rubocop-rspec (1.21.0)
44-
rubocop (>= 0.52.0)
45-
ruby-progressbar (1.10.1)
46-
unicode-display_width (1.6.0)
44+
unicode-display_width (>= 2.4.0, < 3.0)
45+
rubocop-ast (1.32.3)
46+
parser (>= 3.3.1.0)
47+
rubocop-rake (0.6.0)
48+
rubocop (~> 1.0)
49+
rubocop-rspec (3.1.0)
50+
rubocop (~> 1.61)
51+
ruby-progressbar (1.13.0)
52+
unicode-display_width (2.6.0)
4753

4854
PLATFORMS
4955
ruby
5056

5157
DEPENDENCIES
52-
pry
5358
rake
54-
rspec (~> 3.6.0)
59+
rspec
60+
rubocop
5561
rubocop-eightyfourcodes!
56-
rubocop-rspec (~> 1.21.0)
62+
rubocop-rake
63+
rubocop-rspec
5764

5865
BUNDLED WITH
59-
2.1.4
66+
2.5.22

LICENSE.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Copyright (c) 2019 eightyfourcodes AB
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 84codes AB
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy
46
of this software and associated documentation files (the "Software"), to deal
@@ -7,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
79
copies of the Software, and to permit persons to whom the Software is
810
furnished to do so, subject to the following conditions:
911

10-
The above copyright notice and this permission notice shall be included in all
11-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1214

1315
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1416
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1517
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1618
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1719
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 13 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1+
# Rubocop::EightyFourCodes
2+
13
This is a collection of cops developed and used by 84codes AB
2-
This code is based heavily upon the [rubocop-gitlab-security](https://gitlab.com/gitlab-org/rubocop-gitlab-security)
3-
code released under the MIT License.
44

55
## Installation
66

7-
Just install the `rubocop-eightyfourcodes` gem
7+
Install the gem and add to the application's Gemfile by executing:
88

9-
```bash
10-
gem install rubocop-eightyfourcodes
11-
```
9+
bundle add rubocop-eightyfourcodes --require=false
1210

13-
or if you use bundler put this in your `Gemfile`
11+
If bundler is not being used to manage dependencies, install the gem by executing:
1412

15-
```yaml
16-
gem 'rubocop-eightyfourcodes'
17-
```
13+
gem install rubocop-eightyfourcodes
1814

1915
## Usage
2016

@@ -32,64 +28,20 @@ require: rubocop-eightyfourcodes
3228
Now you can run `rubocop` and it will automatically load the RuboCop eightyfourcodes
3329
cops together with the standard cops.
3430

35-
### Command line
36-
37-
```bash
38-
rubocop --require rubocop-eightyfourcodes
39-
```
40-
41-
### Rake task
31+
## Development
4232

43-
```ruby
44-
RuboCop::RakeTask.new do |task|
45-
task.requires << 'rubocop-eightyfourcodes'
46-
end
47-
```
33+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
4834

49-
## Inspecting specific files
35+
Use `bundle exec rake 'new_cop[EightyFourCodes/CommandLiteralInjection]'` to generate a new cop.
5036

51-
By default, `rubocop-eightyfourcodes` inspects all files. You can override this setting in your config file by specifying one or more patterns:
37+
The [NodePattern Debugger](https://nodepattern.herokuapp.com/) is a very helpful resource when creating new AST matchers.
5238

53-
```yaml
54-
# Inspect all files
55-
AllCops:
56-
EightyFourCodes:
57-
Patterns:
58-
- '.+'
59-
```
60-
61-
```yaml
62-
# Inspect only controller files.
63-
AllCops:
64-
EightyFourCodes:
65-
Patterns:
66-
- app/controllers/**/*.rb
67-
```
68-
69-
## The Cops
70-
71-
All cops are located under
72-
[`lib/rubocop/cop/eighty_four_codes`](lib/rubocop/cop/eighty_four_codes), and contain
73-
examples/documentation.
74-
75-
In your `.rubocop.yml`, you may treat the eightyfourcodes cops just like any other
76-
cop. For example:
77-
78-
```yaml
79-
EightyFourCodes/CommandLiteralInjection:
80-
Exclude:
81-
- 'spec/**/*'
82-
```
39+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
8340

8441
## Contributing
8542

86-
1. Fork it
87-
2. Create your feature branch (`git checkout -b my-new-feature`)
88-
3. Commit your changes (`git commit -am 'Add some feature'`)
89-
4. Push to the branch (`git push origin my-new-feature`)
90-
5. Create new Merge Request
43+
Bug reports and pull requests are welcome on GitHub at <https://github.com/84codes/rubocop-eightyfourcodes>.
9144

9245
## License
9346

94-
`rubocop-eightyfourcodes` is MIT licensed. [See the accompanying file](LICENSE.md) for
95-
the full text.
47+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)