rubocop-treatwell 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +90 -0
- data/LICENSE +21 -0
- data/README.md +60 -0
- data/Rakefile +31 -0
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/rails/unscoped_over_non_model_constant.rb +52 -0
- data/lib/rubocop/cop/treatwell_cops.rb +2 -0
- data/lib/rubocop/treatwell/inject.rb +20 -0
- data/lib/rubocop/treatwell/version.rb +7 -0
- data/lib/rubocop/treatwell.rb +15 -0
- data/lib/rubocop-treatwell.rb +11 -0
- data/rubocop-treatwell-style.yml +147 -0
- data/rubocop-treatwell.gemspec +40 -0
- data/sig/rubocop/treatwell.rbs +6 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bcd13a2fb4af356b3d33e9ed7fc5bd93e028d0cec19ace9520e062059141a394
|
4
|
+
data.tar.gz: dcb685ec0fe02ec15b864ec633eb396253a37011d121b71484ae13e82678deca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9d2efdea6c0c5414dad6e97c20ebabf1d4c6f3d9b6adc3bffb9e0b7be667d204481be66aab622ff576f1732dbe988f34a90a5c5b7cf12017de89b333988ee342
|
7
|
+
data.tar.gz: dace67517344e59cfa042d9529ca95fbf06411e095dacb9ea432bea290f2245eedca6ff5c67886a8f133b9e1e85285d1d1815768685b8fd31faf2d7fcc111413
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- rubocop-treatwell-style.yml
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
NewCops: enable
|
6
|
+
|
7
|
+
# Is not a rails project
|
8
|
+
Rails:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Naming/FileName:
|
12
|
+
Exclude:
|
13
|
+
- lib/rubocop-treatwell.rb
|
14
|
+
|
15
|
+
Style/Documentation:
|
16
|
+
Exclude:
|
17
|
+
- 'spec/**/*'
|
18
|
+
- 'test/**/*'
|
19
|
+
- 'lib/rubocop/treatwell.rb'
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rubocop-treatwell (0.1.0)
|
5
|
+
rubocop (~> 1.50.0)
|
6
|
+
rubocop-checkstyle_formatter (~> 0.6.0)
|
7
|
+
rubocop-performance (~> 1.17.0)
|
8
|
+
rubocop-rails (~> 2.19.0)
|
9
|
+
rubocop-rspec (~> 2.22.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
activesupport (7.0.5)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
ast (2.4.2)
|
20
|
+
concurrent-ruby (1.2.2)
|
21
|
+
diff-lcs (1.5.0)
|
22
|
+
i18n (1.14.0)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
json (2.6.3)
|
25
|
+
minitest (5.18.0)
|
26
|
+
parallel (1.23.0)
|
27
|
+
parser (3.2.2.1)
|
28
|
+
ast (~> 2.4.1)
|
29
|
+
rack (3.0.7)
|
30
|
+
rainbow (3.1.1)
|
31
|
+
rake (13.0.6)
|
32
|
+
regexp_parser (2.8.0)
|
33
|
+
rexml (3.2.5)
|
34
|
+
rspec (3.12.0)
|
35
|
+
rspec-core (~> 3.12.0)
|
36
|
+
rspec-expectations (~> 3.12.0)
|
37
|
+
rspec-mocks (~> 3.12.0)
|
38
|
+
rspec-core (3.12.1)
|
39
|
+
rspec-support (~> 3.12.0)
|
40
|
+
rspec-expectations (3.12.2)
|
41
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
+
rspec-support (~> 3.12.0)
|
43
|
+
rspec-mocks (3.12.4)
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
+
rspec-support (~> 3.12.0)
|
46
|
+
rspec-support (3.12.0)
|
47
|
+
rubocop (1.50.2)
|
48
|
+
json (~> 2.3)
|
49
|
+
parallel (~> 1.10)
|
50
|
+
parser (>= 3.2.0.0)
|
51
|
+
rainbow (>= 2.2.2, < 4.0)
|
52
|
+
regexp_parser (>= 1.8, < 3.0)
|
53
|
+
rexml (>= 3.2.5, < 4.0)
|
54
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
55
|
+
ruby-progressbar (~> 1.7)
|
56
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
57
|
+
rubocop-ast (1.29.0)
|
58
|
+
parser (>= 3.2.1.0)
|
59
|
+
rubocop-capybara (2.18.0)
|
60
|
+
rubocop (~> 1.41)
|
61
|
+
rubocop-checkstyle_formatter (0.6.0)
|
62
|
+
rubocop (>= 1.14.0)
|
63
|
+
rubocop-factory_bot (2.23.1)
|
64
|
+
rubocop (~> 1.33)
|
65
|
+
rubocop-performance (1.17.1)
|
66
|
+
rubocop (>= 1.7.0, < 2.0)
|
67
|
+
rubocop-ast (>= 0.4.0)
|
68
|
+
rubocop-rails (2.19.1)
|
69
|
+
activesupport (>= 4.2.0)
|
70
|
+
rack (>= 1.1)
|
71
|
+
rubocop (>= 1.33.0, < 2.0)
|
72
|
+
rubocop-rspec (2.22.0)
|
73
|
+
rubocop (~> 1.33)
|
74
|
+
rubocop-capybara (~> 2.17)
|
75
|
+
rubocop-factory_bot (~> 2.22)
|
76
|
+
ruby-progressbar (1.13.0)
|
77
|
+
tzinfo (2.0.6)
|
78
|
+
concurrent-ruby (~> 1.0)
|
79
|
+
unicode-display_width (2.4.2)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
arm64-darwin-22
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
rake (~> 13.0)
|
86
|
+
rspec (~> 3.0)
|
87
|
+
rubocop-treatwell!
|
88
|
+
|
89
|
+
BUNDLED WITH
|
90
|
+
2.3.26
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Treatwell
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
<div align="center">
|
2
|
+
|
3
|
+
#### A Ruby style guide by
|
4
|
+
|
5
|
+
[![](https://cdn1.treatwell.net/images/view/v2.i1756348.w200.h50.x4965194E.jpeg)](https://treatwell.com/tech)
|
6
|
+
|
7
|
+
</div>
|
8
|
+
|
9
|
+
# Introduction
|
10
|
+
|
11
|
+
This style guide make use of [Relaxed Ruby Style](https://relaxed.ruby.style/), adding customizations used in Treatwell's Ruby projects.
|
12
|
+
|
13
|
+
# Usage
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'rubocop-treatwell'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle install
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install rubocop-treatwell
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
Add the following to the top of your `.rubocop.yml`:
|
34
|
+
|
35
|
+
```yaml
|
36
|
+
inherit_gem:
|
37
|
+
rubocop-treatwell: rubocop-treatwell-style.yml
|
38
|
+
```
|
39
|
+
|
40
|
+
And run:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
bundle exec rubocop
|
44
|
+
```
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
49
|
+
|
50
|
+
To add a new cop, run `bundle exec rake 'new_cop[Foobar/SuperCoolCopName]'`
|
51
|
+
|
52
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
|
+
|
54
|
+
### Testing
|
55
|
+
|
56
|
+
You can execute a smoke test with `bundle exec rspec`. Check it is success before open a pull request.
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/treatwell/rubocop-treatwell.
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task default: :spec
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
11
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Generate a new cop with a template'
|
15
|
+
task :new_cop, [:cop] do |_task, args|
|
16
|
+
require 'rubocop'
|
17
|
+
|
18
|
+
cop_name = args.fetch(:cop) do
|
19
|
+
warn 'usage: bundle exec rake new_cop[Department/Name]'
|
20
|
+
exit!
|
21
|
+
end
|
22
|
+
|
23
|
+
generator = RuboCop::Cop::Generator.new(cop_name)
|
24
|
+
|
25
|
+
generator.write_source
|
26
|
+
generator.write_spec
|
27
|
+
generator.inject_require(root_file_path: 'lib/rubocop/cop/treatwell_cops.rb')
|
28
|
+
generator.inject_config(config_file_path: 'config/default.yml')
|
29
|
+
|
30
|
+
puts generator.todo
|
31
|
+
end
|
data/config/default.yml
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Rails
|
6
|
+
# Identifies calls to `unscoped` over non model constants. This can be an issue because
|
7
|
+
# `unscoped` removes all scopes defined before. Calling it directly to the model, it
|
8
|
+
# can be considered as safe because only `default_scope` will be removed, which is the
|
9
|
+
# main reason to use `unscoped` statement.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# # bad
|
13
|
+
# User.where(trashed: true).unscoped.first
|
14
|
+
# User.trashed.unscoped.joins(:posts).where(posts: { trashed: true, title: 'Rails' }).first
|
15
|
+
# User.joins(:posts).where(posts: { trashed: true, title: 'Rails' }).unscoped.first
|
16
|
+
#
|
17
|
+
# # good
|
18
|
+
# User.unscoped.where(trashed: true)
|
19
|
+
# User.unscoped.joins(:posts).where(posts: { trashed: true, title: 'Rails' })
|
20
|
+
class UnscopedOverNonModelConstant < Base
|
21
|
+
MSG = 'Prevent usage of `unscoped` over non model constants.'
|
22
|
+
RESTRICT_ON_SEND = %i[unscoped].freeze
|
23
|
+
|
24
|
+
def_node_matcher :unscoped_call?, <<~PATTERN
|
25
|
+
(send _ :unscoped $...)
|
26
|
+
PATTERN
|
27
|
+
|
28
|
+
def on_send(node)
|
29
|
+
return if node.receiver.respond_to?(:method_name) && _allowed_methods.include?(node.receiver.method_name.to_s)
|
30
|
+
|
31
|
+
unscoped_call?(node) do
|
32
|
+
next unless _unscoped_on_non_const?(node)
|
33
|
+
|
34
|
+
range = node.loc.selector.with(end_pos: node.loc.expression.end_pos)
|
35
|
+
|
36
|
+
add_offense(range)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def _unscoped_on_non_const?(node)
|
43
|
+
!node.receiver.const_type?
|
44
|
+
end
|
45
|
+
|
46
|
+
def _allowed_methods
|
47
|
+
cop_config['AllowedMethods'] || []
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
4
|
+
# See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
|
5
|
+
module RuboCop
|
6
|
+
module Treatwell
|
7
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
|
+
# bit of our configuration.
|
9
|
+
module Inject
|
10
|
+
def self.defaults!
|
11
|
+
path = CONFIG_DEFAULT.to_s
|
12
|
+
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
|
+
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
14
|
+
puts "configuration from #{path}" if ConfigLoader.debug?
|
15
|
+
config = ConfigLoader.merge_with_default(config, path)
|
16
|
+
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "treatwell/version"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Treatwell
|
7
|
+
class Error < StandardError; end
|
8
|
+
# Your code goes here...
|
9
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
10
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
11
|
+
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
12
|
+
|
13
|
+
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop'
|
4
|
+
|
5
|
+
require_relative 'rubocop/treatwell'
|
6
|
+
require_relative 'rubocop/treatwell/version'
|
7
|
+
require_relative 'rubocop/treatwell/inject'
|
8
|
+
|
9
|
+
RuboCop::Treatwell::Inject.defaults!
|
10
|
+
|
11
|
+
require_relative 'rubocop/cop/treatwell_cops'
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# This file will inherit from default rubocop config located at
|
2
|
+
# https://github.com/rubocop/rubocop/blob/master/config/default.yml
|
3
|
+
# and other default config from gems, like rubocop-rails, rubocop-rspec, etc.
|
4
|
+
# Some of the default rules are not meant/compatible for monorepo structure
|
5
|
+
# especially if you run rubocop on the whole repo, so we need to override them.
|
6
|
+
# e.g. default config has a global exclusion list for stuff located in root folder
|
7
|
+
#
|
8
|
+
# Exclude: Exclude:
|
9
|
+
# - 'node_modules/**/*'
|
10
|
+
# - 'tmp/**/*'
|
11
|
+
#
|
12
|
+
# This is not appliable for monorepo structure, if you run rubocop from the root
|
13
|
+
# folder it will try to analyze stuff in <app>/tmp, while when run in <app> folder
|
14
|
+
# it works as intended. We need to tweak include/exclude using better glob patterns
|
15
|
+
# (e.g. **/tmp/**/*). Also never use relative paths in Include/Exclude, rules, always use
|
16
|
+
# '**/bin/**/*' instead of './bin/**/*' to avoid issues with working directory when runnint it.
|
17
|
+
|
18
|
+
inherit_from:
|
19
|
+
- https://relaxed.ruby.style/rubocop.yml
|
20
|
+
|
21
|
+
require:
|
22
|
+
- rubocop-performance
|
23
|
+
- rubocop-rspec
|
24
|
+
- rubocop-rails
|
25
|
+
- rubocop-treatwell
|
26
|
+
|
27
|
+
AllCops:
|
28
|
+
NewCops: enable
|
29
|
+
Exclude:
|
30
|
+
- '**/bin/*'
|
31
|
+
- '**/db/schema.rb'
|
32
|
+
|
33
|
+
# Ignore symlinks
|
34
|
+
<% Dir['../**/*'].each do |dir| %>
|
35
|
+
<% next unless File.symlink?(dir) %>
|
36
|
+
- <%= File.directory?(dir) ? "#{dir}/**/*" : dir %>
|
37
|
+
<% end %>
|
38
|
+
SuggestExtensions:
|
39
|
+
rubocop-rake: false
|
40
|
+
|
41
|
+
Bundler/OrderedGems:
|
42
|
+
Exclude:
|
43
|
+
- '**/Gemfile'
|
44
|
+
|
45
|
+
Layout/CaseIndentation:
|
46
|
+
EnforcedStyle: end
|
47
|
+
|
48
|
+
Layout/EndAlignment:
|
49
|
+
EnforcedStyleAlignWith: start_of_line
|
50
|
+
|
51
|
+
Layout/ExtraSpacing:
|
52
|
+
Exclude:
|
53
|
+
- '**/config/routes.rb'
|
54
|
+
|
55
|
+
Layout/FirstArrayElementIndentation:
|
56
|
+
EnforcedStyle: consistent
|
57
|
+
|
58
|
+
Layout/FirstHashElementIndentation:
|
59
|
+
EnforcedStyle: consistent
|
60
|
+
|
61
|
+
Layout/HashAlignment:
|
62
|
+
EnforcedColonStyle:
|
63
|
+
- key
|
64
|
+
- table
|
65
|
+
EnforcedHashRocketStyle:
|
66
|
+
- key
|
67
|
+
- table
|
68
|
+
|
69
|
+
Layout/MultilineMethodCallIndentation:
|
70
|
+
EnforcedStyle: indented
|
71
|
+
|
72
|
+
Layout/SpaceBeforeFirstArg:
|
73
|
+
Exclude:
|
74
|
+
- '**/config/routes.rb'
|
75
|
+
|
76
|
+
Layout/SpaceInsideParens:
|
77
|
+
EnforcedStyle: no_space
|
78
|
+
|
79
|
+
Layout/TrailingEmptyLines:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Lint/AmbiguousBlockAssociation:
|
83
|
+
AllowedMethods:
|
84
|
+
- change
|
85
|
+
- not_change
|
86
|
+
- have_enqueued_job
|
87
|
+
- with
|
88
|
+
- once
|
89
|
+
|
90
|
+
Lint/UnusedMethodArgument:
|
91
|
+
AllowUnusedKeywordArguments: true
|
92
|
+
|
93
|
+
Metrics/BlockLength:
|
94
|
+
Exclude:
|
95
|
+
- '**/config/routes.rb'
|
96
|
+
|
97
|
+
Metrics/MethodLength:
|
98
|
+
Max: 80
|
99
|
+
|
100
|
+
Metrics/ParameterLists:
|
101
|
+
Max: 8
|
102
|
+
|
103
|
+
Naming/MethodParameterName:
|
104
|
+
AllowedNames: io, id, to, by, on, in, at, ip, db, as
|
105
|
+
|
106
|
+
Rails/WhereExists:
|
107
|
+
EnforcedStyle: where
|
108
|
+
|
109
|
+
Rails/SkipsModelValidations:
|
110
|
+
Exclude:
|
111
|
+
- '**/db/main/migrate/**/*'
|
112
|
+
- '**/spec/**/*'
|
113
|
+
|
114
|
+
RSpec/ExampleLength:
|
115
|
+
Max: 20
|
116
|
+
|
117
|
+
RSpec/MultipleMemoizedHelpers:
|
118
|
+
Max: 10
|
119
|
+
|
120
|
+
RSpec/MessageSpies:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
RSpec/NamedSubject:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
RSpec/NestedGroups:
|
127
|
+
Max: 5
|
128
|
+
|
129
|
+
RSpec/StubbedMock:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/AsciiComments:
|
133
|
+
AllowedChars:
|
134
|
+
- '€'
|
135
|
+
|
136
|
+
Style/FormatStringToken:
|
137
|
+
Exclude:
|
138
|
+
- '**/config/routes.rb'
|
139
|
+
|
140
|
+
Style/HashSyntax:
|
141
|
+
EnforcedShorthandSyntax: never
|
142
|
+
|
143
|
+
Style/PreferredHashMethods:
|
144
|
+
EnforcedStyle: 'verbose'
|
145
|
+
|
146
|
+
Style/RescueStandardError:
|
147
|
+
EnforcedStyle: 'implicit'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/rubocop/treatwell/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rubocop-treatwell"
|
7
|
+
spec.version = RuboCop::Treatwell::VERSION
|
8
|
+
spec.authors = ["Treatwell Team"]
|
9
|
+
spec.email = ["info@treatwell.com"]
|
10
|
+
|
11
|
+
spec.summary = "Shared style guide for Treatwell Ruby projects"
|
12
|
+
spec.description = "Treatwell::RubyStyle provides a set of shared style guide used across all Treatwell Ruby projects"
|
13
|
+
spec.homepage = "https://github.com/treatwell/ruby-style"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
21
|
+
spec.metadata['rubygems_mfa_required'] = "true"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(__dir__) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# These dependencies are included in all applications
|
35
|
+
spec.add_runtime_dependency 'rubocop', '~> 1.50.0'
|
36
|
+
spec.add_runtime_dependency 'rubocop-checkstyle_formatter', '~> 0.6.0'
|
37
|
+
spec.add_runtime_dependency 'rubocop-performance', '~> 1.17.0'
|
38
|
+
spec.add_runtime_dependency 'rubocop-rails', '~> 2.19.0'
|
39
|
+
spec.add_runtime_dependency 'rubocop-rspec', '~> 2.22.0'
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-treatwell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Treatwell Team
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-05 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.50.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.50.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-checkstyle_formatter
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.6.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-performance
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.17.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.17.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.19.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.19.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.22.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.22.0
|
83
|
+
description: Treatwell::RubyStyle provides a set of shared style guide used across
|
84
|
+
all Treatwell Ruby projects
|
85
|
+
email:
|
86
|
+
- info@treatwell.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".rspec"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- config/default.yml
|
99
|
+
- lib/rubocop-treatwell.rb
|
100
|
+
- lib/rubocop/cop/rails/unscoped_over_non_model_constant.rb
|
101
|
+
- lib/rubocop/cop/treatwell_cops.rb
|
102
|
+
- lib/rubocop/treatwell.rb
|
103
|
+
- lib/rubocop/treatwell/inject.rb
|
104
|
+
- lib/rubocop/treatwell/version.rb
|
105
|
+
- rubocop-treatwell-style.yml
|
106
|
+
- rubocop-treatwell.gemspec
|
107
|
+
- sig/rubocop/treatwell.rbs
|
108
|
+
homepage: https://github.com/treatwell/ruby-style
|
109
|
+
licenses: []
|
110
|
+
metadata:
|
111
|
+
allowed_push_host: https://rubygems.org
|
112
|
+
homepage_uri: https://github.com/treatwell/ruby-style
|
113
|
+
source_code_uri: https://github.com/treatwell/ruby-style
|
114
|
+
rubygems_mfa_required: 'true'
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 2.6.0
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubygems_version: 3.3.26
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Shared style guide for Treatwell Ruby projects
|
134
|
+
test_files: []
|