rubocop-minitest 0.20.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +20 -0
- data/Rakefile +2 -6
- data/config/default.yml +6 -0
- data/docs/antora.yml +1 -1
- data/docs/modules/ROOT/pages/cops.adoc +1 -0
- data/docs/modules/ROOT/pages/cops_minitest.adoc +50 -12
- data/lib/rubocop/cop/generator.rb +1 -7
- data/lib/rubocop/cop/minitest/assert_in_delta.rb +1 -1
- data/lib/rubocop/cop/minitest/assert_predicate.rb +1 -1
- data/lib/rubocop/cop/minitest/assert_raises_compound_body.rb +45 -0
- data/lib/rubocop/cop/minitest/assert_silent.rb +1 -1
- data/lib/rubocop/cop/minitest/global_expectations.rb +12 -12
- data/lib/rubocop/cop/minitest/refute_equal.rb +1 -2
- data/lib/rubocop/cop/minitest/refute_in_delta.rb +1 -1
- data/lib/rubocop/cop/minitest/refute_predicate.rb +1 -1
- data/lib/rubocop/cop/minitest/unreachable_assertion.rb +1 -1
- data/lib/rubocop/cop/minitest_cops.rb +1 -0
- data/lib/rubocop/cop/mixin/argument_range_helper.rb +3 -12
- data/lib/rubocop/cop/mixin/predicate_assertion_handleable.rb +7 -6
- data/lib/rubocop/minitest/assert_offense.rb +1 -1
- data/lib/rubocop/minitest/version.rb +1 -1
- data/relnotes/v0.20.1.md +5 -0
- data/relnotes/v0.21.0.md +5 -0
- data/relnotes/v0.21.1.md +5 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/cops_documentation.rake +2 -2
- data/tasks/cut_release.rake +3 -8
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32fe1532cdbac42cfc34dd6be3ce6c06af43c58b0fdac50d4d0afafb92006db8
|
4
|
+
data.tar.gz: bfdd3899218529e728b777b77092103c1bf9db73523835666988d953a6b47f3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c4de4a42725e76f84de44313534b07a958f7c84ac5a63b8c7948b1edb9eadc27e81734721f7adda6b6b0b2d4a9e9ee8a90f9fa401fde7bd2faf799b229dded
|
7
|
+
data.tar.gz: 01d06e6462b2fc9f4dbdc133392d4b266a2df33ebac5ebbe042dd6d3185062bfd4df1017b4a3e255e12b56152284f2d2484668e650262907c9de3a3bccaee299
|
data/.rubocop.yml
CHANGED
@@ -31,6 +31,12 @@ Naming/InclusiveLanguage:
|
|
31
31
|
Enabled: true
|
32
32
|
CheckStrings: true
|
33
33
|
FlaggedTerms:
|
34
|
+
auto-correct:
|
35
|
+
Suggestions:
|
36
|
+
- autocorrect
|
37
|
+
auto_correct:
|
38
|
+
Suggestions:
|
39
|
+
- autocorrect
|
34
40
|
behaviour:
|
35
41
|
Suggestions:
|
36
42
|
- behavior
|
@@ -68,6 +74,9 @@ Layout/ClassStructure:
|
|
68
74
|
- protected_methods
|
69
75
|
- private_methods
|
70
76
|
|
77
|
+
Layout/RedundantLineBreak:
|
78
|
+
Enabled: true
|
79
|
+
|
71
80
|
# Trailing white space is meaningful in code examples
|
72
81
|
Layout/TrailingWhitespace:
|
73
82
|
AllowInHeredoc: true
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.21.1 (2022-08-28)
|
6
|
+
|
7
|
+
### Bug fixes
|
8
|
+
|
9
|
+
* [#178](https://github.com/rubocop/rubocop-minitest/pull/178): Fix incorrect documentation URLs when using `rubocop --show-docs-url`. ([@r7kamura][])
|
10
|
+
|
11
|
+
## 0.21.0 (2022-07-31)
|
12
|
+
|
13
|
+
### New features
|
14
|
+
|
15
|
+
* [#109](https://github.com/rubocop/rubocop-minitest/issues/109): Add new `Minitest/AssertRaisesCompoundBody` cop. ([@fatkodima][])
|
16
|
+
|
17
|
+
## 0.20.1 (2022-06-13)
|
18
|
+
|
19
|
+
### Bug fixes
|
20
|
+
|
21
|
+
* [#175](https://github.com/rubocop/rubocop-minitest/pull/175): Fix raise error when using assert with block. ([@ippachi][])
|
22
|
+
|
5
23
|
## 0.20.0 (2022-05-29)
|
6
24
|
|
7
25
|
### New features
|
@@ -314,3 +332,5 @@
|
|
314
332
|
[@gi]: https://github.com/gi
|
315
333
|
[@ignacio-chiazzo]: https://github.com/ignacio-chiazzo
|
316
334
|
[@gjtorikian]: https://github.com/gjtorikian
|
335
|
+
[@ippachi]: https://github.com/ippachi
|
336
|
+
[@r7kamura]: https://github.com/r7kamura
|
data/Rakefile
CHANGED
@@ -28,18 +28,14 @@ end
|
|
28
28
|
desc 'Run RuboCop over itself'
|
29
29
|
RuboCop::RakeTask.new(:internal_investigation)
|
30
30
|
|
31
|
-
task default: %i[
|
32
|
-
documentation_syntax_check
|
33
|
-
test
|
34
|
-
internal_investigation
|
35
|
-
]
|
31
|
+
task default: %i[documentation_syntax_check test internal_investigation]
|
36
32
|
|
37
33
|
desc 'Generate a new cop template'
|
38
34
|
task :new_cop, [:cop] do |_task, args|
|
39
35
|
require 'rubocop'
|
40
36
|
|
41
37
|
cop_name = args.fetch(:cop) do
|
42
|
-
warn
|
38
|
+
warn "usage: bundle exec rake 'new_cop[Department/Name]'"
|
43
39
|
exit!
|
44
40
|
end
|
45
41
|
|
data/config/default.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
Minitest:
|
2
2
|
Enabled: true
|
3
|
+
DocumentationBaseURL: https://docs.rubocop.org/rubocop-minitest
|
3
4
|
Include:
|
4
5
|
- '**/test/**/*'
|
5
6
|
- '**/*_test.rb'
|
@@ -76,6 +77,11 @@ Minitest/AssertPredicate:
|
|
76
77
|
Enabled: pending
|
77
78
|
VersionAdded: '0.18'
|
78
79
|
|
80
|
+
Minitest/AssertRaisesCompoundBody:
|
81
|
+
Description: 'This cop enforces the block body of `assert_raises { ... }` to be reduced to only the raising code.'
|
82
|
+
Enabled: pending
|
83
|
+
VersionAdded: '0.21'
|
84
|
+
|
79
85
|
Minitest/AssertRespondTo:
|
80
86
|
Description: 'This cop enforces the test to use `assert_respond_to(object, :do_something)` over `assert(object.respond_to?(:do_something))`.'
|
81
87
|
StyleGuide: 'https://minitest.rubystyle.guide#assert-responds-to-method'
|
data/docs/antora.yml
CHANGED
@@ -25,6 +25,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
|
|
25
25
|
* xref:cops_minitest.adoc#minitestassertoutput[Minitest/AssertOutput]
|
26
26
|
* xref:cops_minitest.adoc#minitestassertpathexists[Minitest/AssertPathExists]
|
27
27
|
* xref:cops_minitest.adoc#minitestassertpredicate[Minitest/AssertPredicate]
|
28
|
+
* xref:cops_minitest.adoc#minitestassertraisescompoundbody[Minitest/AssertRaisesCompoundBody]
|
28
29
|
* xref:cops_minitest.adoc#minitestassertrespondto[Minitest/AssertRespondTo]
|
29
30
|
* xref:cops_minitest.adoc#minitestassertsilent[Minitest/AssertSilent]
|
30
31
|
* xref:cops_minitest.adoc#minitestasserttruthy[Minitest/AssertTruthy]
|
@@ -379,6 +379,44 @@ assert_predicate(obj, :one?, 'message')
|
|
379
379
|
|
380
380
|
* https://minitest.rubystyle.guide/#assert-predicate
|
381
381
|
|
382
|
+
== Minitest/AssertRaisesCompoundBody
|
383
|
+
|
384
|
+
|===
|
385
|
+
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
|
386
|
+
|
387
|
+
| Pending
|
388
|
+
| Yes
|
389
|
+
| No
|
390
|
+
| 0.21
|
391
|
+
| -
|
392
|
+
|===
|
393
|
+
|
394
|
+
Enforces the block body of `assert_raises { ... }` to be reduced to only the raising code.
|
395
|
+
|
396
|
+
=== Examples
|
397
|
+
|
398
|
+
[source,ruby]
|
399
|
+
----
|
400
|
+
# bad
|
401
|
+
assert_raises(MyError) do
|
402
|
+
foo
|
403
|
+
bar
|
404
|
+
end
|
405
|
+
|
406
|
+
# good
|
407
|
+
assert_raises(MyError) do
|
408
|
+
foo
|
409
|
+
end
|
410
|
+
|
411
|
+
# good
|
412
|
+
assert_raises(MyError) do
|
413
|
+
foo do
|
414
|
+
bar
|
415
|
+
baz
|
416
|
+
end
|
417
|
+
end
|
418
|
+
----
|
419
|
+
|
382
420
|
== Minitest/AssertRespondTo
|
383
421
|
|
384
422
|
|===
|
@@ -619,7 +657,7 @@ and autocorrects them to use expect format.
|
|
619
657
|
|
620
658
|
=== Examples
|
621
659
|
|
622
|
-
==== EnforcedStyle:
|
660
|
+
==== EnforcedStyle: any (default)
|
623
661
|
|
624
662
|
[source,ruby]
|
625
663
|
----
|
@@ -628,6 +666,11 @@ musts.must_equal expected_musts
|
|
628
666
|
wonts.wont_match expected_wonts
|
629
667
|
musts.must_raise TypeError
|
630
668
|
|
669
|
+
# good
|
670
|
+
_(musts).must_equal expected_musts
|
671
|
+
_(wonts).wont_match expected_wonts
|
672
|
+
_ { musts }.must_raise TypeError
|
673
|
+
|
631
674
|
expect(musts).must_equal expected_musts
|
632
675
|
expect(wonts).wont_match expected_wonts
|
633
676
|
expect { musts }.must_raise TypeError
|
@@ -635,14 +678,9 @@ expect { musts }.must_raise TypeError
|
|
635
678
|
value(musts).must_equal expected_musts
|
636
679
|
value(wonts).wont_match expected_wonts
|
637
680
|
value { musts }.must_raise TypeError
|
638
|
-
|
639
|
-
# good
|
640
|
-
_(musts).must_equal expected_musts
|
641
|
-
_(wonts).wont_match expected_wonts
|
642
|
-
_ { musts }.must_raise TypeError
|
643
681
|
----
|
644
682
|
|
645
|
-
==== EnforcedStyle:
|
683
|
+
==== EnforcedStyle: _
|
646
684
|
|
647
685
|
[source,ruby]
|
648
686
|
----
|
@@ -651,11 +689,6 @@ musts.must_equal expected_musts
|
|
651
689
|
wonts.wont_match expected_wonts
|
652
690
|
musts.must_raise TypeError
|
653
691
|
|
654
|
-
# good
|
655
|
-
_(musts).must_equal expected_musts
|
656
|
-
_(wonts).wont_match expected_wonts
|
657
|
-
_ { musts }.must_raise TypeError
|
658
|
-
|
659
692
|
expect(musts).must_equal expected_musts
|
660
693
|
expect(wonts).wont_match expected_wonts
|
661
694
|
expect { musts }.must_raise TypeError
|
@@ -663,6 +696,11 @@ expect { musts }.must_raise TypeError
|
|
663
696
|
value(musts).must_equal expected_musts
|
664
697
|
value(wonts).wont_match expected_wonts
|
665
698
|
value { musts }.must_raise TypeError
|
699
|
+
|
700
|
+
# good
|
701
|
+
_(musts).must_equal expected_musts
|
702
|
+
_(wonts).wont_match expected_wonts
|
703
|
+
_ { musts }.must_raise TypeError
|
666
704
|
----
|
667
705
|
|
668
706
|
==== EnforcedStyle: expect
|
@@ -39,13 +39,7 @@ module RuboCop
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def test_path
|
42
|
-
File.join(
|
43
|
-
'test',
|
44
|
-
'rubocop',
|
45
|
-
'cop',
|
46
|
-
'minitest',
|
47
|
-
"#{snake_case(badge.cop_name.to_s)}_test.rb"
|
48
|
-
)
|
42
|
+
File.join('test', 'rubocop', 'cop', 'minitest', "#{snake_case(badge.cop_name.to_s)}_test.rb")
|
49
43
|
end
|
50
44
|
|
51
45
|
def generated_test
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
include InDeltaMixin
|
20
20
|
extend AutoCorrector
|
21
21
|
|
22
|
-
RESTRICT_ON_SEND = %i[assert_equal].freeze
|
22
|
+
RESTRICT_ON_SEND = %i[assert_equal].freeze # rubocop:disable InternalAffairs/UselessRestrictOnSend
|
23
23
|
|
24
24
|
def_node_matcher :equal_floats_call, <<~PATTERN
|
25
25
|
(send nil? :assert_equal $_ $_ $...)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Minitest
|
6
|
+
# Enforces the block body of `assert_raises { ... }` to be reduced to only the raising code.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # bad
|
10
|
+
# assert_raises(MyError) do
|
11
|
+
# foo
|
12
|
+
# bar
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# # good
|
16
|
+
# assert_raises(MyError) do
|
17
|
+
# foo
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# # good
|
21
|
+
# assert_raises(MyError) do
|
22
|
+
# foo do
|
23
|
+
# bar
|
24
|
+
# baz
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
class AssertRaisesCompoundBody < Base
|
29
|
+
MSG = 'Reduce `assert_raises` block body to contain only the raising code.'
|
30
|
+
|
31
|
+
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
|
32
|
+
return unless node.method?(:assert_raises) && multi_statement_begin?(node.body)
|
33
|
+
|
34
|
+
add_offense(node)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def multi_statement_begin?(node)
|
40
|
+
node.begin_type? && node.children.size > 1
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -6,12 +6,17 @@ module RuboCop
|
|
6
6
|
# Checks for deprecated global expectations
|
7
7
|
# and autocorrects them to use expect format.
|
8
8
|
#
|
9
|
-
# @example EnforcedStyle:
|
9
|
+
# @example EnforcedStyle: any (default)
|
10
10
|
# # bad
|
11
11
|
# musts.must_equal expected_musts
|
12
12
|
# wonts.wont_match expected_wonts
|
13
13
|
# musts.must_raise TypeError
|
14
14
|
#
|
15
|
+
# # good
|
16
|
+
# _(musts).must_equal expected_musts
|
17
|
+
# _(wonts).wont_match expected_wonts
|
18
|
+
# _ { musts }.must_raise TypeError
|
19
|
+
#
|
15
20
|
# expect(musts).must_equal expected_musts
|
16
21
|
# expect(wonts).wont_match expected_wonts
|
17
22
|
# expect { musts }.must_raise TypeError
|
@@ -20,22 +25,12 @@ module RuboCop
|
|
20
25
|
# value(wonts).wont_match expected_wonts
|
21
26
|
# value { musts }.must_raise TypeError
|
22
27
|
#
|
23
|
-
#
|
24
|
-
# _(musts).must_equal expected_musts
|
25
|
-
# _(wonts).wont_match expected_wonts
|
26
|
-
# _ { musts }.must_raise TypeError
|
27
|
-
#
|
28
|
-
# @example EnforcedStyle: any (default)
|
28
|
+
# @example EnforcedStyle: _
|
29
29
|
# # bad
|
30
30
|
# musts.must_equal expected_musts
|
31
31
|
# wonts.wont_match expected_wonts
|
32
32
|
# musts.must_raise TypeError
|
33
33
|
#
|
34
|
-
# # good
|
35
|
-
# _(musts).must_equal expected_musts
|
36
|
-
# _(wonts).wont_match expected_wonts
|
37
|
-
# _ { musts }.must_raise TypeError
|
38
|
-
#
|
39
34
|
# expect(musts).must_equal expected_musts
|
40
35
|
# expect(wonts).wont_match expected_wonts
|
41
36
|
# expect { musts }.must_raise TypeError
|
@@ -44,6 +39,11 @@ module RuboCop
|
|
44
39
|
# value(wonts).wont_match expected_wonts
|
45
40
|
# value { musts }.must_raise TypeError
|
46
41
|
#
|
42
|
+
# # good
|
43
|
+
# _(musts).must_equal expected_musts
|
44
|
+
# _(wonts).wont_match expected_wonts
|
45
|
+
# _ { musts }.must_raise TypeError
|
46
|
+
#
|
47
47
|
# @example EnforcedStyle: expect
|
48
48
|
# # bad
|
49
49
|
# musts.must_equal expected_musts
|
@@ -44,8 +44,7 @@ module RuboCop
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def preferred_usage(first_arg, second_arg, custom_message = nil)
|
47
|
-
[first_arg, second_arg, custom_message]
|
48
|
-
.compact.map(&:source).join(', ')
|
47
|
+
[first_arg, second_arg, custom_message].compact.map(&:source).join(', ')
|
49
48
|
end
|
50
49
|
|
51
50
|
def original_usage(first_part, custom_message)
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
include InDeltaMixin
|
20
20
|
extend AutoCorrector
|
21
21
|
|
22
|
-
RESTRICT_ON_SEND = %i[refute_equal].freeze
|
22
|
+
RESTRICT_ON_SEND = %i[refute_equal].freeze # rubocop:disable InternalAffairs/UselessRestrictOnSend
|
23
23
|
|
24
24
|
def_node_matcher :equal_floats_call, <<~PATTERN
|
25
25
|
(send nil? :refute_equal $_ $_ $...)
|
@@ -25,7 +25,7 @@ module RuboCop
|
|
25
25
|
|
26
26
|
MSG = 'Unreachable `%<assertion_method>s` detected.'
|
27
27
|
|
28
|
-
def on_block(node)
|
28
|
+
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
|
29
29
|
return unless node.method?(:assert_raises) && (body = node.body)
|
30
30
|
|
31
31
|
last_node = body.begin_type? ? body.children.last : body
|
@@ -11,6 +11,7 @@ require_relative 'minitest/assert_empty_literal'
|
|
11
11
|
require_relative 'minitest/assert_equal'
|
12
12
|
require_relative 'minitest/assert_in_delta'
|
13
13
|
require_relative 'minitest/assert_predicate'
|
14
|
+
require_relative 'minitest/assert_raises_compound_body'
|
14
15
|
require_relative 'minitest/assert_with_expected_argument'
|
15
16
|
require_relative 'minitest/assertion_in_lifecycle_hook'
|
16
17
|
require_relative 'minitest/assert_kind_of'
|
@@ -11,30 +11,21 @@ module RuboCop
|
|
11
11
|
def first_argument_range(node)
|
12
12
|
first_argument = node.first_argument
|
13
13
|
|
14
|
-
range_between(
|
15
|
-
first_argument.source_range.begin_pos,
|
16
|
-
first_argument.source_range.end_pos
|
17
|
-
)
|
14
|
+
range_between(first_argument.source_range.begin_pos, first_argument.source_range.end_pos)
|
18
15
|
end
|
19
16
|
|
20
17
|
def first_and_second_arguments_range(node)
|
21
18
|
first_argument = node.first_argument
|
22
19
|
second_argument = node.arguments[1]
|
23
20
|
|
24
|
-
range_between(
|
25
|
-
first_argument.source_range.begin_pos,
|
26
|
-
second_argument.source_range.end_pos
|
27
|
-
)
|
21
|
+
range_between(first_argument.source_range.begin_pos, second_argument.source_range.end_pos)
|
28
22
|
end
|
29
23
|
|
30
24
|
def all_arguments_range(node)
|
31
25
|
first_argument = node.first_argument
|
32
26
|
last_argument = node.arguments.last
|
33
27
|
|
34
|
-
range_between(
|
35
|
-
first_argument.source_range.begin_pos,
|
36
|
-
last_argument.source_range.end_pos
|
37
|
-
)
|
28
|
+
range_between(first_argument.source_range.begin_pos, last_argument.source_range.end_pos)
|
38
29
|
end
|
39
30
|
end
|
40
31
|
end
|
@@ -6,15 +6,15 @@ module RuboCop
|
|
6
6
|
# Common functionality for `Minitest/AssertPredicate` and `Minitest/RefutePredicate` cops.
|
7
7
|
module PredicateAssertionHandleable
|
8
8
|
MSG = 'Prefer using `%<assertion_type>s_predicate(%<new_arguments>s)`.'
|
9
|
-
RESTRICT_ON_SEND = %i[assert].freeze
|
10
9
|
|
11
10
|
def on_send(node)
|
12
11
|
return unless (arguments = peel_redundant_parentheses_from(node.arguments))
|
13
12
|
|
14
13
|
first_argument = arguments.first
|
15
14
|
|
15
|
+
return unless first_argument
|
16
16
|
return if first_argument.block_type? || first_argument.numblock_type?
|
17
|
-
return unless
|
17
|
+
return unless predicate_method?(first_argument)
|
18
18
|
return unless first_argument.arguments.count.zero?
|
19
19
|
|
20
20
|
add_offense(node, message: offense_message(arguments)) do |corrector|
|
@@ -38,13 +38,14 @@ module RuboCop
|
|
38
38
|
peel_redundant_parentheses_from(arguments.first.children)
|
39
39
|
end
|
40
40
|
|
41
|
+
def predicate_method?(first_argument)
|
42
|
+
first_argument.respond_to?(:predicate_method?) && first_argument.predicate_method?
|
43
|
+
end
|
44
|
+
|
41
45
|
def offense_message(arguments)
|
42
46
|
message_argument = arguments.last if arguments.first != arguments.last
|
43
47
|
|
44
|
-
new_arguments = [
|
45
|
-
new_arguments(arguments),
|
46
|
-
message_argument&.source
|
47
|
-
].flatten.compact.join(', ')
|
48
|
+
new_arguments = [new_arguments(arguments), message_argument&.source].flatten.compact.join(', ')
|
48
49
|
|
49
50
|
format(MSG, assertion_type: assertion_type, new_arguments: new_arguments)
|
50
51
|
end
|
data/relnotes/v0.20.1.md
ADDED
data/relnotes/v0.21.0.md
ADDED
data/relnotes/v0.21.1.md
ADDED
data/tasks/changelog.rb
CHANGED
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
desc 'Syntax check for the documentation comments'
|
24
24
|
task documentation_syntax_check: :yard_for_generate_documentation do
|
25
|
-
require 'parser/
|
25
|
+
require 'parser/ruby31'
|
26
26
|
|
27
27
|
ok = true
|
28
28
|
YARD::Registry.load!
|
@@ -37,7 +37,7 @@ task documentation_syntax_check: :yard_for_generate_documentation do
|
|
37
37
|
examples.to_a.each do |example|
|
38
38
|
buffer = Parser::Source::Buffer.new('<code>', 1)
|
39
39
|
buffer.source = example.text
|
40
|
-
parser = Parser::
|
40
|
+
parser = Parser::Ruby31.new(RuboCop::AST::Builder.new)
|
41
41
|
parser.diagnostics.all_errors_are_fatal = true
|
42
42
|
parser.parse(buffer)
|
43
43
|
rescue Parser::SyntaxError => e
|
data/tasks/cut_release.rake
CHANGED
@@ -38,10 +38,7 @@ namespace :cut_release do
|
|
38
38
|
antora_metadata = File.read('docs/antora.yml')
|
39
39
|
|
40
40
|
File.open('docs/antora.yml', 'w') do |f|
|
41
|
-
f << antora_metadata.sub(
|
42
|
-
"version: 'master'",
|
43
|
-
"version: '#{version_sans_patch(new_version)}'"
|
44
|
-
)
|
41
|
+
f << antora_metadata.sub('version: ~', "version: '#{version_sans_patch(new_version)}'")
|
45
42
|
end
|
46
43
|
end
|
47
44
|
|
@@ -52,8 +49,7 @@ namespace :cut_release do
|
|
52
49
|
# Replace `<<next>>` (and variations) with version being cut.
|
53
50
|
def update_cop_versions(_old_version, new_version)
|
54
51
|
update_file('config/default.yml') do |default|
|
55
|
-
default.gsub(/['"]?<<\s*next\s*>>['"]?/i,
|
56
|
-
"'#{version_sans_patch(new_version)}'")
|
52
|
+
default.gsub(/['"]?<<\s*next\s*>>['"]?/i, "'#{version_sans_patch(new_version)}'")
|
57
53
|
end
|
58
54
|
end
|
59
55
|
|
@@ -70,8 +66,7 @@ namespace :cut_release do
|
|
70
66
|
|
71
67
|
def user_links(text)
|
72
68
|
names = text.scan(/\[@(\S+)\]\[\]/).map(&:first).uniq
|
73
|
-
names.map { |name| "[@#{name}]: https://github.com/#{name}" }
|
74
|
-
.join("\n")
|
69
|
+
names.map { |name| "[@#{name}]: https://github.com/#{name}" }.join("\n")
|
75
70
|
end
|
76
71
|
|
77
72
|
def run(release_type)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/rubocop/cop/minitest/assert_output.rb
|
104
104
|
- lib/rubocop/cop/minitest/assert_path_exists.rb
|
105
105
|
- lib/rubocop/cop/minitest/assert_predicate.rb
|
106
|
+
- lib/rubocop/cop/minitest/assert_raises_compound_body.rb
|
106
107
|
- lib/rubocop/cop/minitest/assert_respond_to.rb
|
107
108
|
- lib/rubocop/cop/minitest/assert_silent.rb
|
108
109
|
- lib/rubocop/cop/minitest/assert_truthy.rb
|
@@ -167,6 +168,9 @@ files:
|
|
167
168
|
- relnotes/v0.2.0.md
|
168
169
|
- relnotes/v0.2.1.md
|
169
170
|
- relnotes/v0.20.0.md
|
171
|
+
- relnotes/v0.20.1.md
|
172
|
+
- relnotes/v0.21.0.md
|
173
|
+
- relnotes/v0.21.1.md
|
170
174
|
- relnotes/v0.3.0.md
|
171
175
|
- relnotes/v0.4.0.md
|
172
176
|
- relnotes/v0.4.1.md
|
@@ -191,7 +195,7 @@ metadata:
|
|
191
195
|
homepage_uri: https://docs.rubocop.org/rubocop-minitest/
|
192
196
|
changelog_uri: https://github.com/rubocop/rubocop-minitest/blob/master/CHANGELOG.md
|
193
197
|
source_code_uri: https://github.com/rubocop/rubocop-minitest
|
194
|
-
documentation_uri: https://docs.rubocop.org/rubocop-minitest/0.
|
198
|
+
documentation_uri: https://docs.rubocop.org/rubocop-minitest/0.21
|
195
199
|
bug_tracker_uri: https://github.com/rubocop/rubocop-minitest/issues
|
196
200
|
rubygems_mfa_required: 'true'
|
197
201
|
post_install_message:
|