boxt_rubocop 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +91 -0
- data/Rakefile +12 -0
- data/VERSION +1 -0
- data/default.yml +43 -0
- data/lib/boxt_rubocop/version.rb +5 -0
- data/lib/boxt_rubocop.rb +15 -0
- data/rails.yml +20 -0
- data/rspec.yml +12 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7c3a40b7d0af85cb456f3e5a369b0e7086f083b68ee31dc8bc2b5c5a0a0321d2
|
4
|
+
data.tar.gz: 3588bd96d35b7f50e60e7c169e847a292c645f7236b425962d1a6aa807ac5bab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f13c650457c551de7d2605ed135bb22a4b4f7d7f9df9915ec8f8f3aa027144fd2a219cdfbe53fcc48904056cad0750fb3fa25bd1244d04de716b978711d97d7
|
7
|
+
data.tar.gz: 25468f95d36ea24411aaf46e8b1fd1b3b03ad557b5c7ef00bec33c6b00563a7e8107f5f9bf4589842865d37933c9f09558ad35c80fc58c8d0405196ca5d315e6
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2022 Boxt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# BOXT Rubocop
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/boxt_rubocop.svg)](https://badge.fury.io/rb/boxt_rubocop)
|
4
|
+
[![CI](https://github.com/boxt/boxt_rubocop/actions/workflows/ci.yml/badge.svg)](https://github.com/boxt/boxt_rubocop/actions/workflows/ci.yml)
|
5
|
+
|
6
|
+
Base [Rubocop](https://rubocop.org) settings for all Boxt Ruby projects.
|
7
|
+
|
8
|
+
## Requirements
|
9
|
+
|
10
|
+
* Ruby >= 2.7
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
group :development, :test do
|
18
|
+
# ...
|
19
|
+
gem "boxt_rubocop"
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
bundle
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Add a `.rubocop.yml` file to the root of your project with the following settings:
|
32
|
+
|
33
|
+
```yml
|
34
|
+
inherit_gem:
|
35
|
+
boxt_rubocop:
|
36
|
+
- default.yml # use default cops
|
37
|
+
- rails.yml # use Rails cops - see Additional Extensions/Cops
|
38
|
+
- rspec.yml # use rspec cops - see Additional Extensions/Cops
|
39
|
+
```
|
40
|
+
|
41
|
+
### NewCops
|
42
|
+
|
43
|
+
`NewCops` is enabled by default.
|
44
|
+
|
45
|
+
### Additional Extensions/Cops
|
46
|
+
|
47
|
+
The following Rubocop gems are also installed with this gem:
|
48
|
+
|
49
|
+
* [rubocop-faker](https://github.com/koic/rubocop-faker)
|
50
|
+
* [rubocop-rails](https://github.com/rubocop-hq/rubocop-rails)
|
51
|
+
* [rubocop-rake](https://github.com/rubocop-hq/rubocop-rake)
|
52
|
+
* [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec)
|
53
|
+
|
54
|
+
To enable these add the following to your `.rubocop.yml` file.
|
55
|
+
|
56
|
+
```yml
|
57
|
+
inherit_gem:
|
58
|
+
boxt_rubocop:
|
59
|
+
# .... add cops
|
60
|
+
|
61
|
+
require:
|
62
|
+
- rubocop-faker # if your project is using the Faker gem then add this
|
63
|
+
- rubocop-rails # if your project is a Rails app/engine then add this, plus the - rails.yml setting above
|
64
|
+
- rubocop-rake # if your project is using rake then add this
|
65
|
+
- rubocop-rspec # if your project is using rspec then add this, plus the - rspec.yml setting above
|
66
|
+
```
|
67
|
+
|
68
|
+
## Editor Plugins
|
69
|
+
|
70
|
+
There are also some useful Rubocop editor plugins to help with in-editor linting.
|
71
|
+
|
72
|
+
### Atom
|
73
|
+
|
74
|
+
- [linter-rubocop](https://atom.io/packages/linter-rubocop)
|
75
|
+
- [rubocop-auto-correct](https://atom.io/packages/rubocop-auto-correct)
|
76
|
+
|
77
|
+
### RubyMine
|
78
|
+
|
79
|
+
- [rubocop](https://www.jetbrains.com/help/ruby/rubocop.html)
|
80
|
+
|
81
|
+
### VSCode
|
82
|
+
|
83
|
+
- [ruby-rubocop](https://marketplace.visualstudio.com/items?itemName=misogi.ruby-rubocop)
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/boxt/boxt_rubocop.
|
88
|
+
|
89
|
+
## License
|
90
|
+
|
91
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rspec/core/rake_task"
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
8
|
+
t.pattern = Dir.glob("spec/**/*_spec.rb")
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Map rake test to rake spec"
|
12
|
+
task test: :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/default.yml
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "**/*/schema.rb"
|
4
|
+
- Gemfile.lock
|
5
|
+
- node_modules/**/*
|
6
|
+
- tmp/**/*
|
7
|
+
- vendor/**/*
|
8
|
+
NewCops: enable
|
9
|
+
Layout/ClassStructure:
|
10
|
+
Enabled: true
|
11
|
+
Layout/LineLength:
|
12
|
+
Exclude:
|
13
|
+
- config/routes.rb
|
14
|
+
- config/routes/*
|
15
|
+
Max: 120
|
16
|
+
Metrics/AbcSize:
|
17
|
+
Exclude:
|
18
|
+
- db/migrate/**/*
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Exclude:
|
21
|
+
- "*.gemspec"
|
22
|
+
- Gemfile
|
23
|
+
- config/routes.rb
|
24
|
+
- config/routes/*
|
25
|
+
- db/migrate/**/*
|
26
|
+
- spec/**/*
|
27
|
+
- test/**/*
|
28
|
+
Metrics/ClassLength:
|
29
|
+
Exclude:
|
30
|
+
- db/migrate/**/*
|
31
|
+
- spec/**/*
|
32
|
+
- test/**/*
|
33
|
+
Metrics/MethodLength:
|
34
|
+
Exclude:
|
35
|
+
- db/migrate/**/*
|
36
|
+
- spec/**/*
|
37
|
+
- test/**/*
|
38
|
+
Style/Documentation:
|
39
|
+
Enabled: false
|
40
|
+
Style/DoubleNegation:
|
41
|
+
Enabled: false
|
42
|
+
Style/StringLiterals:
|
43
|
+
EnforcedStyle: double_quotes
|
data/lib/boxt_rubocop.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "boxt_rubocop/version"
|
4
|
+
|
5
|
+
module BoxtRubocop
|
6
|
+
module_function
|
7
|
+
|
8
|
+
##
|
9
|
+
# Provide a root path helper for the gem root dir
|
10
|
+
#
|
11
|
+
# Returns Pathname
|
12
|
+
def root
|
13
|
+
Pathname.new(File.dirname(__dir__))
|
14
|
+
end
|
15
|
+
end
|
data/rails.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Rails/ApplicationController:
|
2
|
+
Exclude:
|
3
|
+
- spec/**/*
|
4
|
+
- test/**/*
|
5
|
+
Rails/EnvironmentVariableAccess:
|
6
|
+
AllowReads: true # Enabling allow reads so we can use ENV["VAR"]
|
7
|
+
Rails/SkipsModelValidations:
|
8
|
+
Exclude:
|
9
|
+
- db/migrate/**/*
|
10
|
+
- lib/tasks/**/*
|
11
|
+
- spec/**/*
|
12
|
+
- test/**/*
|
13
|
+
Rails/UnknownEnv:
|
14
|
+
Environments:
|
15
|
+
- cucumber
|
16
|
+
- development
|
17
|
+
- production
|
18
|
+
- qa
|
19
|
+
- test
|
20
|
+
- uat
|
data/rspec.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Excluding as we set up the rake specs as 'describe "rake namespace:task", type: :task do' which determines what task
|
2
|
+
# is being tested, and this cop doesn't like having a describe block without a class or module name.
|
3
|
+
RSpec/DescribeClass:
|
4
|
+
Exclude:
|
5
|
+
- spec/tasks/**/*
|
6
|
+
# This is to prevent Rubocop from bugging on a spec helper that doesn't contain an example, which the support ones don't
|
7
|
+
RSpec/LeadingSubject:
|
8
|
+
Exclude:
|
9
|
+
- spec/support
|
10
|
+
# Allow there to be a max of 4 example groups deep in Rspec tests
|
11
|
+
RSpec/NestedGroups:
|
12
|
+
Max: 4
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: boxt_rubocop
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Boxt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.26.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.26.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-faker
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.14.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.14.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.9.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.9.0
|
83
|
+
description: Base Rubocop settings for all Boxt Ruby projects
|
84
|
+
email:
|
85
|
+
- developers@boxt.co.uk
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- MIT-LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- VERSION
|
94
|
+
- default.yml
|
95
|
+
- lib/boxt_rubocop.rb
|
96
|
+
- lib/boxt_rubocop/version.rb
|
97
|
+
- rails.yml
|
98
|
+
- rspec.yml
|
99
|
+
homepage: https://github.com/boxt/boxt_rubocop
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata:
|
103
|
+
rubygems_mfa_required: 'true'
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '2.7'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubygems_version: 3.3.7
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Base Rubocop settings for all Boxt Ruby projects
|
123
|
+
test_files: []
|