hubbado-style 1.5.2 → 1.7.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: 9f3a281636b742d81c45f804d0d65e8966ffed88b215da287f3cbe735218f68e
4
- data.tar.gz: dbb7802765d29119980488f822c536d5a945c9aba9aae84bc0983c2a2002588a
3
+ metadata.gz: 9e70305b093794c0da6e6f4e5b8e475bf541f10ea7017bef39a7466143eeb075
4
+ data.tar.gz: d30d47f2dec8244c5cd247ef5714be0c8dce748769b56eb653ebe7038bad573f
5
5
  SHA512:
6
- metadata.gz: 0eebbca11b442677d15512dd902c107b5a022063b7cfebada42190feb93d692edfd858f30c50337ee97db4069d1c656579eb58809c73599aa08e12dfd83e0ad0
7
- data.tar.gz: 901dc8f390cc602188df82ce5da0db1daab5f648869f6992fa07bc97dc4016522d6e34379c3195a5873fbd12a0fd9817980ba6155a6e7787b746df5a40d3ad95
6
+ metadata.gz: 9c695a0cf5748bbf8959883f17c3ff1a019373cd8f0f4163e2a65b518f06ec0ce8943ba5218168090b0ba28ff2904df6af07b82d10767b9160f36b0ea3a52b32
7
+ data.tar.gz: b02ddf255925beeeab0de0948ad1f0fc2e1d9e7c95029efad4cef8e97553fe42cd3bfd0e31545ab6aefbab43ef9d1e265bfb38a0b5741b4b1372e5f580384965
data/ChangeLog.md ADDED
@@ -0,0 +1,80 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+ # [1.7.0 - 2026-11-20]
8
+ ## Changed
9
+ - Layout/BlockEndNewline enabled, in specs too: a block's `end` or `}` on the
10
+ line of its body is an offence, so `rubocop -a` can no longer leave
11
+ `do |x|` followed by a body and `end` on one line
12
+
13
+ ## Migration
14
+ - Run `rubocop -a --only Layout/BlockEndNewline`. The spec style
15
+ `let(:x) { Foo.call(` ... `) }` is an offence now; the correction puts the
16
+ `}` on its own line
17
+
18
+ # [1.6.0 - 2026-11-01]
19
+ ## Added
20
+ - Hubbado/UnusedMethodArgument, which replaces Lint/UnusedMethodArgument and
21
+ ignores the arguments of a `record def`
22
+ - Layout/FirstMethodParameterLineBreak and
23
+ Layout/MultilineMethodParameterLineBreaks enabled
24
+ - Settings from hubbado_core: SuggestExtensions, Metrics/ModuleLength,
25
+ Naming/AccessorMethodName, Naming/VariableNumber, Style/Alias,
26
+ Style/EmptyClassDefinition, Style/FloatDivision, Style/HashAsLastArrayItem
27
+ and Lint/AmbiguousOperatorPrecedence disabled; Naming/BlockForwarding
28
+ explicit; Style/ArgumentsForwarding not anonymous;
29
+ Lint/UnusedMethodArgument not autocorrected; Style/FormatStringToken and
30
+ Lint/ConstantDefinitionInBlock skip specs
31
+
32
+ ## Changed
33
+ - Layout/ParameterAlignment uses with_fixed_indentation
34
+ - Style/HashSyntax EnforcedShorthandSyntax is either_consistent
35
+ - Target ruby version 4.0
36
+
37
+ ## Migration
38
+ - Rename a `.rubocop.yml` override of Lint/UnusedMethodArgument to
39
+ Hubbado/UnusedMethodArgument
40
+ - Delete `# rubocop:disable Lint/UnusedMethodArgument` on a `record def`
41
+ (`rubocop -a` does this), and rename it to Hubbado/UnusedMethodArgument on
42
+ any other method
43
+
44
+ # [1.5.2 - 2025-06-16]
45
+ ## Fixed
46
+ - Naming/PredicateName renamed to Naming/PredicatePrefix
47
+
48
+ # [1.5.1 - 2025-05-30]
49
+ - Bumped version to publish package in rubygems
50
+
51
+ # [1.5.0 - 2025-04-11]
52
+ ## Changed
53
+ - Style/IfUnlessModifier disabled
54
+ - Target ruby version 3.4
55
+
56
+ # [1.4.0 - 2023-04-17]
57
+ ## Added
58
+ - Disable Metrics/ParameterLists
59
+
60
+ # [1.3.0 - 2023-04-05]
61
+ ## Changed
62
+ - Added EnforcedShorthandSyntax: never to Style/HashSyntax
63
+ - Target ruby version 3.2
64
+
65
+ # [1.2.0 - 2023-01-24]
66
+ ## Changed
67
+ - Target ruby version 3.1
68
+
69
+ # [1.1.0 - 2020-03-16]
70
+ ## Changed
71
+ - Do not report on Metrics/AbcSize, Metrics/BlockLength,
72
+ Metrics/CyclomaticComplexity or Metrics/PerceivedComplexity
73
+
74
+ # [1.0.1 - 2021-04-10]
75
+ ## Fixed
76
+ - Don't scan the gems directory
77
+
78
+ # [1.0.0 - 2021-04-10]
79
+ ## Added
80
+ - Fix version of this gem, using our Rails monolith Rubocop configuration as a base
data/default.yml CHANGED
@@ -1,3 +1,6 @@
1
+ require:
2
+ - hubbado/style
3
+
1
4
  AllCops:
2
5
  Include:
3
6
  - '**/*.rb'
@@ -8,8 +11,9 @@ AllCops:
8
11
  - db/**
9
12
  - config/**
10
13
  - script/**
11
- TargetRubyVersion: 3.4
14
+ TargetRubyVersion: 4.0
12
15
  NewCops: enable
16
+ SuggestExtensions: false
13
17
 
14
18
  Metrics/AbcSize:
15
19
  Enabled: false
@@ -26,19 +30,42 @@ Metrics/CyclomaticComplexity:
26
30
  Metrics/MethodLength:
27
31
  Enabled: false
28
32
 
33
+ # All spec files are basically one giant module
34
+ # Sometimes we include the spec in a module, as RSpec doesn't support include properly
35
+ Metrics/ModuleLength:
36
+ Enabled: false
37
+
29
38
  Metrics/ParameterLists:
30
39
  Enabled: false
31
40
 
32
41
  Metrics/PerceivedComplexity:
33
42
  Enabled: false
34
43
 
44
+ # We will use our own judgement here
45
+ Naming/AccessorMethodName:
46
+ Enabled: false
47
+
48
+ Naming/BlockForwarding:
49
+ EnforcedStyle: explicit
50
+
35
51
  Naming/PredicatePrefix:
36
52
  ForbiddenPrefixes:
37
53
  - is_
38
54
 
55
+ # We will use our own judgement here
56
+ Naming/VariableNumber:
57
+ Enabled: false
58
+
39
59
  Style/AccessorGrouping:
40
60
  Enabled: false
41
61
 
62
+ # We will use our own judgement here
63
+ Style/Alias:
64
+ Enabled: false
65
+
66
+ Style/ArgumentsForwarding:
67
+ UseAnonymousForwarding: false
68
+
42
69
  Style/BlockDelimiters:
43
70
  EnforcedStyle: line_count_based
44
71
  Exclude:
@@ -47,11 +74,28 @@ Style/BlockDelimiters:
47
74
  Style/Documentation:
48
75
  Enabled: false
49
76
 
77
+ # One-liner `Foo = Class.new(Bar)` is preferred for empty exception classes
78
+ Style/EmptyClassDefinition:
79
+ Enabled: false
80
+
81
+ # This gets it wrong when we want to divide money by money as floats
82
+ Style/FloatDivision:
83
+ Enabled: false
84
+
85
+ # Gets confused with %{first} in YAML strings in tests
86
+ Style/FormatStringToken:
87
+ Exclude:
88
+ - 'spec/**/*'
89
+
50
90
  Style/FrozenStringLiteralComment:
51
91
  Enabled: false
52
92
 
93
+ # Unnecessary {} when this is enabled
94
+ Style/HashAsLastArrayItem:
95
+ Enabled: false
96
+
53
97
  Style/HashSyntax:
54
- EnforcedShorthandSyntax: never
98
+ EnforcedShorthandSyntax: either_consistent
55
99
 
56
100
  Style/IfUnlessModifier:
57
101
  Enabled: false
@@ -75,15 +119,15 @@ Style/StringLiterals:
75
119
  Layout/ArgumentAlignment:
76
120
  EnforcedStyle: with_fixed_indentation
77
121
 
78
- Layout/BlockEndNewline:
79
- Enabled: false
80
-
81
122
  Layout/CaseIndentation:
82
123
  IndentOneStep: true
83
124
 
84
125
  Layout/EmptyLineAfterGuardClause:
85
126
  Enabled: false
86
127
 
128
+ Layout/FirstMethodParameterLineBreak:
129
+ Enabled: true
130
+
87
131
  Layout/MultilineBlockLayout:
88
132
  Exclude:
89
133
  - 'spec/**/*'
@@ -92,6 +136,12 @@ Layout/MultilineMethodCallIndentation:
92
136
  EnforcedStyle: indented
93
137
  IndentationWidth: 2
94
138
 
139
+ Layout/MultilineMethodParameterLineBreaks:
140
+ Enabled: true
141
+
142
+ Layout/ParameterAlignment:
143
+ EnforcedStyle: with_fixed_indentation
144
+
95
145
  Layout/LineLength:
96
146
  Max: 100
97
147
 
@@ -100,6 +150,28 @@ Lint/AmbiguousBlockAssociation:
100
150
  Exclude:
101
151
  - 'spec/**/*'
102
152
 
153
+ # We know mathematical precedence so this is unnecessary
154
+ Lint/AmbiguousOperatorPrecedence:
155
+ Enabled: false
156
+
157
+ # Constants have to be created and assigned in RSpec blocks
158
+ Lint/ConstantDefinitionInBlock:
159
+ Exclude:
160
+ - 'spec/**/*'
161
+
162
+ Lint/UnusedMethodArgument:
163
+ Enabled: false
164
+
165
+ Hubbado/UnusedMethodArgument:
166
+ Enabled: true
167
+ Severity: warning
168
+ AutoCorrect: false
169
+ AllowUnusedKeywordArguments: false
170
+ IgnoreEmptyMethods: true
171
+ IgnoreNotImplementedMethods: true
172
+ NotImplementedExceptions:
173
+ - NotImplementedError
174
+
103
175
  Lint/UselessAccessModifier:
104
176
  MethodCreatingMethods:
105
177
  - delegate
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "hubbado-style"
3
- s.version = "1.5.2"
3
+ s.version = "1.7.0"
4
4
  s.summary = "Hubbado style guides and shared style configs."
5
5
 
6
6
  s.authors = ["Hubbado Devs"]
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  s.files = Dir.glob(%w[
14
+ lib/**/*.rb
14
15
  default.yml
15
16
  *.gemspec
16
17
  LICENSE*
@@ -22,4 +23,5 @@ Gem::Specification.new do |s|
22
23
 
23
24
  s.add_development_dependency "bundler"
24
25
  s.add_development_dependency "rake"
26
+ s.add_development_dependency "test_bench"
25
27
  end
@@ -0,0 +1,19 @@
1
+ # Finds unused method arguments, except in a `record def`, where a substitute keeps
2
+ # parameters it does not use because `record` reads their names
3
+ module RuboCop
4
+ module Cop
5
+ module Hubbado
6
+ class UnusedMethodArgument < Lint::UnusedMethodArgument
7
+ def_node_matcher :record?, "(send nil? :record def)"
8
+
9
+ private
10
+
11
+ def check_argument(variable)
12
+ return if record?(variable.scope.node.parent)
13
+
14
+ super
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ # Loads the Hubbado cops that default.yml enables, for a RuboCop run that inherits it
2
+ require "rubocop"
3
+
4
+ require "hubbado/style/unused_method_argument"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubbado-style
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hubbado Devs
@@ -51,17 +51,33 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: test_bench
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
54
68
  email:
55
69
  - devs@hubbado.com
56
70
  executables: []
57
71
  extensions: []
58
72
  extra_rdoc_files: []
59
73
  files:
60
- - CHANGELOG.md
74
+ - ChangeLog.md
61
75
  - LICENSE
62
76
  - README.md
63
77
  - default.yml
64
78
  - hubbado-style.gemspec
79
+ - lib/hubbado/style.rb
80
+ - lib/hubbado/style/unused_method_argument.rb
65
81
  homepage: https://github.com/hubbado/hubbado-style
66
82
  licenses:
67
83
  - MIT
@@ -80,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
96
  - !ruby/object:Gem::Version
81
97
  version: '0'
82
98
  requirements: []
83
- rubygems_version: 3.6.7
99
+ rubygems_version: 4.0.20
84
100
  specification_version: 4
85
101
  summary: Hubbado style guides and shared style configs.
86
102
  test_files: []
data/CHANGELOG.md DELETED
@@ -1,43 +0,0 @@
1
- # Change Log
2
- All notable changes to this project will be documented in this file.
3
-
4
- The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
- and this project adheres to [Semantic Versioning](http://semver.org/).
6
-
7
- # [1.5.2 - 2025-06-16]
8
- ## Fixed
9
- - Naming/PredicateName renamed to Naming/PredicatePrefix
10
-
11
- # [1.5.1 - 2025-05-30]
12
- - Bumped version to publish package in rubygems
13
-
14
- # [1.5.0 - 2025-04-11]
15
- ## Changed
16
- - Style/IfUnlessModifier disabled
17
- - Target ruby version 3.4
18
-
19
- # [1.4.0 - 2023-04-17]
20
- ## Added
21
- - Disable Metrics/ParameterLists
22
-
23
- # [1.3.0 - 2023-04-05]
24
- ## Changed
25
- - Added EnforcedShorthandSyntax: never to Style/HashSyntax
26
- - Target ruby version 3.2
27
-
28
- # [1.2.0 - 2023-01-24]
29
- ## Changed
30
- - Target ruby version 3.1
31
-
32
- # [1.1.0 - 2020-03-16]
33
- ## Changed
34
- - Do not report on Metrics/AbcSize, Metrics/BlockLength,
35
- Metrics/CyclomaticComplexity or Metrics/PerceivedComplexity
36
-
37
- # [1.0.1 - 2021-04-10]
38
- ## Fixed
39
- - Don't scan the gems directory
40
-
41
- # [1.0.0 - 2021-04-10]
42
- ## Added
43
- - Fix version of this gem, using our Rails monolith Rubocop configuration as a base