netsoft-rubocop 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/TODO.md +4 -0
- data/config/default.yml +297 -0
- data/lib/netsoft-rubocop.rb +11 -0
- data/lib/netsoft/rubocop.rb +6 -1
- data/lib/netsoft/rubocop/cops/{auth_http_positional_arguments.rb → netsoft/auth_http_positional_arguments.rb} +5 -6
- data/lib/netsoft/rubocop/cops/netsoft_cops.rb +3 -0
- data/lib/netsoft/rubocop/inject.rb +18 -0
- data/lib/netsoft/rubocop/version.rb +1 -1
- metadata +47 -36
- data/.circleci/config.yml +0 -141
- data/.gitignore +0 -56
- data/.rubocop.yml +0 -1
- data/Dangerfile +0 -3
- data/Gemfile +0 -8
- data/Rakefile +0 -4
- data/bin/setup-rubygems.sh +0 -3
- data/bin/tag_check.sh +0 -17
- data/default.yml +0 -124
- data/netsoft-rubocop.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a27d4fbbc329f03b7ba1545338a36e2bed33af93c22a17a3be81e634c817f1a5
|
4
|
+
data.tar.gz: 1bea462450d76226ca69170644648dcd4f336ba3dc0b33933a3b5df9d8a9a12b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e640a48f004db898ad5a520361bb24ed5750f2af791e070bb1eb420e01eb001e28a289638ce46269ca73d4f26bdbeef3d99f6caac17f5c9c078ac93774025f73
|
7
|
+
data.tar.gz: f5e54bb635b7c4d71b1b5c53fcaa60e6316a1c2ff8be91c7a379af7478a6630a9f8addbe44c109694947fcbe24fe87e9b92a6711ffcf9e97e8815a94bdc2f69f
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
|
+
### Added
|
10
|
+
### Changed
|
11
|
+
### Fixed
|
9
12
|
|
13
|
+
## [1.1.0] - 2021-01-20
|
14
|
+
### Changed
|
15
|
+
- Switch to newest versions of rubocop, and rubocop-[everything]
|
16
|
+
- Update the default config with the recent set of rules corresponding to the new version
|
17
|
+
- reworked gem so that it can simply be required like other rubocop gems
|
10
18
|
|
11
19
|
## [1.0.2] - 2020-09-09
|
12
20
|
### Changed
|
data/TODO.md
ADDED
data/config/default.yml
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
require:
|
2
|
+
- ./lib/netsoft/rubocop/cops/auth_http_positional_arguments
|
3
|
+
- rubocop-rails
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rspec
|
6
|
+
- rubocop-rake
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
TargetRubyVersion: 2.5
|
10
|
+
TargetRailsVersion: 5.2
|
11
|
+
DisplayStyleGuide: true
|
12
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
13
|
+
NewCops: enable
|
14
|
+
Exclude:
|
15
|
+
- 'db/**/*'
|
16
|
+
- 'coverage/**/*'
|
17
|
+
- 'log/**/*'
|
18
|
+
- 'public/**/*'
|
19
|
+
- 'tmp/**/*'
|
20
|
+
- 'spec/dummy/**/*'
|
21
|
+
- 'vendor/**/*'
|
22
|
+
- 'gemfiles/**/*'
|
23
|
+
- 'node_modules/**/*'
|
24
|
+
|
25
|
+
# region Layout
|
26
|
+
Layout/AssignmentIndentation:
|
27
|
+
IndentationWidth: 4
|
28
|
+
|
29
|
+
Layout/ExtraSpacing:
|
30
|
+
AllowForAlignment: true
|
31
|
+
|
32
|
+
Layout/HashAlignment:
|
33
|
+
EnforcedHashRocketStyle: table
|
34
|
+
EnforcedColonStyle: table
|
35
|
+
|
36
|
+
Layout/FirstArrayElementIndentation:
|
37
|
+
EnforcedStyle: consistent
|
38
|
+
IndentationWidth: 4
|
39
|
+
|
40
|
+
Layout/FirstHashElementIndentation:
|
41
|
+
EnforcedStyle: consistent
|
42
|
+
IndentationWidth: 4
|
43
|
+
|
44
|
+
Layout/MultilineMethodCallIndentation:
|
45
|
+
EnforcedStyle: indented_relative_to_receiver
|
46
|
+
IndentationWidth: 4
|
47
|
+
|
48
|
+
Layout/SpaceInsideBlockBraces:
|
49
|
+
EnforcedStyle: space
|
50
|
+
SpaceBeforeBlockParameters: true
|
51
|
+
|
52
|
+
Layout/SpaceInsideHashLiteralBraces:
|
53
|
+
EnforcedStyle: no_space
|
54
|
+
# endregion
|
55
|
+
|
56
|
+
# region Lint
|
57
|
+
Lint/AmbiguousBlockAssociation:
|
58
|
+
Exclude:
|
59
|
+
- spec/**/*
|
60
|
+
|
61
|
+
Lint/NonDeterministicRequireOrder:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Lint/StructNewOverride:
|
65
|
+
Enabled: false
|
66
|
+
#endregion
|
67
|
+
|
68
|
+
# region Naming
|
69
|
+
Naming/RescuedExceptionsVariableName:
|
70
|
+
PreferredName: ex
|
71
|
+
|
72
|
+
Naming/MemoizedInstanceVariableName:
|
73
|
+
EnforcedStyleForLeadingUnderscores: optional
|
74
|
+
|
75
|
+
Naming/MethodParameterName:
|
76
|
+
AllowedNames:
|
77
|
+
- at
|
78
|
+
- by
|
79
|
+
- db
|
80
|
+
- id
|
81
|
+
- in
|
82
|
+
- io
|
83
|
+
- ip
|
84
|
+
- of
|
85
|
+
- 'on'
|
86
|
+
- os
|
87
|
+
- pp
|
88
|
+
- to
|
89
|
+
- tz
|
90
|
+
- my
|
91
|
+
- me
|
92
|
+
- ex
|
93
|
+
- uo
|
94
|
+
- up
|
95
|
+
|
96
|
+
Naming/PredicateName:
|
97
|
+
# By default, it also forbids has_, but that's rarely a good suggestion:
|
98
|
+
# is #has_screenshots? => #screenshots? better?..
|
99
|
+
ForbiddenPrefixes:
|
100
|
+
- is_
|
101
|
+
|
102
|
+
Naming/VariableNumber:
|
103
|
+
Enabled: false
|
104
|
+
# endregion
|
105
|
+
|
106
|
+
# region Performance
|
107
|
+
Performance/CollectionLiteralInLoop:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
Performance/MethodObjectAsBlock:
|
111
|
+
Enabled: false
|
112
|
+
|
113
|
+
# superseded by Performance/RgexpMatch
|
114
|
+
Performance/RedundantMatch:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Performance/BlockGivenWithExplicitBlock:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
Performance/TimesMap:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
# endregion
|
124
|
+
|
125
|
+
# region Rails
|
126
|
+
Rails:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
Rails/FilePath:
|
130
|
+
EnforcedStyle: arguments
|
131
|
+
|
132
|
+
# We do it on a DB level
|
133
|
+
Rails/HasManyOrHasOneDependent:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
Rails/HttpPositionalArguments:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
Rails/HttpStatus:
|
140
|
+
EnforcedStyle: numeric
|
141
|
+
|
142
|
+
Rails/SkipsModelValidations:
|
143
|
+
AllowedMethods:
|
144
|
+
- touch
|
145
|
+
- update_attribute
|
146
|
+
- update_counters
|
147
|
+
- increment_counter
|
148
|
+
- decrement_counter
|
149
|
+
|
150
|
+
Netsoft/AuthHttpPositionalArguments:
|
151
|
+
Enabled: true
|
152
|
+
Include:
|
153
|
+
- 'spec/controllers/**/*'
|
154
|
+
|
155
|
+
# endregion
|
156
|
+
|
157
|
+
# region RSpec
|
158
|
+
# Prohibits before/after(:all) for ever uses. But when we use it, we know what we do
|
159
|
+
RSpec/BeforeAfterAll:
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
RSpec/ExpectChange:
|
163
|
+
EnforcedStyle: block
|
164
|
+
|
165
|
+
RSpec/ImplicitSubject:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
# Just prohibits `let!` for any usages
|
169
|
+
# Nice try, Rubocop.
|
170
|
+
RSpec/LetSetup:
|
171
|
+
Enabled: false
|
172
|
+
|
173
|
+
RSpec/MessageSpies:
|
174
|
+
Enabled: false
|
175
|
+
|
176
|
+
# TODO: It would be good to set a realistic Max: once, but we have all kind of specs with multiple
|
177
|
+
# expectations now.
|
178
|
+
RSpec/MultipleExpectations:
|
179
|
+
Enabled: false
|
180
|
+
|
181
|
+
# Allows to limit number of `let`s. What for?..
|
182
|
+
# NB: With current setting (5 max) we have... "Offense count: 22706"
|
183
|
+
RSpec/MultipleMemoizedHelpers:
|
184
|
+
Enabled: false
|
185
|
+
|
186
|
+
RSpec/NamedSubject:
|
187
|
+
Enabled: false
|
188
|
+
|
189
|
+
RSpec/NestedGroups:
|
190
|
+
Enabled: false
|
191
|
+
|
192
|
+
RSpec/NotToNot:
|
193
|
+
EnforcedStyle: to_not
|
194
|
+
|
195
|
+
# endregion
|
196
|
+
|
197
|
+
# region Style
|
198
|
+
|
199
|
+
# Allows to enforce either this:
|
200
|
+
#
|
201
|
+
# attr_reader :a
|
202
|
+
# attr_reader :b
|
203
|
+
#
|
204
|
+
# (all accessors separate), or this:
|
205
|
+
#
|
206
|
+
# attr_reader :a, :b
|
207
|
+
#
|
208
|
+
# (all accessors in one statement).
|
209
|
+
#
|
210
|
+
# We use both, and it is hard to tell why it should be limited...
|
211
|
+
Style/AccessorGrouping:
|
212
|
+
Enabled: false
|
213
|
+
|
214
|
+
Style/AndOr:
|
215
|
+
EnforcedStyle: conditionals
|
216
|
+
|
217
|
+
Style/BlockDelimiters:
|
218
|
+
EnforcedStyle: semantic
|
219
|
+
AllowBracesOnProceduralOneLiners: true
|
220
|
+
|
221
|
+
Style/CommentAnnotation:
|
222
|
+
Enabled: false
|
223
|
+
|
224
|
+
# Asks to write comment besides dynamically evaluated method, showing how the code would look,
|
225
|
+
# see cop docs: https://docs.rubocop.org/rubocop/cops_style.html#styledocumentdynamicevaldefinition
|
226
|
+
#
|
227
|
+
# Ideally, would be cool, but lot of work.
|
228
|
+
Style/DocumentDynamicEvalDefinition:
|
229
|
+
Enabled: false
|
230
|
+
|
231
|
+
Style/DoubleNegation:
|
232
|
+
Enabled: false
|
233
|
+
|
234
|
+
# Asks to write empty methods this way:
|
235
|
+
#
|
236
|
+
# def foo; end
|
237
|
+
#
|
238
|
+
Style/EmptyMethod:
|
239
|
+
Enabled: false
|
240
|
+
|
241
|
+
Style/FormatString:
|
242
|
+
EnforcedStyle: percent
|
243
|
+
|
244
|
+
Style/FormatStringToken:
|
245
|
+
Enabled: false
|
246
|
+
|
247
|
+
Style/HashAsLastArrayItem:
|
248
|
+
EnforcedStyle: no_braces
|
249
|
+
|
250
|
+
Style/Lambda:
|
251
|
+
EnforcedStyle: literal
|
252
|
+
|
253
|
+
Style/MultilineBlockChain:
|
254
|
+
Enabled: false
|
255
|
+
|
256
|
+
# FIXME: This cop requires to attach .freeze to each and every constant.
|
257
|
+
# It is both ugly AND doesn't protect from bugs (the freeze is shallow, so some frozen CONFIG hash
|
258
|
+
# can still be changed).
|
259
|
+
# We need to develop our own .deep_freeze for configs, and cops to check that it is attached to
|
260
|
+
# hashes, arrays and values fetched from ENV/configs.
|
261
|
+
Style/MutableConstant:
|
262
|
+
Enabled: false
|
263
|
+
|
264
|
+
Style/ParallelAssignment:
|
265
|
+
Enabled: false
|
266
|
+
|
267
|
+
Style/RescueModifier:
|
268
|
+
Enabled: false
|
269
|
+
|
270
|
+
# Asks to avoid `rescue => exception` without particular class.
|
271
|
+
# Why?..
|
272
|
+
Style/RescueStandardError:
|
273
|
+
Enabled: false
|
274
|
+
|
275
|
+
Style/SingleArgumentDig:
|
276
|
+
Enabled: false
|
277
|
+
|
278
|
+
Style/StringConcatenation:
|
279
|
+
Enabled: false
|
280
|
+
|
281
|
+
Style/StringLiterals:
|
282
|
+
# up for debate
|
283
|
+
Enabled: false
|
284
|
+
|
285
|
+
Style/StructInheritance:
|
286
|
+
Enabled: false
|
287
|
+
|
288
|
+
Style/TrailingCommaInArrayLiteral:
|
289
|
+
EnforcedStyleForMultiline: comma
|
290
|
+
|
291
|
+
Style/TrailingCommaInHashLiteral:
|
292
|
+
EnforcedStyleForMultiline: comma
|
293
|
+
|
294
|
+
#endregion
|
295
|
+
|
296
|
+
Metrics:
|
297
|
+
Enabled: false
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop'
|
4
|
+
|
5
|
+
require_relative 'netsoft/rubocop'
|
6
|
+
require_relative 'netsoft/rubocop/version'
|
7
|
+
require_relative 'netsoft/rubocop/inject'
|
8
|
+
|
9
|
+
Netsoft::Rubocop::Inject.defaults!
|
10
|
+
|
11
|
+
require_relative 'netsoft/rubocop/cops/netsoft_cops'
|
data/lib/netsoft/rubocop.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'yaml'
|
4
4
|
|
5
5
|
module Netsoft
|
6
6
|
# Hubstaff shared rubocop style configs
|
7
7
|
module Rubocop
|
8
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
9
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
10
|
+
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
11
|
+
|
12
|
+
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
8
13
|
end
|
9
14
|
end
|
@@ -37,7 +37,7 @@ module RuboCop
|
|
37
37
|
PATTERN
|
38
38
|
|
39
39
|
def on_send(node)
|
40
|
-
message =
|
40
|
+
message = MSG % {verb: node.method_name}
|
41
41
|
|
42
42
|
http_request?(node) do |data|
|
43
43
|
return unless needs_conversion?(data)
|
@@ -77,9 +77,9 @@ module RuboCop
|
|
77
77
|
code_to_replace = node.loc.expression
|
78
78
|
# what to replace with
|
79
79
|
format = parentheses_format(node)
|
80
|
-
new_code = format
|
80
|
+
new_code = format % {name: node.method_name,
|
81
81
|
action: has_auth ? [user.source, controller_action].join(',') : controller_action,
|
82
|
-
params: params, session: session
|
82
|
+
params: params, session: session}
|
83
83
|
->(corrector) { corrector.replace(code_to_replace, new_code) }
|
84
84
|
end
|
85
85
|
|
@@ -115,15 +115,14 @@ module RuboCop
|
|
115
115
|
return '' if data.hash_type? && data.empty?
|
116
116
|
|
117
117
|
hash_data = if data.hash_type?
|
118
|
-
|
119
|
-
data: data.pairs.map(&:source).join(', '))
|
118
|
+
'{ %<data>s }' % {data: data.pairs.map(&:source).join(', ')}
|
120
119
|
else
|
121
120
|
# user supplies an object,
|
122
121
|
# no need to surround with braces
|
123
122
|
data.source
|
124
123
|
end
|
125
124
|
|
126
|
-
|
125
|
+
', %<type>s: %<hash_data>s' % {type: type, hash_data: hash_data}
|
127
126
|
end
|
128
127
|
|
129
128
|
def parentheses_format(node)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Netsoft
|
4
|
+
module Rubocop
|
5
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
6
|
+
# bit of our configuration.
|
7
|
+
module Inject
|
8
|
+
def self.defaults!
|
9
|
+
path = CONFIG_DEFAULT.to_s
|
10
|
+
hash = ::RuboCop::ConfigLoader.send(:load_yaml_configuration, path)
|
11
|
+
config = ::RuboCop::Config.new(hash, path)
|
12
|
+
puts "configuration from #{path}" if ::RuboCop::ConfigLoader.debug?
|
13
|
+
config = ::RuboCop::ConfigLoader.merge_with_default(config, path)
|
14
|
+
::RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsoft-rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Yarotsky
|
8
|
+
- Edward Rudd
|
8
9
|
autorequire:
|
9
|
-
bindir:
|
10
|
+
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -28,94 +29,105 @@ dependencies:
|
|
28
29
|
name: rake
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- - "
|
32
|
+
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: '12.0'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- - "
|
39
|
+
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '12.0'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: rubocop
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
|
-
- -
|
46
|
+
- - '='
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
+
version: 1.8.1
|
48
49
|
type: :runtime
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
|
-
- -
|
53
|
+
- - '='
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
+
version: 1.8.1
|
55
56
|
- !ruby/object:Gem::Dependency
|
56
57
|
name: rubocop-performance
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
|
-
- -
|
60
|
+
- - '='
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
+
version: 1.9.2
|
62
63
|
type: :runtime
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
|
-
- -
|
67
|
+
- - '='
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
+
version: 1.9.2
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
name: rubocop-rails
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
|
-
- -
|
74
|
+
- - '='
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
+
version: 2.9.1
|
76
77
|
type: :runtime
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
|
-
- -
|
81
|
+
- - '='
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
+
version: 2.9.1
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rubocop-rake
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.5.1
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.5.1
|
83
98
|
- !ruby/object:Gem::Dependency
|
84
99
|
name: rubocop-rspec
|
85
100
|
requirement: !ruby/object:Gem::Requirement
|
86
101
|
requirements:
|
87
|
-
- -
|
102
|
+
- - '='
|
88
103
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
104
|
+
version: 2.1.0
|
90
105
|
type: :runtime
|
91
106
|
prerelease: false
|
92
107
|
version_requirements: !ruby/object:Gem::Requirement
|
93
108
|
requirements:
|
94
|
-
- -
|
109
|
+
- - '='
|
95
110
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
111
|
+
version: 2.1.0
|
97
112
|
description:
|
98
113
|
email:
|
99
114
|
- alex.yarotsky@hubstaff.com
|
115
|
+
- edward@hubstaff.com
|
100
116
|
executables: []
|
101
117
|
extensions: []
|
102
|
-
extra_rdoc_files:
|
118
|
+
extra_rdoc_files:
|
119
|
+
- README.md
|
103
120
|
files:
|
104
|
-
- ".circleci/config.yml"
|
105
|
-
- ".gitignore"
|
106
|
-
- ".rubocop.yml"
|
107
121
|
- CHANGELOG.md
|
108
|
-
- Dangerfile
|
109
|
-
- Gemfile
|
110
122
|
- README.md
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
- default.yml
|
123
|
+
- TODO.md
|
124
|
+
- config/default.yml
|
125
|
+
- lib/netsoft-rubocop.rb
|
115
126
|
- lib/netsoft/rubocop.rb
|
116
|
-
- lib/netsoft/rubocop/cops/auth_http_positional_arguments.rb
|
127
|
+
- lib/netsoft/rubocop/cops/netsoft/auth_http_positional_arguments.rb
|
128
|
+
- lib/netsoft/rubocop/cops/netsoft_cops.rb
|
129
|
+
- lib/netsoft/rubocop/inject.rb
|
117
130
|
- lib/netsoft/rubocop/version.rb
|
118
|
-
- netsoft-rubocop.gemspec
|
119
131
|
homepage: https://github.com/netsoftHoldings/netsoft-rubocop
|
120
132
|
licenses: []
|
121
133
|
metadata: {}
|
@@ -127,15 +139,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
139
|
requirements:
|
128
140
|
- - ">="
|
129
141
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
142
|
+
version: '2.4'
|
131
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
144
|
requirements:
|
133
145
|
- - ">="
|
134
146
|
- !ruby/object:Gem::Version
|
135
147
|
version: '0'
|
136
148
|
requirements: []
|
137
|
-
|
138
|
-
rubygems_version: 2.7.7
|
149
|
+
rubygems_version: 3.0.3
|
139
150
|
signing_key:
|
140
151
|
specification_version: 4
|
141
152
|
summary: Hubstaff style guides and shared style configs.
|
data/.circleci/config.yml
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
defaults: &defaults
|
4
|
-
docker: &ruby_image
|
5
|
-
- &ruby_image
|
6
|
-
image: circleci/ruby:2.4.4-stretch
|
7
|
-
environment:
|
8
|
-
CIRCLE_ARTIFACTS: /tmp/circelci-artifacts
|
9
|
-
RUBYOPT: '-KU -E utf-8:utf-8'
|
10
|
-
BUNDLE_PATH: vendor/bundle
|
11
|
-
BUNDLE_VERSION: 1.15.2
|
12
|
-
BUNDLE_JOBS: 4
|
13
|
-
BUNDLE_RETRY: 3
|
14
|
-
|
15
|
-
filters:
|
16
|
-
test: &filter_test
|
17
|
-
filters:
|
18
|
-
tags:
|
19
|
-
ignore: /^v.*/
|
20
|
-
beta: &filter_beta
|
21
|
-
filters:
|
22
|
-
branches:
|
23
|
-
ignore: /.*/
|
24
|
-
tags:
|
25
|
-
only: /^v[0-9]+(\.[0-9]+)+(\.[a-z].+).*/
|
26
|
-
release: &filter_release
|
27
|
-
filters:
|
28
|
-
branches:
|
29
|
-
ignore: /.*/
|
30
|
-
tags:
|
31
|
-
only: /^v[0-9]+(\.[0-9]+)+/
|
32
|
-
|
33
|
-
workflows:
|
34
|
-
version: 2
|
35
|
-
build_test:
|
36
|
-
jobs:
|
37
|
-
- "Checkout":
|
38
|
-
<<: *filter_test
|
39
|
-
context: org-global
|
40
|
-
- "Build":
|
41
|
-
<<: *filter_test
|
42
|
-
context: org-global
|
43
|
-
requires:
|
44
|
-
- "Checkout"
|
45
|
-
build_test_beta:
|
46
|
-
jobs:
|
47
|
-
- "Checkout":
|
48
|
-
<<: *filter_beta
|
49
|
-
context: org-global
|
50
|
-
- "Build":
|
51
|
-
<<: *filter_beta
|
52
|
-
context: org-global
|
53
|
-
requires:
|
54
|
-
- "Checkout"
|
55
|
-
- "Publish":
|
56
|
-
<<: *filter_beta
|
57
|
-
context: org-global
|
58
|
-
requires:
|
59
|
-
- "Build"
|
60
|
-
build_test_release:
|
61
|
-
jobs:
|
62
|
-
- "Checkout":
|
63
|
-
<<: *filter_release
|
64
|
-
context: org-global
|
65
|
-
- "Build":
|
66
|
-
<<: *filter_release
|
67
|
-
context: org-global
|
68
|
-
requires:
|
69
|
-
- "Checkout"
|
70
|
-
- "Publish":
|
71
|
-
<<: *filter_release
|
72
|
-
context: org-global
|
73
|
-
requires:
|
74
|
-
- "Build"
|
75
|
-
|
76
|
-
jobs:
|
77
|
-
"Checkout":
|
78
|
-
<<: *defaults
|
79
|
-
steps:
|
80
|
-
- attach_workspace:
|
81
|
-
at: .
|
82
|
-
- checkout
|
83
|
-
|
84
|
-
- restore_cache:
|
85
|
-
keys:
|
86
|
-
- netsoft-rubocop-bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "netsoft-rubocop.gemspec" }}
|
87
|
-
- run:
|
88
|
-
name: Install bundler
|
89
|
-
command: gem install bundler --version=$BUNDLE_VERSION
|
90
|
-
- run:
|
91
|
-
name: Bundle Install
|
92
|
-
command: |-
|
93
|
-
bundle _${BUNDLE_VERSION}_ check || bundle _${BUNDLE_VERSION}_ install --retry=$BUNDLE_RETRY
|
94
|
-
- save_cache:
|
95
|
-
key: netsoft-rubocop--bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "netsoft-rubocop.gemspec" }}
|
96
|
-
paths:
|
97
|
-
- vendor/bundle
|
98
|
-
- Gemfile.lock
|
99
|
-
|
100
|
-
- persist_to_workspace:
|
101
|
-
root: .
|
102
|
-
paths: .
|
103
|
-
"Build":
|
104
|
-
<<: *defaults
|
105
|
-
steps:
|
106
|
-
- attach_workspace:
|
107
|
-
at: .
|
108
|
-
- run:
|
109
|
-
name: Install bundler
|
110
|
-
command: gem install bundler --version=$BUNDLE_VERSION
|
111
|
-
- run:
|
112
|
-
name: Build gem
|
113
|
-
command: |-
|
114
|
-
gem build *.gemspec
|
115
|
-
- run:
|
116
|
-
name: "Install netsoft-danger"
|
117
|
-
command: |-
|
118
|
-
gem install netsoft-danger
|
119
|
-
- run:
|
120
|
-
name: Run rubocop
|
121
|
-
command: |-
|
122
|
-
netsoft-circle rubocop
|
123
|
-
- run:
|
124
|
-
name: Run Danger
|
125
|
-
command: |-
|
126
|
-
danger
|
127
|
-
- store_artifacts:
|
128
|
-
path: /tmp/circelci-artifacts
|
129
|
-
"Publish":
|
130
|
-
<<: *defaults
|
131
|
-
steps:
|
132
|
-
- attach_workspace:
|
133
|
-
at: .
|
134
|
-
- run:
|
135
|
-
name: Deploy to gem server
|
136
|
-
command: |-
|
137
|
-
./bin/tag_check.sh
|
138
|
-
./bin/setup-rubygems.sh
|
139
|
-
rm -rf pkg
|
140
|
-
rake build
|
141
|
-
gem push pkg/*.gem
|
data/.gitignore
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/spec/examples.txt
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
|
-
/tmp/
|
12
|
-
|
13
|
-
# Used by dotenv library to load environment variables.
|
14
|
-
# .env
|
15
|
-
|
16
|
-
# Ignore Byebug command history file.
|
17
|
-
.byebug_history
|
18
|
-
|
19
|
-
## Specific to RubyMotion:
|
20
|
-
.dat*
|
21
|
-
.repl_history
|
22
|
-
build/
|
23
|
-
*.bridgesupport
|
24
|
-
build-iPhoneOS/
|
25
|
-
build-iPhoneSimulator/
|
26
|
-
|
27
|
-
## Specific to RubyMotion (use of CocoaPods):
|
28
|
-
#
|
29
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
-
#
|
33
|
-
# vendor/Pods/
|
34
|
-
|
35
|
-
## Documentation cache and generated files:
|
36
|
-
/.yardoc/
|
37
|
-
/_yardoc/
|
38
|
-
/doc/
|
39
|
-
/rdoc/
|
40
|
-
|
41
|
-
## Environment normalization:
|
42
|
-
/.bundle/
|
43
|
-
/vendor/bundle
|
44
|
-
/lib/bundler/man/
|
45
|
-
|
46
|
-
# for a library or gem, you might want to ignore these files since the code is
|
47
|
-
# intended to run in multiple environments; otherwise, check them in:
|
48
|
-
# Gemfile.lock
|
49
|
-
# .ruby-version
|
50
|
-
# .ruby-gemset
|
51
|
-
|
52
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
-
.rvmrc
|
54
|
-
|
55
|
-
Gemfile.lock
|
56
|
-
.ruby-*
|
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
inherit_from: default.yml
|
data/Dangerfile
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/setup-rubygems.sh
DELETED
data/bin/tag_check.sh
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
tag=`git describe --tags --exact-match HEAD 2> /dev/null`
|
4
|
-
|
5
|
-
if [ $? -eq 0 ]; then
|
6
|
-
version=`grep VERSION lib/netsoft/rubocop/version.rb | sed -e "s/.*'\([^']*\)'.*/\1/"`
|
7
|
-
|
8
|
-
if [ "v$version" = "$tag" ]; then
|
9
|
-
echo "Revision $tag Matches $version"
|
10
|
-
else
|
11
|
-
echo "Revision $tag does not match $version"
|
12
|
-
exit 2
|
13
|
-
fi
|
14
|
-
else
|
15
|
-
echo "No tag found"
|
16
|
-
exit 1
|
17
|
-
fi
|
data/default.yml
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- ./lib/netsoft/rubocop/cops/auth_http_positional_arguments
|
3
|
-
- rubocop-rails
|
4
|
-
- rubocop-performance
|
5
|
-
- rubocop-rspec
|
6
|
-
|
7
|
-
AllCops:
|
8
|
-
TargetRubyVersion: 2.5
|
9
|
-
TargetRailsVersion: 5.2
|
10
|
-
DisplayStyleGuide: true
|
11
|
-
StyleGuideBaseURL: https://rubystyle.guide
|
12
|
-
Exclude:
|
13
|
-
- 'db/**/*'
|
14
|
-
- 'coverage/**/*'
|
15
|
-
- 'log/**/*'
|
16
|
-
- 'public/**/*'
|
17
|
-
- 'tmp/**/*'
|
18
|
-
- 'spec/dummy/**/*'
|
19
|
-
- 'vendor/**/*'
|
20
|
-
- 'gemfiles/**/*'
|
21
|
-
- 'node_modules/**/*'
|
22
|
-
|
23
|
-
Naming/RescuedExceptionsVariableName:
|
24
|
-
PreferredName: ex
|
25
|
-
|
26
|
-
Naming/UncommunicativeMethodParamName:
|
27
|
-
AllowedNames:
|
28
|
-
- me
|
29
|
-
- ex
|
30
|
-
|
31
|
-
Layout/AlignHash:
|
32
|
-
EnforcedHashRocketStyle: table
|
33
|
-
EnforcedColonStyle: table
|
34
|
-
|
35
|
-
Layout/ExtraSpacing:
|
36
|
-
AllowForAlignment: true
|
37
|
-
|
38
|
-
Layout/IndentAssignment:
|
39
|
-
IndentationWidth: 4
|
40
|
-
|
41
|
-
Layout/IndentFirstArrayElement:
|
42
|
-
EnforcedStyle: consistent
|
43
|
-
IndentationWidth: 4
|
44
|
-
|
45
|
-
Layout/IndentFirstHashElement:
|
46
|
-
EnforcedStyle: consistent
|
47
|
-
IndentationWidth: 4
|
48
|
-
|
49
|
-
Layout/MultilineMethodCallIndentation:
|
50
|
-
EnforcedStyle: indented_relative_to_receiver
|
51
|
-
IndentationWidth: 4
|
52
|
-
|
53
|
-
Layout/SpaceInsideBlockBraces:
|
54
|
-
EnforcedStyle: space
|
55
|
-
SpaceBeforeBlockParameters: true
|
56
|
-
|
57
|
-
Layout/SpaceInsideHashLiteralBraces:
|
58
|
-
EnforcedStyle: no_space
|
59
|
-
|
60
|
-
Lint/AmbiguousBlockAssociation:
|
61
|
-
Exclude:
|
62
|
-
- spec/**/*
|
63
|
-
|
64
|
-
Rails:
|
65
|
-
Enabled: true
|
66
|
-
|
67
|
-
Rails/HttpPositionalArguments:
|
68
|
-
Enabled: false
|
69
|
-
|
70
|
-
Rails/SkipsModelValidations:
|
71
|
-
Whitelist:
|
72
|
-
- touch
|
73
|
-
- update_attribute
|
74
|
-
- update_counters
|
75
|
-
- increment_counter
|
76
|
-
- decrement_counter
|
77
|
-
|
78
|
-
Netsoft/AuthHttpPositionalArguments:
|
79
|
-
Enabled: true
|
80
|
-
Include:
|
81
|
-
- 'spec/controllers/**/*'
|
82
|
-
|
83
|
-
RSpec/ExpectChange:
|
84
|
-
EnforcedStyle: block
|
85
|
-
|
86
|
-
RSpec/ImplicitSubject:
|
87
|
-
Enabled: false
|
88
|
-
|
89
|
-
RSpec/MessageSpies:
|
90
|
-
Enabled: false
|
91
|
-
|
92
|
-
RSpec/NamedSubject:
|
93
|
-
Enabled: false
|
94
|
-
|
95
|
-
RSpec/NestedGroups:
|
96
|
-
Enabled: false
|
97
|
-
|
98
|
-
RSpec/NotToNot:
|
99
|
-
EnforcedStyle: to_not
|
100
|
-
|
101
|
-
Style/AndOr:
|
102
|
-
EnforcedStyle: conditionals
|
103
|
-
|
104
|
-
Style/BlockDelimiters:
|
105
|
-
EnforcedStyle: semantic
|
106
|
-
AllowBracesOnProceduralOneLiners: true
|
107
|
-
|
108
|
-
Style/MultilineBlockChain:
|
109
|
-
Enabled: false
|
110
|
-
|
111
|
-
Style/RescueModifier:
|
112
|
-
Enabled: false
|
113
|
-
|
114
|
-
Style/TrailingCommaInArrayLiteral:
|
115
|
-
EnforcedStyleForMultiline: comma
|
116
|
-
|
117
|
-
Style/TrailingCommaInHashLiteral:
|
118
|
-
EnforcedStyleForMultiline: comma
|
119
|
-
|
120
|
-
Metrics:
|
121
|
-
Enabled: false
|
122
|
-
|
123
|
-
Style/DoubleNegation:
|
124
|
-
Enabled: false
|
data/netsoft-rubocop.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'netsoft/rubocop/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'netsoft-rubocop'
|
9
|
-
spec.version = Netsoft::Rubocop::VERSION
|
10
|
-
spec.authors = ['Alex Yarotsky']
|
11
|
-
spec.email = ['alex.yarotsky@hubstaff.com']
|
12
|
-
|
13
|
-
spec.summary = 'Hubstaff style guides and shared style configs.'
|
14
|
-
spec.homepage = 'https://github.com/netsoftHoldings/netsoft-rubocop'
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
spec.bindir = 'exe'
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = %w[lib]
|
24
|
-
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.15'
|
26
|
-
spec.add_development_dependency 'rake', '~> 12.0'
|
27
|
-
|
28
|
-
spec.add_runtime_dependency 'rubocop', '~> 0.74.0'
|
29
|
-
spec.add_runtime_dependency 'rubocop-performance', '~> 1.4'
|
30
|
-
spec.add_runtime_dependency 'rubocop-rails', '~> 2.2'
|
31
|
-
spec.add_runtime_dependency 'rubocop-rspec', '~> 1.35'
|
32
|
-
end
|