boxt_ruby_style_guide 7.1.1 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea3b837cced7b872a11cc729ab8b79bf7806ca316adc95b06efe54260d2d4aef
4
- data.tar.gz: 8259d623667fbfd2ba5e59d605a2139c4c8239609eebf68c2099d537f07a9a43
3
+ metadata.gz: 6c98e2c24a98ee1a1b71ff68d8ac9e1a71fc828e7dd426fdca7cdb7d1d46bd95
4
+ data.tar.gz: d391b2f458db7d6c95e85674ccbacbd44c1b75e4b2cae553d42885e44797e1d2
5
5
  SHA512:
6
- metadata.gz: 55600a471c86b4916e7018c1505fbb703270a29d51ab4eb317d5ee5ec55b742cf8dfd753cc5179de1803f296f7cf379cf9cad5c81c9b33d98b4eb7c19fa7406e
7
- data.tar.gz: 3fa4333832514b686890ac139bd22e6a182cee23ac4b0e3dbf35a07f78a930f8279e732b79b63b21b100e75fe7072c85b71ef1a5ebf094a8ed4244315b9c31a7
6
+ metadata.gz: c682a374a5084e2abc80665481fcd9df82f99b301064916153d5d6dd8ed587d226f83698627ab804a98e449fffe0d78fa16e8e7ccfcd0f8c60a13add8196b545
7
+ data.tar.gz: '09e6a7393ba970d72171d6e85660a4482594f54de05d9f63ae4248aca894992110073f20bfb9fe9b9feab3c8d2d31399e687fa935b57a6a073e1c4807da9d31a'
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "bundler/gem_tasks"
4
4
  require "rake/testtask"
5
5
  require "rspec/core/rake_task"
6
6
 
7
- import "./tasks/lint.rake"
7
+ import "lib/tasks/lint.rake"
8
8
 
9
9
  RSpec::Core::RakeTask.new(:spec) do |t|
10
10
  t.pattern = Dir.glob("spec/**/*_spec.rb")
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.1.1
1
+ 7.5.0
@@ -1,33 +1,39 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7.1
3
2
  Exclude:
4
3
  - "**/*/schema.rb"
5
- - "Gemfile.lock"
6
- - "node_modules/**/*"
7
- - "tmp/**/*"
8
- - "vendor/**/*"
4
+ - Gemfile.lock
5
+ - node_modules/**/*
6
+ - tmp/**/*
7
+ - vendor/**/*
8
+ TargetRubyVersion: 2.7.1
9
9
  Layout/LineLength:
10
- Max: 120 # Increase line length to 120
11
10
  Exclude:
12
- - "config/routes.rb"
11
+ - config/routes.rb
12
+ Max: 120
13
+ Metrics/AbcSize:
14
+ Exclude:
15
+ - db/migrate/**/*
13
16
  Metrics/BlockLength:
14
17
  Exclude:
15
18
  - "*.gemspec"
16
- - "Gemfile"
17
- - "config/routes.rb"
18
- - "spec/**/*"
19
- - "test/**/*"
19
+ - Gemfile
20
+ - config/routes.rb
21
+ - db/migrate/**/*
22
+ - spec/**/*
23
+ - test/**/*
20
24
  Metrics/ClassLength:
21
25
  Exclude:
22
- - "spec/**/*"
23
- - "test/**/*"
26
+ - db/migrate/**/*
27
+ - spec/**/*
28
+ - test/**/*
24
29
  Metrics/MethodLength:
25
30
  Exclude:
26
- - "spec/**/*"
27
- - "test/**/*"
31
+ - db/migrate/**/*
32
+ - spec/**/*
33
+ - test/**/*
34
+ Style/Documentation:
35
+ Enabled: false
28
36
  Style/DoubleNegation:
29
37
  Enabled: false
30
- Style/Documentation:
31
- Enabled: false # Disable Style/Documentation because...
32
38
  Style/StringLiterals:
33
- EnforcedStyle: double_quotes # Use double quotes ALL THE TIME!!!
39
+ EnforcedStyle: double_quotes
@@ -4,17 +4,13 @@ require "boxt_ruby_style_guide/railtie" if defined?(Rails)
4
4
  require "boxt_ruby_style_guide/version"
5
5
 
6
6
  module BoxtRubyStyleGuide
7
- class << self
8
- def install_tasks
9
- Dir[File.join(gem_spec.gem_dir, "tasks/*.rake")].each do |file|
10
- load(file)
11
- end
12
- end
7
+ module_function
13
8
 
14
- private
15
-
16
- def gem_spec
17
- Gem::Specification.find_by_name("boxt_ruby_style_guide")
18
- end
9
+ ##
10
+ # Provide a root path helper for the gem root dir
11
+ #
12
+ # Returns Pathname
13
+ def root
14
+ Pathname.new(File.dirname(__dir__))
19
15
  end
20
16
  end
@@ -5,7 +5,7 @@ require "rails"
5
5
  module BoxtRubyStyleGuide
6
6
  class Railtie < Rails::Railtie
7
7
  rake_tasks do
8
- files = File.join(File.dirname(__FILE__), "../../tasks/*.rake")
8
+ files = BoxtRubyStyleGuide.root.join("lib", "tasks", "*.rake")
9
9
  Dir[files].each { |file| load(file) }
10
10
  end
11
11
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "boxt_ruby_style_guide"
4
+ require "rubocop"
5
+
6
+ ##
7
+ # The base branch to compare HEAD with for changes
8
+ BASE_BRANCH = "develop"
9
+
10
+ ##
11
+ # Directories containing Ruby files to lint
12
+ RUBY_DIRS = %w[app lib test spec].freeze
13
+
14
+ ##
15
+ # Grep file pattern to make sure we only check files that are Ruby files
16
+ # This pattern matches the following:
17
+ #
18
+ # - Gemfile
19
+ # - Rakefile
20
+ # - *.gemspec
21
+ # - app/**/*.{rb,rake}
22
+ # - lib/**/*.{rb,rake}
23
+ # - test/**/*.{rb,rake}
24
+ # - spec/**/*.{rb,rake}
25
+ #
26
+ GREP_PATTERN = <<~STRING.delete("\n")
27
+ (
28
+ (#{RUBY_DIRS.join('|')})\\/.+\\.(rb|rake)
29
+ |^
30
+ (Gemfile|Rakefile|.+\\.gemspec)
31
+ )
32
+ STRING
33
+
34
+ namespace :lint do
35
+ desc "Runs rubocop against all files with committed changes different from base branch"
36
+ task :rubocop do
37
+ exec("rubocop #{diff_file_paths};")
38
+ end
39
+
40
+ private
41
+
42
+ # A list of the local file paths of Ruby files with committed changes.
43
+ #
44
+ # Run a git diff-tree command with the following otions:
45
+ # -r recursive
46
+ # --name-only Only return the name of the files
47
+ # --diff-filter Filter out results that have been deleted on HEAD
48
+ #
49
+ # Pipe the output from this command through grep to match only Ruby files in the
50
+ # desired directories
51
+ #
52
+ # Returns String
53
+ def diff_file_paths
54
+ base_branch = ENV.fetch("RUBOCOP_LINT_BASE", BASE_BRANCH)
55
+ command = <<~BASH
56
+ git diff --name-only #{base_branch} HEAD | egrep '#{GREP_PATTERN}'
57
+ BASH
58
+ file_paths = `#{command}`
59
+ file_paths.gsub(/\n|\r/, " ")
60
+ end
61
+ end
@@ -1,92 +1,103 @@
1
1
  # These cops are currently pending and will be enabled by default at some point, but adding for now to stop Rubocop
2
2
  # or VSCode complaining...
3
- Layout/EmptyLinesAroundAttributeAccessor:
4
- Enabled: true
5
- Layout/SpaceAroundMethodCallOperator:
6
- Enabled: true
7
- Lint/BinaryOperatorWithIdenticalOperands:
8
- Enabled: true
9
- Lint/DeprecatedOpenSSLConstant:
10
- Enabled: true
11
- Lint/DuplicateElsifCondition:
12
- Enabled: true
13
- Lint/DuplicateRequire:
14
- Enabled: true
15
- Lint/DuplicateRescueException:
16
- Enabled: true
17
- Lint/EmptyConditionalBody:
18
- Enabled: true
19
- Lint/EmptyFile:
20
- Enabled: true
21
- Lint/FloatComparison:
22
- Enabled: true
23
- Lint/MissingSuper:
24
- Enabled: true
25
- Lint/MixedRegexpCaptureTypes:
26
- Enabled: true
27
- Lint/OutOfRangeRegexpRef:
28
- Enabled: true
29
- Lint/RaiseException:
30
- Enabled: true
31
- Lint/SelfAssignment:
32
- Enabled: true
33
- Lint/StructNewOverride:
34
- Enabled: true
35
- Lint/TopLevelReturnWithArgument:
36
- Enabled: true
37
- Lint/TrailingCommaInAttributeDeclaration:
38
- Enabled: true
39
- Lint/UnreachableLoop:
40
- Enabled: true
41
- Lint/UselessMethodDefinition:
42
- Enabled: true
43
- Style/AccessorGrouping:
44
- Enabled: true
45
- Style/ArrayCoercion:
46
- Enabled: true
47
- Style/BisectedAttrAccessor:
48
- Enabled: true
49
- Style/CaseLikeIf:
50
- Enabled: true
51
- Style/CombinableLoops:
52
- Enabled: true
53
- Style/ExplicitBlockArgument:
54
- Enabled: true
55
- Style/ExponentialNotation:
56
- Enabled: true
57
- Style/GlobalStdStream:
58
- Enabled: true
59
- Style/HashAsLastArrayItem:
60
- Enabled: true
61
- Style/HashEachMethods:
62
- Enabled: true
63
- Style/HashLikeCase:
64
- Enabled: true
65
- Style/HashTransformKeys:
66
- Enabled: true
67
- Style/HashTransformValues:
68
- Enabled: true
69
- Style/KeywordParametersOrder:
70
- Enabled: true
71
- Style/OptionalBooleanParameter:
72
- Enabled: true
73
- Style/RedundantAssignment:
74
- Enabled: true
75
- Style/RedundantFetchBlock:
76
- Enabled: true
77
- Style/RedundantFileExtensionInRequire:
78
- Enabled: true
79
- Style/RedundantRegexpCharacterClass:
80
- Enabled: true
81
- Style/RedundantRegexpEscape:
82
- Enabled: true
83
- Style/RedundantSelfAssignment:
84
- Enabled: true
85
- Style/SingleArgumentDig:
86
- Enabled: true
87
- Style/SlicingWithRange:
88
- Enabled: true
89
- Style/SoleNestedConditional:
90
- Enabled: true
91
- Style/StringConcatenation:
92
- Enabled: true
3
+ AllCops:
4
+ NewCops: enable
5
+ # Layout/BeginEndAlignment: # (new in 0.91)
6
+ # Enabled: true
7
+ # Layout/EmptyLinesAroundAttributeAccessor: # (new in 0.83)
8
+ # Enabled: true
9
+ # Layout/SpaceAroundMethodCallOperator: # (new in 0.82)
10
+ # Enabled: true
11
+ # Lint/BinaryOperatorWithIdenticalOperands: # (new in 0.89)
12
+ # Enabled: true
13
+ # Lint/ConstantDefinitionInBlock: # (new in 0.91)
14
+ # Enabled: true
15
+ # Lint/DeprecatedOpenSSLConstant: # (new in 0.84)
16
+ # Enabled: true
17
+ # Lint/DuplicateElsifCondition: # (new in 0.88)
18
+ # Enabled: true
19
+ # Lint/DuplicateRequire: # (new in 0.90)
20
+ # Enabled: true
21
+ # Lint/DuplicateRescueException: # (new in 0.89)
22
+ # Enabled: true
23
+ # Lint/EmptyConditionalBody: # (new in 0.89)
24
+ # Enabled: true
25
+ # Lint/EmptyFile: # (new in 0.90)
26
+ # Enabled: true
27
+ # Lint/FloatComparison: # (new in 0.89)
28
+ # Enabled: true
29
+ # Lint/IdentityComparison: # (new in 0.91)
30
+ # Enabled: true
31
+ # Lint/MissingSuper: # (new in 0.89)
32
+ # Enabled: true
33
+ # Lint/MixedRegexpCaptureTypes: # (new in 0.85)
34
+ # Enabled: true
35
+ # Lint/OutOfRangeRegexpRef: # (new in 0.89)
36
+ # Enabled: true
37
+ # Lint/RaiseException: # (new in 0.81)
38
+ # Enabled: true
39
+ # Lint/SelfAssignment: # (new in 0.89)
40
+ # Enabled: true
41
+ # Lint/StructNewOverride: # (new in 0.81)
42
+ # Enabled: true
43
+ # Lint/TopLevelReturnWithArgument: # (new in 0.89)
44
+ # Enabled: true
45
+ # Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
46
+ # Enabled: true
47
+ # Lint/UnreachableLoop: # (new in 0.89)
48
+ # Enabled: true
49
+ # Lint/UselessMethodDefinition: # (new in 0.90)
50
+ # Enabled: true
51
+ # Lint/UselessTimes: # (new in 0.91)
52
+ # Enabled: true
53
+ # Style/AccessorGrouping: # (new in 0.87)
54
+ # Enabled: true
55
+ # Style/ArrayCoercion: # (new in 0.88)
56
+ # Enabled: true
57
+ # Style/BisectedAttrAccessor: # (new in 0.87)
58
+ # Enabled: true
59
+ # Style/CaseLikeIf: # (new in 0.88)
60
+ # Enabled: true
61
+ # Style/CombinableLoops: # (new in 0.90)
62
+ # Enabled: true
63
+ # Style/ExplicitBlockArgument: # (new in 0.89)
64
+ # Enabled: true
65
+ # Style/ExponentialNotation: # (new in 0.82)
66
+ # Enabled: true
67
+ # Style/GlobalStdStream: # (new in 0.89)
68
+ # Enabled: true
69
+ # Style/HashAsLastArrayItem: # (new in 0.88)
70
+ # Enabled: true
71
+ # Style/HashEachMethods: # (new in 0.80)
72
+ # Enabled: true
73
+ # Style/HashLikeCase: # (new in 0.88)
74
+ # Enabled: true
75
+ # Style/HashTransformKeys: # (new in 0.80)
76
+ # Enabled: true
77
+ # Style/HashTransformValues: # (new in 0.80)
78
+ # Enabled: true
79
+ # Style/KeywordParametersOrder: # (new in 0.90)
80
+ # Enabled: true
81
+ # Style/OptionalBooleanParameter: # (new in 0.89)
82
+ # Enabled: true
83
+ # Style/RedundantAssignment: # (new in 0.87)
84
+ # Enabled: true
85
+ # Style/RedundantFetchBlock: # (new in 0.86)
86
+ # Enabled: true
87
+ # Style/RedundantFileExtensionInRequire: # (new in 0.88)
88
+ # Enabled: true
89
+ # Style/RedundantRegexpCharacterClass: # (new in 0.85)
90
+ # Enabled: true
91
+ # Style/RedundantRegexpEscape: # (new in 0.85)
92
+ # Enabled: true
93
+ # Style/RedundantSelfAssignment: # (new in 0.90)
94
+ # Enabled: true
95
+ # Style/SingleArgumentDig: # (new in 0.89)
96
+ # Enabled: true
97
+ # Style/SlicingWithRange: # (new in 0.83)
98
+ # Enabled: true
99
+ # Style/SoleNestedConditional: # (new in 0.89)
100
+ # Enabled: true
101
+ # Style/StringConcatenation: # (new in 0.89)
102
+ # Enabled: true
103
+ # For more information: https://docs.rubocop.org/rubocop/versioning.html
data/rails.yml CHANGED
@@ -1,29 +1,11 @@
1
- # Rails specific cops
2
- Rails/ApplicationController:
3
- Exclude:
4
- - "spec/**/*"
5
- - "test/**/*"
6
- Rails/SkipsModelValidations:
7
- Exclude:
8
- - "db/migrate/**/*"
9
- - "lib/tasks/**/*"
10
- - "spec/**/*"
11
- - "test/**/*"
12
- Rails/UnknownEnv:
13
- Environments:
14
- - cucumber
15
- - development
16
- - production
17
- - qa
18
- - test
19
- - uat
20
-
21
- # These rails cops are currently pending and will be enabled by default at some point, but adding for now to stop
22
- # Rubocop or VSCode complaining...
23
1
  Rails/ActiveRecordCallbacksOrder:
24
2
  Enabled: true
25
3
  Rails/AfterCommitOverride:
26
4
  Enabled: true
5
+ Rails/ApplicationController:
6
+ Exclude:
7
+ - spec/**/*
8
+ - test/**/*
27
9
  Rails/FindById:
28
10
  Enabled: true
29
11
  Rails/Inquiry:
@@ -44,8 +26,22 @@ Rails/RenderPlainText:
44
26
  Enabled: true
45
27
  Rails/ShortI18n:
46
28
  Enabled: true
29
+ Rails/SkipsModelValidations:
30
+ Exclude:
31
+ - db/migrate/**/*
32
+ - lib/tasks/**/*
33
+ - spec/**/*
34
+ - test/**/*
47
35
  Rails/SquishedSQLHeredocs:
48
36
  Enabled: true
37
+ Rails/UnknownEnv:
38
+ Environments:
39
+ - cucumber
40
+ - development
41
+ - production
42
+ - qa
43
+ - test
44
+ - uat
49
45
  Rails/WhereExists:
50
46
  Enabled: true
51
47
  Rails/WhereNot:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxt_ruby_style_guide
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1
4
+ version: 7.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boxt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2020-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,56 +16,76 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.90.0
19
+ version: 0.92.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.90.0
26
+ version: 0.92.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">"
42
+ - !ruby/object:Gem::Version
43
+ version: '5'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: rubocop-faker
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
- - - "~>"
51
+ - - '='
32
52
  - !ruby/object:Gem::Version
33
- version: '1.0'
53
+ version: 1.1.0
34
54
  type: :runtime
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
- - - "~>"
58
+ - - '='
39
59
  - !ruby/object:Gem::Version
40
- version: '1.0'
60
+ version: 1.1.0
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: rubocop-rails
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
- - - "~>"
65
+ - - '='
46
66
  - !ruby/object:Gem::Version
47
- version: '2.6'
67
+ version: 2.8.1
48
68
  type: :runtime
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
- - - "~>"
72
+ - - '='
53
73
  - !ruby/object:Gem::Version
54
- version: '2.6'
74
+ version: 2.8.1
55
75
  - !ruby/object:Gem::Dependency
56
76
  name: rubocop-rspec
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
- - - "~>"
79
+ - - '='
60
80
  - !ruby/object:Gem::Version
61
- version: '1.43'
81
+ version: 1.43.2
62
82
  type: :runtime
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
- - - "~>"
86
+ - - '='
67
87
  - !ruby/object:Gem::Version
68
- version: '1.43'
88
+ version: 1.43.2
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: bundler
71
91
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +114,20 @@ dependencies:
94
114
  - - "~>"
95
115
  - !ruby/object:Gem::Version
96
116
  version: '13.0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '3.9'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '3.9'
97
131
  - !ruby/object:Gem::Dependency
98
132
  name: rspec-nc
99
133
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +148,14 @@ dependencies:
114
148
  requirements:
115
149
  - - "~>"
116
150
  - !ruby/object:Gem::Version
117
- version: '0.18'
151
+ version: '0.19'
118
152
  type: :development
119
153
  prerelease: false
120
154
  version_requirements: !ruby/object:Gem::Requirement
121
155
  requirements:
122
156
  - - "~>"
123
157
  - !ruby/object:Gem::Version
124
- version: '0.18'
158
+ version: '0.19'
125
159
  description: Ruby styleguide info for the BOXT projects, as well as config settings
126
160
  for Rubocop
127
161
  email:
@@ -138,6 +172,7 @@ files:
138
172
  - lib/boxt_ruby_style_guide.rb
139
173
  - lib/boxt_ruby_style_guide/railtie.rb
140
174
  - lib/boxt_ruby_style_guide/version.rb
175
+ - lib/tasks/lint.rake
141
176
  - pending.yml
142
177
  - rails-pending.yml
143
178
  - rails.yml
@@ -146,7 +181,7 @@ homepage: https://github.com/boxt/ruby-style-guide
146
181
  licenses:
147
182
  - MIT
148
183
  metadata: {}
149
- post_install_message:
184
+ post_install_message:
150
185
  rdoc_options: []
151
186
  require_paths:
152
187
  - lib
@@ -161,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
196
  - !ruby/object:Gem::Version
162
197
  version: '0'
163
198
  requirements: []
164
- rubygems_version: 3.1.4
165
- signing_key:
199
+ rubygems_version: 3.1.2
200
+ signing_key:
166
201
  specification_version: 4
167
202
  summary: Ruby styleguide info for the BOXT Ruby projects
168
203
  test_files: []