ndr_dev_support 5.4.8 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -138
- data/CHANGELOG.md +3 -0
- data/README.md +11 -5
- data/code_safety.yml +14 -6
- data/config/rubocop/ndr.yml +138 -0
- data/lib/ndr_dev_support.rb +4 -1
- data/lib/ndr_dev_support/rubocop/inject.rb +26 -0
- data/lib/ndr_dev_support/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 266a4e4e0fe8d5aaf551ce205b4d699aec39922d634c34a922cdf825b2e38f0d
|
4
|
+
data.tar.gz: 1f07112de5ce4ecb8e18aa1b9a2013bd71d6b99e4442aeb27b8a239928242d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d458bf7e248657f21ae473e6809288f91fd0b71dfa660b8706a199c3f4e74f06a02f850d5a3b3008ec5c7ae03545a3720a3a0917ca84f6c69793c629fe1a65bb
|
7
|
+
data.tar.gz: b6d391962ebe0e2c5522c4e60186f8a3c0dce42df2e11c8534db28f8e6838d1390c0910adf67007ffc419dfbbe8ee2f346e02d8c77b49366b950661d571659bb
|
data/.rubocop.yml
CHANGED
@@ -1,138 +1 @@
|
|
1
|
-
|
2
|
-
# Style Guide, the configuration for which can be found here:
|
3
|
-
# https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
4
|
-
#
|
5
|
-
# See the README for instructions on using in a project.
|
6
|
-
|
7
|
-
require:
|
8
|
-
- rubocop-rails
|
9
|
-
|
10
|
-
AllCops:
|
11
|
-
# All cops should ignore files in the following locations:
|
12
|
-
Exclude:
|
13
|
-
- 'bin/*'
|
14
|
-
- 'db/schema.rb'
|
15
|
-
- 'lib/generators/**/templates/*'
|
16
|
-
- 'tmp/**/*'
|
17
|
-
- 'vendor/**/*'
|
18
|
-
|
19
|
-
# Once supported by RuboCop, this will prevent cop-specific Excludes from
|
20
|
-
# overwriting the AllCops defaults above:
|
21
|
-
#
|
22
|
-
# inherit_mode:
|
23
|
-
# merge:
|
24
|
-
# - Exclude
|
25
|
-
|
26
|
-
# Run the Rails cops by default (-R/--rails not required):
|
27
|
-
Rails:
|
28
|
-
Enabled: true
|
29
|
-
|
30
|
-
##################### Layout #################################
|
31
|
-
|
32
|
-
Layout/DotPosition:
|
33
|
-
# Multi-line method chaining should be done with trailing dots.
|
34
|
-
EnforcedStyle: trailing
|
35
|
-
|
36
|
-
Layout/HashAlignment:
|
37
|
-
EnforcedColonStyle:
|
38
|
-
- key
|
39
|
-
- table
|
40
|
-
EnforcedHashRocketStyle:
|
41
|
-
- key
|
42
|
-
- table
|
43
|
-
|
44
|
-
##################### Style ##################################
|
45
|
-
|
46
|
-
# We make use of block comments, e.g. for validation documentation.
|
47
|
-
Style/BlockComments:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
Style/Documentation:
|
51
|
-
Exclude:
|
52
|
-
- 'test/**/*.rb'
|
53
|
-
|
54
|
-
Style/FrozenStringLiteralComment:
|
55
|
-
# We're not confident enough to make this recommendation everywhere
|
56
|
-
Enabled: false
|
57
|
-
|
58
|
-
Style/ModuleFunction:
|
59
|
-
# `extend self` has fewer side effects than `module_function`.
|
60
|
-
EnforcedStyle: extend_self
|
61
|
-
|
62
|
-
Style/NumericLiterals:
|
63
|
-
Exclude:
|
64
|
-
- 'db/migrate/*.rb'
|
65
|
-
- 'test/**/*.rb'
|
66
|
-
|
67
|
-
Style/YodaCondition:
|
68
|
-
# Disagree; literals as first argument can guard against accidental assignment.
|
69
|
-
Enabled: false
|
70
|
-
|
71
|
-
Style/SingleLineBlockParams:
|
72
|
-
# Prefer readability of contextually-named variables.
|
73
|
-
Enabled: false
|
74
|
-
|
75
|
-
##################### Metrics ##################################
|
76
|
-
# NOTE: we bump some metrics by 50%, in recognition of Rubocop's
|
77
|
-
# desire to split that which we would consider atomic.
|
78
|
-
|
79
|
-
Metrics/AbcSize:
|
80
|
-
Max: 23
|
81
|
-
Exclude:
|
82
|
-
- 'db/migrate/*.rb'
|
83
|
-
- 'test/**/*.rb'
|
84
|
-
|
85
|
-
Metrics/BlockLength:
|
86
|
-
# We're already limiting method size, blocks outside of methods
|
87
|
-
# can legitimately be long (RuboCop defaults to max: 25 lines).
|
88
|
-
Enabled: false
|
89
|
-
|
90
|
-
Metrics/ClassLength:
|
91
|
-
Max: 150
|
92
|
-
Exclude:
|
93
|
-
- 'db/migrate/*.rb'
|
94
|
-
- 'test/**/*.rb'
|
95
|
-
|
96
|
-
Metrics/ModuleLength:
|
97
|
-
Max: 150
|
98
|
-
Exclude:
|
99
|
-
- 'test/**/*.rb'
|
100
|
-
|
101
|
-
Metrics/CyclomaticComplexity:
|
102
|
-
Max: 9
|
103
|
-
|
104
|
-
Layout/LineLength:
|
105
|
-
Max: 100
|
106
|
-
Exclude:
|
107
|
-
- 'db/migrate/*.rb'
|
108
|
-
- 'test/**/*.rb'
|
109
|
-
|
110
|
-
Metrics/MethodLength:
|
111
|
-
Max: 15
|
112
|
-
Exclude:
|
113
|
-
- 'db/migrate/*.rb'
|
114
|
-
- 'test/**/*.rb'
|
115
|
-
|
116
|
-
Metrics/PerceivedComplexity:
|
117
|
-
Max: 12
|
118
|
-
|
119
|
-
##################### Rails ##################################
|
120
|
-
|
121
|
-
Rails/ActionFilter:
|
122
|
-
# 'action' is the default already; we explicitly list here as Rails 3.x
|
123
|
-
# projects will want to override this configuration to use 'filter' instead.
|
124
|
-
EnforcedStyle: action
|
125
|
-
|
126
|
-
Rails/DynamicFindBy:
|
127
|
-
Exclude:
|
128
|
-
- 'test/integration/**/*.rb'
|
129
|
-
|
130
|
-
Rails/RefuteMethods:
|
131
|
-
Enabled: false
|
132
|
-
|
133
|
-
Rails/SkipsModelValidations:
|
134
|
-
# Methods like 'update_column' exist for a reason, and it is the developer's
|
135
|
-
# responsibilty to understand the behaviour of the code they write; blanket
|
136
|
-
# avoiding them is not helpful/practical.
|
137
|
-
Enabled: false
|
138
|
-
|
1
|
+
require: ndr_dev_support
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -49,16 +49,22 @@ For more details of the audit tasks available, execute:
|
|
49
49
|
|
50
50
|
### RuboCop configuration
|
51
51
|
|
52
|
-
ndr_dev_support includes tweaks to the default Ruby Style
|
53
|
-
To use
|
52
|
+
`ndr_dev_support` includes tweaks to the default Ruby and Ruby on Rails Style Guides, to better suit NDR.
|
53
|
+
To use these updated style guides from within a project, add the following to top of the project's `.rubocop.yml` file:
|
54
54
|
|
55
55
|
```yaml
|
56
|
-
|
56
|
+
require: ndr_dev_support
|
57
57
|
```
|
58
58
|
|
59
|
-
|
59
|
+
Or, if using other extensions too:
|
60
60
|
|
61
|
-
|
61
|
+
```yaml
|
62
|
+
require:
|
63
|
+
- ndr_dev_support
|
64
|
+
- some_other_extension
|
65
|
+
```
|
66
|
+
|
67
|
+
In order for these configurations to apply, you will need to invoke RuboCop using Bundler:
|
62
68
|
|
63
69
|
```
|
64
70
|
$ bundle exec rubocop .
|
data/code_safety.yml
CHANGED
@@ -11,7 +11,7 @@ file safety:
|
|
11
11
|
".rubocop.yml":
|
12
12
|
comments:
|
13
13
|
reviewed_by: josh.pencheon
|
14
|
-
safe_revision:
|
14
|
+
safe_revision: 6211cff0ce44645ed3752723b5b0ee65f24c66aa
|
15
15
|
".travis.yml":
|
16
16
|
comments:
|
17
17
|
reviewed_by: josh.pencheon
|
@@ -19,7 +19,7 @@ file safety:
|
|
19
19
|
CHANGELOG.md:
|
20
20
|
comments:
|
21
21
|
reviewed_by: josh.pencheon
|
22
|
-
safe_revision:
|
22
|
+
safe_revision: aa0d11190daa8842da406b933d61c4043823ef9a
|
23
23
|
CODE_OF_CONDUCT.md:
|
24
24
|
comments:
|
25
25
|
reviewed_by: timgentry
|
@@ -35,7 +35,7 @@ file safety:
|
|
35
35
|
README.md:
|
36
36
|
comments:
|
37
37
|
reviewed_by: josh.pencheon
|
38
|
-
safe_revision:
|
38
|
+
safe_revision: 2cf2b6e3ce2f054289699527c13cd7d795347ce3
|
39
39
|
Rakefile:
|
40
40
|
comments:
|
41
41
|
reviewed_by: josh.pencheon
|
@@ -48,6 +48,10 @@ file safety:
|
|
48
48
|
comments:
|
49
49
|
reviewed_by: timgentry
|
50
50
|
safe_revision: c59a45986f8b6d087c8c21b1e889f31f7346da17
|
51
|
+
config/rubocop/ndr.yml:
|
52
|
+
comments:
|
53
|
+
reviewed_by: josh.pencheon
|
54
|
+
safe_revision: 6211cff0ce44645ed3752723b5b0ee65f24c66aa
|
51
55
|
gemfiles/Gemfile.rails52:
|
52
56
|
comments:
|
53
57
|
reviewed_by: josh.pencheon
|
@@ -66,8 +70,8 @@ file safety:
|
|
66
70
|
safe_revision: 26efe45f35f211e7cb7a04967c51c0b6d116321e
|
67
71
|
lib/ndr_dev_support.rb:
|
68
72
|
comments:
|
69
|
-
reviewed_by:
|
70
|
-
safe_revision:
|
73
|
+
reviewed_by: josh.pencheon
|
74
|
+
safe_revision: 6211cff0ce44645ed3752723b5b0ee65f24c66aa
|
71
75
|
lib/ndr_dev_support/capistrano/assets.rb:
|
72
76
|
comments:
|
73
77
|
reviewed_by: josh.pencheon
|
@@ -180,6 +184,10 @@ file safety:
|
|
180
184
|
comments:
|
181
185
|
reviewed_by: josh.pencheon
|
182
186
|
safe_revision: e56876f46536ba006a9b68029306f41a188bf9c6
|
187
|
+
lib/ndr_dev_support/rubocop/inject.rb:
|
188
|
+
comments:
|
189
|
+
reviewed_by: josh.pencheon
|
190
|
+
safe_revision: 6211cff0ce44645ed3752723b5b0ee65f24c66aa
|
183
191
|
lib/ndr_dev_support/rubocop/range_augmenter.rb:
|
184
192
|
comments:
|
185
193
|
reviewed_by: joshpencheon
|
@@ -203,7 +211,7 @@ file safety:
|
|
203
211
|
lib/ndr_dev_support/version.rb:
|
204
212
|
comments:
|
205
213
|
reviewed_by: josh.pencheon
|
206
|
-
safe_revision:
|
214
|
+
safe_revision: aa0d11190daa8842da406b933d61c4043823ef9a
|
207
215
|
lib/tasks/audit_code.rake:
|
208
216
|
comments: Identical to the version reviewed by josh.pencheon when contained within
|
209
217
|
ndr_support
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# This file contains NDR's agreed deviations from the standard Ruby
|
2
|
+
# Style Guide, the configuration for which can be found here:
|
3
|
+
# https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
4
|
+
#
|
5
|
+
# See the README for instructions on using in a project.
|
6
|
+
|
7
|
+
require:
|
8
|
+
- rubocop-rails
|
9
|
+
|
10
|
+
AllCops:
|
11
|
+
# All cops should ignore files in the following locations:
|
12
|
+
Exclude:
|
13
|
+
- 'bin/*'
|
14
|
+
- 'db/schema.rb'
|
15
|
+
- 'lib/generators/**/templates/*'
|
16
|
+
- 'tmp/**/*'
|
17
|
+
- 'vendor/**/*'
|
18
|
+
|
19
|
+
# Once supported by RuboCop, this will prevent cop-specific Excludes from
|
20
|
+
# overwriting the AllCops defaults above:
|
21
|
+
#
|
22
|
+
# inherit_mode:
|
23
|
+
# merge:
|
24
|
+
# - Exclude
|
25
|
+
|
26
|
+
# Run the Rails cops by default (-R/--rails not required):
|
27
|
+
Rails:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
##################### Layout #################################
|
31
|
+
|
32
|
+
Layout/DotPosition:
|
33
|
+
# Multi-line method chaining should be done with trailing dots.
|
34
|
+
EnforcedStyle: trailing
|
35
|
+
|
36
|
+
Layout/HashAlignment:
|
37
|
+
EnforcedColonStyle:
|
38
|
+
- key
|
39
|
+
- table
|
40
|
+
EnforcedHashRocketStyle:
|
41
|
+
- key
|
42
|
+
- table
|
43
|
+
|
44
|
+
##################### Style ##################################
|
45
|
+
|
46
|
+
# We make use of block comments, e.g. for validation documentation.
|
47
|
+
Style/BlockComments:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/Documentation:
|
51
|
+
Exclude:
|
52
|
+
- 'test/**/*.rb'
|
53
|
+
|
54
|
+
Style/FrozenStringLiteralComment:
|
55
|
+
# We're not confident enough to make this recommendation everywhere
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Style/ModuleFunction:
|
59
|
+
# `extend self` has fewer side effects than `module_function`.
|
60
|
+
EnforcedStyle: extend_self
|
61
|
+
|
62
|
+
Style/NumericLiterals:
|
63
|
+
Exclude:
|
64
|
+
- 'db/migrate/*.rb'
|
65
|
+
- 'test/**/*.rb'
|
66
|
+
|
67
|
+
Style/YodaCondition:
|
68
|
+
# Disagree; literals as first argument can guard against accidental assignment.
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Style/SingleLineBlockParams:
|
72
|
+
# Prefer readability of contextually-named variables.
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
##################### Metrics ##################################
|
76
|
+
# NOTE: we bump some metrics by 50%, in recognition of Rubocop's
|
77
|
+
# desire to split that which we would consider atomic.
|
78
|
+
|
79
|
+
Metrics/AbcSize:
|
80
|
+
Max: 23
|
81
|
+
Exclude:
|
82
|
+
- 'db/migrate/*.rb'
|
83
|
+
- 'test/**/*.rb'
|
84
|
+
|
85
|
+
Metrics/BlockLength:
|
86
|
+
# We're already limiting method size, blocks outside of methods
|
87
|
+
# can legitimately be long (RuboCop defaults to max: 25 lines).
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
Metrics/ClassLength:
|
91
|
+
Max: 150
|
92
|
+
Exclude:
|
93
|
+
- 'db/migrate/*.rb'
|
94
|
+
- 'test/**/*.rb'
|
95
|
+
|
96
|
+
Metrics/ModuleLength:
|
97
|
+
Max: 150
|
98
|
+
Exclude:
|
99
|
+
- 'test/**/*.rb'
|
100
|
+
|
101
|
+
Metrics/CyclomaticComplexity:
|
102
|
+
Max: 9
|
103
|
+
|
104
|
+
Layout/LineLength:
|
105
|
+
Max: 100
|
106
|
+
Exclude:
|
107
|
+
- 'db/migrate/*.rb'
|
108
|
+
- 'test/**/*.rb'
|
109
|
+
|
110
|
+
Metrics/MethodLength:
|
111
|
+
Max: 15
|
112
|
+
Exclude:
|
113
|
+
- 'db/migrate/*.rb'
|
114
|
+
- 'test/**/*.rb'
|
115
|
+
|
116
|
+
Metrics/PerceivedComplexity:
|
117
|
+
Max: 12
|
118
|
+
|
119
|
+
##################### Rails ##################################
|
120
|
+
|
121
|
+
Rails/ActionFilter:
|
122
|
+
# 'action' is the default already; we explicitly list here as Rails 3.x
|
123
|
+
# projects will want to override this configuration to use 'filter' instead.
|
124
|
+
EnforcedStyle: action
|
125
|
+
|
126
|
+
Rails/DynamicFindBy:
|
127
|
+
Exclude:
|
128
|
+
- 'test/integration/**/*.rb'
|
129
|
+
|
130
|
+
Rails/RefuteMethods:
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
Rails/SkipsModelValidations:
|
134
|
+
# Methods like 'update_column' exist for a reason, and it is the developer's
|
135
|
+
# responsibilty to understand the behaviour of the code they write; blanket
|
136
|
+
# avoiding them is not helpful/practical.
|
137
|
+
Enabled: false
|
138
|
+
|
data/lib/ndr_dev_support.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
require 'ndr_dev_support/rubocop/inject'
|
1
2
|
require 'ndr_dev_support/version'
|
2
3
|
|
3
4
|
module NdrDevSupport
|
4
|
-
#
|
5
|
+
# Bootstrap our RuboCop config in to any project
|
6
|
+
# when ndr_dev_support is required in .rubocop.yml.
|
7
|
+
Rubocop::Inject.defaults!
|
5
8
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubocop'
|
2
|
+
|
3
|
+
module NdrDevSupport
|
4
|
+
module Rubocop
|
5
|
+
# Following approach of rubocop-hq/rubocop-extension-generator,
|
6
|
+
# monkey-patch in default configuration.
|
7
|
+
module Inject
|
8
|
+
def self.defaults!
|
9
|
+
root = Pathname.new(__dir__).parent.parent.parent.expand_path
|
10
|
+
path = root.join('config', 'rubocop', 'ndr.yml').to_s
|
11
|
+
|
12
|
+
# Whereas by default, the raw YAML would be processed, we pass
|
13
|
+
# through the ConfigLoader fully - this ensures `require` and
|
14
|
+
# `inherit_from` statements are properly evaluated.
|
15
|
+
#
|
16
|
+
# PR at rubocop-hq/rubocop-extension-generator/pull/9
|
17
|
+
#
|
18
|
+
config = ::RuboCop::ConfigLoader.load_file(path)
|
19
|
+
puts "configuration from \#{path}" if ::RuboCop::ConfigLoader.debug?
|
20
|
+
|
21
|
+
config = ::RuboCop::ConfigLoader.merge_with_default(config, path)
|
22
|
+
::RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_dev_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NCRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -392,6 +392,7 @@ files:
|
|
392
392
|
- bin/console
|
393
393
|
- bin/setup
|
394
394
|
- code_safety.yml
|
395
|
+
- config/rubocop/ndr.yml
|
395
396
|
- gemfiles/Gemfile.rails52
|
396
397
|
- gemfiles/Gemfile.rails60
|
397
398
|
- lib/minitest/rake_ci.rb
|
@@ -425,6 +426,7 @@ files:
|
|
425
426
|
- lib/ndr_dev_support/rake_ci/redmine/ticket_resolver.rb
|
426
427
|
- lib/ndr_dev_support/rake_ci/simple_cov_helper.rb
|
427
428
|
- lib/ndr_dev_support/rubocop/executor.rb
|
429
|
+
- lib/ndr_dev_support/rubocop/inject.rb
|
428
430
|
- lib/ndr_dev_support/rubocop/range_augmenter.rb
|
429
431
|
- lib/ndr_dev_support/rubocop/range_finder.rb
|
430
432
|
- lib/ndr_dev_support/rubocop/reporter.rb
|