boxt_ruby_style_guide 7.1.0 → 7.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e20314b9f30c0aa6877f32a744b11ae3a3634090272908e2f58af499a78eb676
4
- data.tar.gz: e3f6a71a7de4827d49d5bbccc4af225e6a6f94e54481691a47ea611da0ca808f
3
+ metadata.gz: 00a10b1e139e15aa28f133847e8a102bba235fd15840b8da636cc2658cbbd821
4
+ data.tar.gz: '0683e861cc45e0177b5e9f96c4ac05e47ae77b99314978463fa9178da217277d'
5
5
  SHA512:
6
- metadata.gz: 05a7fd43a1c272f9f46936e19fd8f7bd2a526b1ec47ab6401f513add62c2cb2b92a27ea78373f6a29d2f7622ec39082f383b61f050e66f4c49eaa9d930daddbb
7
- data.tar.gz: c8a2a3d2e380b75ecba1fa74ee10e83ed736772c7d6b537e1a458323905b3a5bac55fd2f5466107b8e12af75cab037868fff8404b8f7118c50dbcaa3614c9f80
6
+ metadata.gz: 65c4b44b3a1eb0077bcaf1dc2be3035439fd7b9b0771409f1b02483ac81f5d2b744768f6901206e600f9cbb3fec0743ef585e52f89fabac58250ebcfc44b6891
7
+ data.tar.gz: 3d3b1cc9df23483d023e55b1029e47d98cfdc62982c366f8992b5ef6ee95077f216f9368498447d478c9ebe7530cd7e2e1fb94c5147702c706409e369a2f8ed1
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.0
1
+ 7.4.0
@@ -1,40 +1,39 @@
1
- inherit_mode:
2
- merge:
3
- - AllowedNames
4
-
5
1
  AllCops:
6
- TargetRubyVersion: 2.7.1
7
2
  Exclude:
8
3
  - "**/*/schema.rb"
9
- - "Gemfile.lock"
10
- - "node_modules/**/*"
11
- - "tmp/**/*"
12
- - "vendor/**/*"
4
+ - Gemfile.lock
5
+ - node_modules/**/*
6
+ - tmp/**/*
7
+ - vendor/**/*
8
+ TargetRubyVersion: 2.7.1
13
9
  Layout/LineLength:
14
- Max: 120 # Increase line length to 120
15
10
  Exclude:
16
- - "config/routes.rb"
11
+ - config/routes.rb
12
+ Max: 120
13
+ Metrics/AbcSize:
14
+ Exclude:
15
+ - db/migrate/**/*
17
16
  Metrics/BlockLength:
18
17
  Exclude:
19
18
  - "*.gemspec"
20
- - "Gemfile"
21
- - "config/routes.rb"
22
- - "spec/**/*"
23
- - "test/**/*"
19
+ - Gemfile
20
+ - config/routes.rb
21
+ - db/migrate/**/*
22
+ - spec/**/*
23
+ - test/**/*
24
24
  Metrics/ClassLength:
25
25
  Exclude:
26
- - "spec/**/*"
27
- - "test/**/*"
26
+ - db/migrate/**/*
27
+ - spec/**/*
28
+ - test/**/*
28
29
  Metrics/MethodLength:
29
30
  Exclude:
30
- - "spec/**/*"
31
- - "test/**/*"
32
- Naming/MethodParameterName:
33
- AllowedNames:
34
- - "..."
31
+ - db/migrate/**/*
32
+ - spec/**/*
33
+ - test/**/*
34
+ Style/Documentation:
35
+ Enabled: false
35
36
  Style/DoubleNegation:
36
37
  Enabled: false
37
- Style/Documentation:
38
- Enabled: false # Disable Style/Documentation because...
39
38
  Style/StringLiterals:
40
- 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,62 @@
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-tree -r --name-only --diff-filter=d #{base_branch} HEAD \
57
+ | egrep '#{GREP_PATTERN}'
58
+ BASH
59
+ file_paths = `#{command}`
60
+ file_paths.gsub(/\n|\r/, " ")
61
+ end
62
+ 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.0
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boxt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2020-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,56 +16,70 @@ 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
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">"
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rubocop-faker
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "~>"
45
+ - - '='
32
46
  - !ruby/object:Gem::Version
33
- version: '1.0'
47
+ version: 1.1.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "~>"
52
+ - - '='
39
53
  - !ruby/object:Gem::Version
40
- version: '1.0'
54
+ version: 1.1.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rubocop-rails
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - '='
46
60
  - !ruby/object:Gem::Version
47
- version: '2.6'
61
+ version: 2.8.1
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "~>"
66
+ - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: '2.6'
68
+ version: 2.8.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop-rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: '1.43'
75
+ version: 1.43.2
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - '='
67
81
  - !ruby/object:Gem::Version
68
- version: '1.43'
82
+ version: 1.43.2
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +108,20 @@ dependencies:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '13.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.9'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.9'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: rspec-nc
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +142,14 @@ dependencies:
114
142
  requirements:
115
143
  - - "~>"
116
144
  - !ruby/object:Gem::Version
117
- version: '0.18'
145
+ version: '0.19'
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
- version: '0.18'
152
+ version: '0.19'
125
153
  description: Ruby styleguide info for the BOXT projects, as well as config settings
126
154
  for Rubocop
127
155
  email:
@@ -138,6 +166,7 @@ files:
138
166
  - lib/boxt_ruby_style_guide.rb
139
167
  - lib/boxt_ruby_style_guide/railtie.rb
140
168
  - lib/boxt_ruby_style_guide/version.rb
169
+ - lib/tasks/lint.rake
141
170
  - pending.yml
142
171
  - rails-pending.yml
143
172
  - rails.yml