rubocop-cargosense 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/LICENSE +21 -0
- data/README.md +40 -0
- data/config/default.yml +177 -0
- data/lib/rubocop/cargosense/inject.rb +16 -0
- data/lib/rubocop/cargosense.rb +11 -0
- data/lib/rubocop-cargosense.rb +10 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c72056ae5e176a177af44006de8034c7559f7e7e90018d3282fdfb1f6c5430b9
|
4
|
+
data.tar.gz: 1ea28f20a44a78ab4730881c22f9ff756b86fd6f2577e224e9f4bb1f0bbdc522
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 314891ce08a392c02143cfd6969d52ee4090bc1fa0b3db6236bc27fd9320c2069b1c01b89143f3caea8b7d691e6c963ed31ae5b2ab7c89bde7a0afdcae1102db
|
7
|
+
data.tar.gz: 9b1fa52647312ef6400c305b0945385a4ac408f5c22ce71c4293cfdff2dd138cc9da31f879ab657eca3c10f4aab5fe6fea2ebee6d5f31f7d0a377e1118638281
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 CargoSense, Inc.
|
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,40 @@
|
|
1
|
+
# rubocop-cargosense
|
2
|
+
|
3
|
+
**Reusable [RuboCop](https://rubocop.org) configuration for [CargoSense](https://www.cargosense.com)'s Ruby projects.**
|
4
|
+
|
5
|
+
[![Gem](https://img.shields.io/gem/v/rubocop-cargosense.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/rubocop-cargosense)
|
6
|
+
[![Downloads](https://img.shields.io/gem/dt/rubocop-cargosense.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/rubocop-cargosense)
|
7
|
+
[![Build](https://img.shields.io/github/actions/workflow/status/CargoSense/rubocop-cargosense/ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/CargoSense/rubocop-cargosense/actions/workflows/ci.yml)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add rubocop-cargosense to your project's `Gemfile` and run `bundle install`:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem "rubocop-cargosense", require: false
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Include rubocop-cargosense in your project's `.rubocop.yml` using [RuboCop's `require` directive](https://docs.rubocop.org/rubocop/extensions.html#loading-extensions):
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
# .rubocop.yml
|
23
|
+
require:
|
24
|
+
- rubocop-cargosense
|
25
|
+
```
|
26
|
+
|
27
|
+
> [!TIP]
|
28
|
+
> If rubocop-cargosense is your project's only RuboCop extension, you can simplify the above directive: `require: rubocop-cargosense`
|
29
|
+
|
30
|
+
Or, inherit rubocop-cargosense's configuration using [RuboCop's `inherit_gem` directive](https://docs.rubocop.org/rubocop/configuration.html#inheriting-configuration-from-a-dependency-gem):
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
# .rubocop.yml
|
34
|
+
inherit_gem:
|
35
|
+
rubocop-cargosense: config/default.yml
|
36
|
+
```
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
rubocop-cargosense is freely available under the [MIT License](https://opensource.org/licenses/MIT).
|
data/config/default.yml
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
inherit_mode:
|
2
|
+
merge:
|
3
|
+
- Exclude
|
4
|
+
- Include
|
5
|
+
|
6
|
+
require:
|
7
|
+
- rubocop-performance
|
8
|
+
- rubocop-rake
|
9
|
+
|
10
|
+
AllCops:
|
11
|
+
ActiveSupportExtensionsEnabled: true
|
12
|
+
DisplayStyleGuide: true
|
13
|
+
ExtraDetails: true
|
14
|
+
NewCops: enable
|
15
|
+
|
16
|
+
Layout/ClassStructure:
|
17
|
+
Enabled: true
|
18
|
+
ExpectedOrder:
|
19
|
+
- module_inclusion
|
20
|
+
- constants
|
21
|
+
- association
|
22
|
+
- public_attribute_macros
|
23
|
+
- public_delegate
|
24
|
+
- macros
|
25
|
+
- public_class_methods
|
26
|
+
- initializer
|
27
|
+
- public_methods
|
28
|
+
- protected_attribute_macros
|
29
|
+
- protected_methods
|
30
|
+
- private_attribute_macros
|
31
|
+
- private_delegate
|
32
|
+
- private_methods
|
33
|
+
|
34
|
+
Layout/EmptyLineAfterMultilineCondition:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
Layout/FirstHashElementIndentation:
|
38
|
+
EnforcedStyle: consistent
|
39
|
+
|
40
|
+
Layout/HeredocArgumentClosingParenthesis:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
Layout/MultilineArrayLineBreaks:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Layout/MultilineAssignmentLayout:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
Layout/MultilineHashKeyLineBreaks:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Layout/MultilineMethodArgumentLineBreaks:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Layout/MultilineMethodCallIndentation:
|
56
|
+
EnforcedStyle: indented_relative_to_receiver
|
57
|
+
|
58
|
+
Layout/MultilineMethodParameterLineBreaks:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Layout/MultilineOperationIndentation:
|
62
|
+
EnforcedStyle: indented
|
63
|
+
|
64
|
+
Layout/ParameterAlignment:
|
65
|
+
EnforcedStyle: with_fixed_indentation
|
66
|
+
|
67
|
+
Lint/HeredocMethodCallPosition:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Metrics/BlockLength:
|
71
|
+
CountAsOne:
|
72
|
+
- array
|
73
|
+
- hash
|
74
|
+
- heredoc
|
75
|
+
- method_call
|
76
|
+
|
77
|
+
Metrics/ClassLength:
|
78
|
+
CountAsOne:
|
79
|
+
- array
|
80
|
+
- hash
|
81
|
+
- heredoc
|
82
|
+
- method_call
|
83
|
+
|
84
|
+
Metrics/MethodLength:
|
85
|
+
CountAsOne:
|
86
|
+
- array
|
87
|
+
- hash
|
88
|
+
- heredoc
|
89
|
+
- method_call
|
90
|
+
|
91
|
+
Metrics/ModuleLength:
|
92
|
+
CountAsOne:
|
93
|
+
- array
|
94
|
+
- hash
|
95
|
+
- heredoc
|
96
|
+
- method_call
|
97
|
+
|
98
|
+
Metrics/ParameterLists:
|
99
|
+
CountKeywordArgs: false
|
100
|
+
|
101
|
+
Naming/InclusiveLanguage:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Naming/VariableNumber:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Performance/ChainArrayAllocation:
|
108
|
+
Enabled: true
|
109
|
+
|
110
|
+
Performance/IoReadlines:
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
Performance/OpenStruct:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
Performance/SelectMap:
|
117
|
+
Enabled: true
|
118
|
+
|
119
|
+
Style/ArrayCoercion:
|
120
|
+
Enabled: true
|
121
|
+
|
122
|
+
Style/AutoResourceCleanup:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
Style/ClassMethodsDefinitions:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Style/CollectionMethods:
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
Style/DateTime:
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
Style/Documentation:
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
Style/EmptyMethod:
|
138
|
+
EnforcedStyle: expanded
|
139
|
+
|
140
|
+
Style/HashSyntax:
|
141
|
+
EnforcedShorthandSyntax: never
|
142
|
+
|
143
|
+
Style/MethodCalledOnDoEndBlock:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Style/MultilineMethodSignature:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
Style/OptionHash:
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Style/ReturnNil:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
Style/Send:
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
Style/StaticClass:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Style/StringLiterals:
|
162
|
+
EnforcedStyle: double_quotes
|
163
|
+
|
164
|
+
Style/StringLiteralsInInterpolation:
|
165
|
+
EnforcedStyle: double_quotes
|
166
|
+
|
167
|
+
Style/StringMethods:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Style/SymbolArray:
|
171
|
+
EnforcedStyle: brackets
|
172
|
+
|
173
|
+
Style/WordArray:
|
174
|
+
EnforcedStyle: brackets
|
175
|
+
|
176
|
+
Style/UnlessLogicalOperators:
|
177
|
+
Enabled: true
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module CargoSense
|
5
|
+
module Inject
|
6
|
+
def self.defaults!
|
7
|
+
path = CONFIG_DEFAULT.to_s
|
8
|
+
hash = ConfigLoader.load_file(path)
|
9
|
+
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
10
|
+
puts "configuration from #{path}" if ConfigLoader.debug?
|
11
|
+
config = ConfigLoader.merge_with_default(config, path, unset_nil: false)
|
12
|
+
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module CargoSense
|
5
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
6
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default.yml").freeze
|
7
|
+
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
8
|
+
|
9
|
+
private_constant :CONFIG_DEFAULT, :PROJECT_ROOT
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-cargosense
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- CargoSense
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-12-22 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.59'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.59'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-performance
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.20'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.20'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.6'
|
55
|
+
description: Reusable RuboCop configuration for CargoSense's Ruby projects.
|
56
|
+
email:
|
57
|
+
- rubygems@cargosense.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- LICENSE
|
63
|
+
- README.md
|
64
|
+
- config/default.yml
|
65
|
+
- lib/rubocop-cargosense.rb
|
66
|
+
- lib/rubocop/cargosense.rb
|
67
|
+
- lib/rubocop/cargosense/inject.rb
|
68
|
+
homepage: https://github.com/CargoSense/rubocop-cargosense
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata:
|
72
|
+
bug_tracker_uri: https://github.com/CargoSense/rubocop-cargosense/issues
|
73
|
+
rubygems_mfa_required: 'true'
|
74
|
+
source_code_uri: https://github.com/CargoSense/rubocop-cargosense/tree/v0.1.0
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubygems_version: 3.2.33
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Reusable RuboCop configuration for CargoSense's Ruby projects.
|
94
|
+
test_files: []
|