Skip to content

Commit

Permalink
Recreate project using rubocop-extension-generator (#10)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
baelter and walro authored Oct 23, 2024
1 parent c5a1f07 commit 8a5f5b7
Show file tree
Hide file tree
Showing 42 changed files with 430 additions and 991 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Ruby

on:
push:
branches:
- main

pull_request:

jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.3.5'

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
run: bundle exec rake
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
.vscode

# rspec failure tracking
.rspec_status
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
--format documentation
--color
--require spec_helper
31 changes: 5 additions & 26 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
require:
- rubocop-rspec
- rubocop-rake

AllCops:
TargetRubyVersion: 2.3
DisplayCopNames: true
DisplayStyleGuide: false

Metrics/BlockLength:
Enabled: false

Metrics/LineLength:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/FilePath:
Enabled: false

Style/FileName:
Naming/FileName:
Exclude:
- "lib/rubocop-eightyfourcodes.rb"
- "lib/rubocop/eightyfourcodes.rb"

Style/FormatStringToken:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false
- lib/rubocop-eightyfourcodes.rb
RSpec/ExampleLength:
Max: 10
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.0.3 (2024-10-23)

- Recreated entire project using <https://github.com/rubocop/rubocop-extension-generator>
- Added `EnsureRedirect`

## 0.0.2 (2020-09-24)

- Added `RubyVersionFile`: Ensure we read Gemfile ruby version from `.ruby-version` file
Expand Down
3 changes: 0 additions & 3 deletions CONTRIBUTING.md

This file was deleted.

11 changes: 8 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in rubocop-eightyfourcodes.gemspec
gemspec

group :development, :test do
gem 'pry'
gem 'rspec', '~> 3.6.0'
gem 'rubocop-rspec', '~> 1.21.0'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-rspec'
end
83 changes: 45 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,59 +1,66 @@
PATH
remote: .
specs:
rubocop-eightyfourcodes (0.0.2)
rubocop (>= 0.51)
rubocop-eightyfourcodes (0.0.3)
rubocop

GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
coderay (1.1.2)
diff-lcs (1.3)
jaro_winkler (1.5.3)
method_source (0.9.2)
parallel (1.17.0)
parser (2.6.4.0)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rainbow (3.0.0)
rake (12.3.3)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
ast (2.4.2)
diff-lcs (1.5.1)
json (2.7.2)
language_server-protocol (3.17.0.3)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (0.74.0)
jaro_winkler (~> 1.5.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.67.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 2.6)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rspec (1.21.0)
rubocop (>= 0.52.0)
ruby-progressbar (1.10.1)
unicode-display_width (1.6.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (3.1.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
unicode-display_width (2.6.0)

PLATFORMS
ruby

DEPENDENCIES
pry
rake
rspec (~> 3.6.0)
rspec
rubocop
rubocop-eightyfourcodes!
rubocop-rspec (~> 1.21.0)
rubocop-rake
rubocop-rspec

BUNDLED WITH
2.1.4
2.5.22
12 changes: 7 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (c) 2019 eightyfourcodes AB
The MIT License (MIT)

Copyright (c) 2024 84codes AB

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

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
74 changes: 13 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# Rubocop::EightyFourCodes

This is a collection of cops developed and used by 84codes AB
This code is based heavily upon the [rubocop-gitlab-security](https://gitlab.com/gitlab-org/rubocop-gitlab-security)
code released under the MIT License.

## Installation

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

```bash
gem install rubocop-eightyfourcodes
```
bundle add rubocop-eightyfourcodes --require=false

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

```yaml
gem 'rubocop-eightyfourcodes'
```
gem install rubocop-eightyfourcodes

## Usage

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

### Command line

```bash
rubocop --require rubocop-eightyfourcodes
```

### Rake task
## Development

```ruby
RuboCop::RakeTask.new do |task|
task.requires << 'rubocop-eightyfourcodes'
end
```
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.

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

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

```yaml
# Inspect all files
AllCops:
EightyFourCodes:
Patterns:
- '.+'
```

```yaml
# Inspect only controller files.
AllCops:
EightyFourCodes:
Patterns:
- app/controllers/**/*.rb
```

## The Cops

All cops are located under
[`lib/rubocop/cop/eighty_four_codes`](lib/rubocop/cop/eighty_four_codes), and contain
examples/documentation.

In your `.rubocop.yml`, you may treat the eightyfourcodes cops just like any other
cop. For example:

```yaml
EightyFourCodes/CommandLiteralInjection:
Exclude:
- 'spec/**/*'
```
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).

## Contributing

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

## License

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

0 comments on commit 8a5f5b7

Please sign in to comment.