standard 0.8.1 → 0.11.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: bdafc85bb1387d3491c006a507b527d3831a5980520a918131bb242e899d3a35
4
- data.tar.gz: 4339051c4e2a9f268de90aa67a3de7bf2dbe3abbad8377b73ce1f471f747d210
3
+ metadata.gz: ae2564522ac361e37d4c51c9962fe5b0bbca2fd7c4b37ae1880c619778a46966
4
+ data.tar.gz: 00b84978d2e64b59ecd757a46a7f562e7d9f1ecaeb0c03062140628c78565658
5
5
  SHA512:
6
- metadata.gz: 3877c41ad4ee463801623eded88e7a715f521acd81bce6b2eb4de86353e379793c6262aec87c7c3034f507249da78a5712232d64d26a829a32bd1bb17d2ed72b
7
- data.tar.gz: 0c74aa040926c89a1587398c712c29943775c8f943113fbf347f79132116c5c237a67e40d8ca98d0c2be4bd059238d9b8c69088c4f6f964bb9a7362e3e1fb375
6
+ metadata.gz: 91a99adab0683f57682af967b4936777444974f9f19c5cda438df911c3ce1ad37f099968eb1d47a4ebe541c96ae50cdb1967e89056e683e5dc71a7b29b03a3e8
7
+ data.tar.gz: 2c26f2ad10033b682b870cdaa66e6b60eb537a483f34d880d2bd90e70a3ef27e8421d06c13d261d74ca196748d8f3be2c915ae2e96e098c3bae1bdbe23f42c14
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0
4
+
5
+ * Update rubocop-performance from 1.9.1 to [1.9.2](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.9.2)
6
+ * Update rubocop from 1.4.2 to [1.7.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.7.0)
7
+ * Changed `Style/NegatedIf` to `postfix`
8
+
9
+ ## 0.10.2
10
+
11
+ * Remove
12
+ [`Lint/DuplicateBranch`](https://github.com/testdouble/standard/pull/228)
13
+
14
+ ## 0.10.1
15
+
16
+ * Remove [`Performance/ArraySemiInfiniteRangeSlice`](https://github.com/testdouble/standard/pull/225#discussion_r532678908)
17
+
18
+ ## 0.10.0
19
+
20
+ * Update rubocop-performance from 1.8.1 to [1.9.1](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.9.1) enabling:
21
+ * [`Performance/BlockGivenWithExplicitBlock`](https://github.com/rubocop-hq/rubocop-performance/pull/173)
22
+ * [`Performance/ConstantRegexp`](https://github.com/rubocop-hq/rubocop-performance/pull/174)
23
+ * [`Performance/ArraySemiInfiniteRangeSlice`](https://github.com/rubocop-hq/rubocop-performance/pull/175)
24
+ * Update rubocop from 1.2.0 to [1.4.2](https://github.com/rubocop-hq/rubocop/releases/tag/v1.4.2) enabling:
25
+ * [`Style/NilLambda`](https://github.com/rubocop-hq/rubocop/pull/9020)
26
+ * [`Lint/DuplicateBranch`](https://github.com/rubocop-hq/rubocop/pull/8404)
27
+
28
+ ## 0.9.0
29
+
30
+ * Update rubocop from 1.0.0 to [1.2.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.2.0) enabling:
31
+ * [`Lint/DuplicateRegexpCharacterClassElement`](https://github.com/rubocop-hq/rubocop/pull/8896)
32
+ * [`Style/ArgumentsForwarding`](https://github.com/rubocop-hq/rubocop/pull/7646)
33
+ * Don't find offense in `Style/SemanticBlocks` when a top-level `rescue` is used
34
+ in a `do`/`end` functional block, fixing
35
+ [#205](https://github.com/testdouble/standard/issues/205)
36
+
3
37
  ## 0.8.1
4
38
 
5
39
  * Make it match semver
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard (0.8.1)
5
- rubocop (= 1.0.0)
6
- rubocop-performance (= 1.8.1)
4
+ standard (0.11.0)
5
+ rubocop (= 1.7.0)
6
+ rubocop-performance (= 1.9.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -14,31 +14,31 @@ GEM
14
14
  gimme (0.5.0)
15
15
  method_source (1.0.0)
16
16
  minitest (5.14.2)
17
- parallel (1.19.2)
18
- parser (2.7.2.0)
17
+ parallel (1.20.1)
18
+ parser (3.0.0.0)
19
19
  ast (~> 2.4.1)
20
20
  pry (0.13.1)
21
21
  coderay (~> 1.1)
22
22
  method_source (~> 1.0)
23
23
  rainbow (3.0.0)
24
24
  rake (13.0.1)
25
- regexp_parser (1.8.2)
25
+ regexp_parser (2.0.3)
26
26
  rexml (3.2.4)
27
- rubocop (1.0.0)
27
+ rubocop (1.7.0)
28
28
  parallel (~> 1.10)
29
29
  parser (>= 2.7.1.5)
30
30
  rainbow (>= 2.2.2, < 4.0)
31
- regexp_parser (>= 1.8)
31
+ regexp_parser (>= 1.8, < 3.0)
32
32
  rexml
33
- rubocop-ast (>= 0.6.0)
33
+ rubocop-ast (>= 1.2.0, < 2.0)
34
34
  ruby-progressbar (~> 1.7)
35
35
  unicode-display_width (>= 1.4.0, < 2.0)
36
- rubocop-ast (1.0.0)
36
+ rubocop-ast (1.4.0)
37
37
  parser (>= 2.7.1.5)
38
- rubocop-performance (1.8.1)
39
- rubocop (>= 0.87.0)
38
+ rubocop-performance (1.9.2)
39
+ rubocop (>= 0.90.0, < 2.0)
40
40
  rubocop-ast (>= 0.4.0)
41
- ruby-progressbar (1.10.1)
41
+ ruby-progressbar (1.11.0)
42
42
  simplecov (0.19.0)
43
43
  docile (~> 1.1)
44
44
  simplecov-html (~> 0.11)
data/README.md CHANGED
@@ -367,7 +367,7 @@ Refer to RuboCop's [documentation on
367
367
  formatters](https://rubocop.readthedocs.io/en/latest/formatters/) for more
368
368
  information.
369
369
 
370
- ## How do I run standard in my editor?
370
+ ## How do I run Standard in my editor?
371
371
 
372
372
  It can be very handy to know about failures while editing to shorten the
373
373
  feedback loop. Some editors support asynchronously running linters.
@@ -378,6 +378,10 @@ feedback loop. Some editors support asynchronously running linters.
378
378
  - [vim (via ALE)](https://github.com/testdouble/standard/wiki/IDE:-vim)
379
379
  - [VS Code](https://github.com/testdouble/standard/wiki/IDE:-vscode)
380
380
 
381
+ ## How do I use Standard with Rubocop extensions?
382
+
383
+ This is not officially supported by Standard. However, Evil Martians wrote up [a regularly updated guide](https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard) on how to do so.
384
+
381
385
  ## Does Standard work with [Insert other tool name here]?
382
386
 
383
387
  Maybe! Start by searching the repository to see if there's an existing issue open for
@@ -56,10 +56,10 @@ Layout/BlockAlignment:
56
56
  Layout/BlockEndNewline:
57
57
  Enabled: true
58
58
 
59
- # Disabled because IndentOneStep can't be configured for one-liner cases. See:
60
- # https://github.com/rubocop-hq/rubocop/issues/6447
61
- # Layout/CaseIndentation:
62
- # Enabled: true
59
+ Layout/CaseIndentation:
60
+ # Disabled because IndentOneStep can't be configured for one-liner cases. See:
61
+ # https://github.com/rubocop-hq/rubocop/issues/6447
62
+ Enabled: false
63
63
 
64
64
  Layout/ClosingHeredocIndentation:
65
65
  Enabled: true
@@ -173,6 +173,10 @@ Layout/IndentationConsistency:
173
173
  Enabled: true
174
174
  EnforcedStyle: normal
175
175
 
176
+ Layout/IndentationStyle:
177
+ Enabled: true
178
+ IndentationWidth: ~
179
+
176
180
  Layout/IndentationWidth:
177
181
  Enabled: true
178
182
  Width: 2
@@ -181,10 +185,10 @@ Layout/IndentationWidth:
181
185
  Layout/InitialIndentation:
182
186
  Enabled: true
183
187
 
184
- Layout/LeadingEmptyLines:
188
+ Layout/LeadingCommentSpace:
185
189
  Enabled: true
186
190
 
187
- Layout/LeadingCommentSpace:
191
+ Layout/LeadingEmptyLines:
188
192
  Enabled: true
189
193
 
190
194
  Layout/MultilineArrayBraceLayout:
@@ -250,6 +254,9 @@ Layout/SpaceAroundEqualsInParameterDefault:
250
254
  Layout/SpaceAroundKeyword:
251
255
  Enabled: true
252
256
 
257
+ Layout/SpaceAroundMethodCallOperator:
258
+ Enabled: true
259
+
253
260
  Layout/SpaceAroundOperators:
254
261
  Enabled: true
255
262
  AllowForAlignment: true
@@ -314,10 +321,6 @@ Layout/SpaceInsideStringInterpolation:
314
321
  Enabled: true
315
322
  EnforcedStyle: no_space
316
323
 
317
- Layout/IndentationStyle:
318
- Enabled: true
319
- IndentationWidth: ~
320
-
321
324
  Layout/TrailingEmptyLines:
322
325
  Enabled: true
323
326
  EnforcedStyle: final_newline
@@ -372,6 +375,9 @@ Lint/DuplicateHashKey:
372
375
  Lint/DuplicateMethods:
373
376
  Enabled: true
374
377
 
378
+ Lint/DuplicateRegexpCharacterClassElement:
379
+ Enabled: true
380
+
375
381
  Lint/DuplicateRequire:
376
382
  Enabled: true
377
383
 
@@ -545,9 +551,6 @@ Lint/ShadowedArgument:
545
551
  Lint/ShadowedException:
546
552
  Enabled: true
547
553
 
548
- Layout/SpaceAroundMethodCallOperator:
549
- Enabled: true
550
-
551
554
  Lint/Syntax:
552
555
  Enabled: true
553
556
 
@@ -594,6 +597,13 @@ Migration/DepartmentName:
594
597
  Naming/BinaryOperatorParameterName:
595
598
  Enabled: true
596
599
 
600
+ Naming/BlockParameterName:
601
+ Enabled: true
602
+ MinNameLength: 1
603
+ AllowNamesEndingInNumbers: true
604
+ AllowedNames: []
605
+ ForbiddenNames: []
606
+
597
607
  Naming/ClassAndModuleCamelCase:
598
608
  Enabled: true
599
609
 
@@ -604,13 +614,6 @@ Naming/HeredocDelimiterCase:
604
614
  Enabled: true
605
615
  EnforcedStyle: uppercase
606
616
 
607
- Naming/BlockParameterName:
608
- Enabled: true
609
- MinNameLength: 1
610
- AllowNamesEndingInNumbers: true
611
- AllowedNames: []
612
- ForbiddenNames: []
613
-
614
617
  Naming/VariableName:
615
618
  Enabled: true
616
619
  EnforcedStyle: snake_case
@@ -621,6 +624,9 @@ Performance/BigDecimalWithNumericArgument:
621
624
  Performance/BindCall:
622
625
  Enabled: true
623
626
 
627
+ Performance/BlockGivenWithExplicitBlock:
628
+ Enabled: true
629
+
624
630
  Performance/Caller:
625
631
  Enabled: true
626
632
 
@@ -630,6 +636,9 @@ Performance/CollectionLiteralInLoop:
630
636
  Performance/CompareWithBlock:
631
637
  Enabled: true
632
638
 
639
+ Performance/ConstantRegexp:
640
+ Enabled: true
641
+
633
642
  Performance/Count:
634
643
  Enabled: true
635
644
 
@@ -723,7 +732,6 @@ Security/YAMLLoad:
723
732
  Enabled: true
724
733
  SafeAutoCorrect: false
725
734
 
726
-
727
735
  Standard/SemanticBlocks:
728
736
  ProceduralMethods:
729
737
  - benchmark
@@ -766,6 +774,10 @@ Style/AndOr:
766
774
  Enabled: true
767
775
  EnforcedStyle: always
768
776
 
777
+ Style/ArgumentsForwarding:
778
+ Enabled: true
779
+ AllowOnlyRestArgument: true
780
+
769
781
  Style/ArrayJoin:
770
782
  Enabled: true
771
783
 
@@ -886,7 +898,6 @@ Style/IfWithSemicolon:
886
898
 
887
899
  Style/InfiniteLoop:
888
900
  Enabled: true
889
- SafeAutoCorrect: true
890
901
 
891
902
  Style/KeywordParametersOrder:
892
903
  Enabled: true
@@ -928,7 +939,7 @@ Style/MultilineWhenThen:
928
939
 
929
940
  Style/NegatedIf:
930
941
  Enabled: true
931
- EnforcedStyle: both
942
+ EnforcedStyle: postfix
932
943
 
933
944
  Style/NegatedWhile:
934
945
  Enabled: true
@@ -964,6 +975,9 @@ Style/NilComparison:
964
975
  Enabled: true
965
976
  EnforcedStyle: predicate
966
977
 
978
+ Style/NilLambda:
979
+ Enabled: true
980
+
967
981
  Style/NonNilCheck:
968
982
  Enabled: true
969
983
  IncludeSemanticChanges: false
@@ -1011,6 +1025,9 @@ Style/RedundantAssignment:
1011
1025
  Style/RedundantBegin:
1012
1026
  Enabled: true
1013
1027
 
1028
+ Style/RedundantCondition:
1029
+ Enabled: true
1030
+
1014
1031
  Style/RedundantConditional:
1015
1032
  Enabled: true
1016
1033
 
@@ -1026,9 +1043,15 @@ Style/RedundantFileExtensionInRequire:
1026
1043
  Style/RedundantFreeze:
1027
1044
  Enabled: true
1028
1045
 
1046
+ Style/RedundantInterpolation:
1047
+ Enabled: true
1048
+
1029
1049
  Style/RedundantParentheses:
1030
1050
  Enabled: true
1031
1051
 
1052
+ Style/RedundantPercentQ:
1053
+ Enabled: true
1054
+
1032
1055
  Style/RedundantRegexpCharacterClass:
1033
1056
  Enabled: true
1034
1057
 
@@ -1042,6 +1065,9 @@ Style/RedundantReturn:
1042
1065
  Style/RedundantSelf:
1043
1066
  Enabled: true
1044
1067
 
1068
+ Style/RedundantSort:
1069
+ Enabled: true
1070
+
1045
1071
  Style/RedundantSortBy:
1046
1072
  Enabled: true
1047
1073
 
@@ -1158,18 +1184,6 @@ Style/TrivialAccessors:
1158
1184
  Style/UnlessElse:
1159
1185
  Enabled: true
1160
1186
 
1161
- Style/RedundantCondition:
1162
- Enabled: true
1163
-
1164
- Style/RedundantInterpolation:
1165
- Enabled: true
1166
-
1167
- Style/RedundantPercentQ:
1168
- Enabled: true
1169
-
1170
- Style/RedundantSort:
1171
- Enabled: true
1172
-
1173
1187
  Style/UnpackFirst:
1174
1188
  Enabled: true
1175
1189
 
@@ -1,8 +1,7 @@
1
1
  inherit_from: ./ruby-1.9.yml
2
2
 
3
- Style/Lambda:
4
- Enabled: false
5
-
6
3
  Style/HashSyntax:
7
4
  EnforcedStyle: hash_rockets
8
5
 
6
+ Style/Lambda:
7
+ Enabled: false
@@ -1,7 +1,8 @@
1
1
  module RuboCop::Cop
2
2
  module Standard
3
- class SemanticBlocks < RuboCop::Cop::Cop
3
+ class SemanticBlocks < RuboCop::Cop::Base
4
4
  include RuboCop::Cop::IgnoredMethods
5
+ extend RuboCop::Cop::AutoCorrector
5
6
 
6
7
  def on_send(node)
7
8
  return unless node.arguments?
@@ -18,20 +19,18 @@ module RuboCop::Cop
18
19
  end
19
20
 
20
21
  def on_block(node)
21
- return if ignored_node?(node) || proper_block_style?(node)
22
+ return if ignored_node?(node) ||
23
+ proper_block_style?(node) ||
24
+ (!node.braces? && rescue_child_block?(node))
22
25
 
23
- add_offense(node, location: :begin)
24
- end
25
-
26
- def autocorrect(node)
27
- return if correction_would_break_code?(node)
26
+ add_offense(node.loc.begin, message: message(node)) do |corrector|
27
+ return if correction_would_break_code?(node)
28
28
 
29
- if node.single_line?
30
- replace_do_end_with_braces(node.loc)
31
- elsif node.braces?
32
- replace_braces_with_do_end(node.loc)
33
- else
34
- replace_do_end_with_braces(node.loc)
29
+ if node.braces?
30
+ replace_braces_with_do_end(corrector, node.loc)
31
+ else
32
+ replace_do_end_with_braces(corrector, node.loc)
33
+ end
35
34
  end
36
35
  end
37
36
 
@@ -47,29 +46,25 @@ module RuboCop::Cop
47
46
  end
48
47
  end
49
48
 
50
- def replace_braces_with_do_end(loc)
49
+ def replace_braces_with_do_end(corrector, loc)
51
50
  b = loc.begin
52
51
  e = loc.end
53
52
 
54
- lambda do |corrector|
55
- corrector.insert_before(b, " ") unless whitespace_before?(b)
56
- corrector.insert_before(e, " ") unless whitespace_before?(e)
57
- corrector.insert_after(b, " ") unless whitespace_after?(b)
58
- corrector.replace(b, "do")
59
- corrector.replace(e, "end")
60
- end
53
+ corrector.insert_before(b, " ") unless whitespace_before?(b)
54
+ corrector.insert_before(e, " ") unless whitespace_before?(e)
55
+ corrector.insert_after(b, " ") unless whitespace_after?(b)
56
+ corrector.replace(b, "do")
57
+ corrector.replace(e, "end")
61
58
  end
62
59
 
63
- def replace_do_end_with_braces(loc)
60
+ def replace_do_end_with_braces(corrector, loc)
64
61
  b = loc.begin
65
62
  e = loc.end
66
63
 
67
- lambda do |corrector|
68
- corrector.insert_after(b, " ") unless whitespace_after?(b, 2)
64
+ corrector.insert_after(b, " ") unless whitespace_after?(b, 2)
69
65
 
70
- corrector.replace(b, "{")
71
- corrector.replace(e, "}")
72
- end
66
+ corrector.replace(b, "{")
67
+ corrector.replace(e, "}")
73
68
  end
74
69
 
75
70
  def whitespace_before?(range)
@@ -118,7 +113,7 @@ module RuboCop::Cop
118
113
  end
119
114
 
120
115
  def rescue_child_block?(node)
121
- node.children.any?(&:rescue_type?)
116
+ node.children.any? { |node| node.rescue_type? || node.ensure_type? }
122
117
  end
123
118
 
124
119
  def non_parenthesized_keyword_args?(node)
@@ -1,3 +1,3 @@
1
1
  module Standard
2
- VERSION = Gem::Version.new("0.8.1")
2
+ VERSION = Gem::Version.new("0.11.0")
3
3
  end
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "rubocop", "1.0.0"
23
- spec.add_dependency "rubocop-performance", "1.8.1"
22
+ spec.add_dependency "rubocop", "1.7.0"
23
+ spec.add_dependency "rubocop-performance", "1.9.2"
24
24
 
25
25
  spec.add_development_dependency "bundler"
26
26
  spec.add_development_dependency "minitest", "~> 5.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: 1.7.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: 1.0.0
26
+ version: 1.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-performance
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.1
33
+ version: 1.9.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.1
40
+ version: 1.9.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubygems_version: 3.1.2
193
+ rubygems_version: 3.1.4
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Ruby Style Guide, with linter & automatic code fixer