rubocop-minitest 0.17.0 → 0.17.1
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 +4 -4
- data/.circleci/config.yml +7 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +2 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +1 -1
- data/docs/modules/ROOT/pages/installation.adoc +1 -1
- data/lib/rubocop/cop/minitest/assertion_in_lifecycle_hook.rb +1 -1
- data/lib/rubocop/cop/minitest/multiple_assertions.rb +1 -1
- data/lib/rubocop/cop/minitest/no_assertions.rb +1 -1
- data/lib/rubocop/cop/minitest/unreachable_assertion.rb +2 -4
- data/lib/rubocop/cop/mixin/minitest_exploration_helpers.rb +9 -21
- data/lib/rubocop/minitest/version.rb +1 -1
- data/mkdocs.yml +1 -1
- data/relnotes/v0.17.1.md +5 -0
- data/tasks/cops_documentation.rake +5 -5
- data/tasks/cut_release.rake +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06bac8581123850a3beb2e5f9e740279d6ef05889119afd4418d1d079b357b6e
|
4
|
+
data.tar.gz: e0257e30d0b413979b7ce990beae6fc685e3f12161f97ed3fc8391dd023544b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a358ed867fb7a16f3430835a11560c1159940c67b66627db9116d4cf6c45efd2519701f93c8333ed722d1c296bd527ea7b52c970ba472056b7170f363d95ae05
|
7
|
+
data.tar.gz: a22c800e537e5461cb7446d88e60e3a73f7ac63119c72d4acc32d72707670550b16cb7e1f015668d35dcca7a746f947f93df2a4ee6db571ad23f0f0c17766475
|
data/.circleci/config.yml
CHANGED
@@ -37,16 +37,19 @@ workflows:
|
|
37
37
|
- documentation-checks
|
38
38
|
- rake_default:
|
39
39
|
name: Ruby 2.5
|
40
|
-
image:
|
40
|
+
image: cimg/ruby:2.5
|
41
41
|
- rake_default:
|
42
42
|
name: Ruby 2.6
|
43
|
-
image:
|
43
|
+
image: cimg/ruby:2.6
|
44
44
|
- rake_default:
|
45
45
|
name: Ruby 2.7
|
46
|
-
image:
|
46
|
+
image: cimg/ruby:2.7
|
47
47
|
- rake_default:
|
48
48
|
name: Ruby 3.0
|
49
|
-
image:
|
49
|
+
image: cimg/ruby:3.0
|
50
|
+
- rake_default:
|
51
|
+
name: Ruby 3.1
|
52
|
+
image: cimg/ruby:3.1
|
50
53
|
- rake_default:
|
51
54
|
name: Ruby HEAD
|
52
55
|
image: rubocophq/circleci-ruby-snapshot:latest # Nightly snapshot build
|
@@ -5,14 +5,13 @@ The more detailed you are, the better.**
|
|
5
5
|
|
6
6
|
Before submitting the PR make sure the following are checked:
|
7
7
|
|
8
|
+
* [ ] The PR relates to *only* one subject with a clear title and description in grammatically correct, complete sentences.
|
8
9
|
* [ ] Wrote [good commit messages][1].
|
9
10
|
* [ ] Commit message starts with `[Fix #issue-number]` (if the related issue exists).
|
10
11
|
* [ ] Feature branch is up-to-date with `master` (if not - rebase it).
|
11
12
|
* [ ] Squashed related commits together.
|
12
13
|
* [ ] Added tests.
|
14
|
+
* [ ] Ran `bundle exec rake default`. It executes all tests and runs RuboCop on its own code.
|
13
15
|
* [ ] Added an entry (file) to the [changelog folder](https://github.com/rubocop/rubocop-minitest/blob/master/changelog/) named `{change_type}_{change_description}.md` if the new code introduces user-observable changes. See [changelog entry format](https://github.com/rubocop/rubocop/blob/master/CONTRIBUTING.md#changelog-entry-format) for details.
|
14
|
-
* [ ] The PR relates to *only* one subject with a clear title
|
15
|
-
and description in grammatically correct, complete sentences.
|
16
|
-
* [ ] Run `bundle exec rake default`. It executes all tests and RuboCop for itself, and generates the documentation.
|
17
16
|
|
18
17
|
[1]: https://chris.beams.io/posts/git-commit/
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.17.1 (2022-01-30)
|
6
|
+
|
7
|
+
### Changes
|
8
|
+
|
9
|
+
* [#158](https://github.com/rubocop/rubocop-minitest/pull/158): Make `Minitest/UnreachableAssertion` aware of `assert` and `refute` prefix methods. ([@koic][])
|
10
|
+
|
5
11
|
## 0.17.0 (2021-11-23)
|
6
12
|
|
7
13
|
### New features
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019-
|
3
|
+
Copyright (c) 2019-2022 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/Rakefile
CHANGED
@@ -48,7 +48,7 @@ task :new_cop, [:cop] do |_task, args|
|
|
48
48
|
generator.write_source
|
49
49
|
generator.write_test
|
50
50
|
generator.inject_require(root_file_path: 'lib/rubocop/cop/minitest_cops.rb')
|
51
|
-
generator.inject_config(config_file_path: 'config/default.yml'
|
51
|
+
generator.inject_config(config_file_path: 'config/default.yml')
|
52
52
|
|
53
53
|
puts generator.todo
|
54
54
|
end
|
@@ -30,7 +30,7 @@ module RuboCop
|
|
30
30
|
|
31
31
|
lifecycle_hooks(class_node).each do |hook_node|
|
32
32
|
hook_node.each_descendant(:send) do |node|
|
33
|
-
if
|
33
|
+
if assertion_method?(node)
|
34
34
|
message = format(MSG, assertion: node.method_name, hook: hook_node.method_name)
|
35
35
|
add_offense(node, message: message)
|
36
36
|
end
|
@@ -30,11 +30,9 @@ module RuboCop
|
|
30
30
|
|
31
31
|
last_node = body.begin_type? ? body.children.last : body
|
32
32
|
return unless last_node.send_type?
|
33
|
+
return unless assertion_method?(last_node)
|
33
34
|
|
34
|
-
|
35
|
-
return unless assertion_method?(method_name)
|
36
|
-
|
37
|
-
add_offense(last_node, message: format(MSG, assertion_method: method_name))
|
35
|
+
add_offense(last_node, message: format(MSG, assertion_method: last_node.method_name))
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
@@ -10,17 +10,6 @@ module RuboCop
|
|
10
10
|
|
11
11
|
ASSERTION_PREFIXES = %w[assert refute].freeze
|
12
12
|
|
13
|
-
ASSERTION_METHODS = %i[
|
14
|
-
assert assert_empty assert_equal assert_in_delta assert_in_epsilon assert_includes assert_instance_of
|
15
|
-
assert_kind_of assert_match assert_nil assert_operator assert_output assert_path_exists assert_predicate
|
16
|
-
assert_raises assert_respond_to assert_same assert_send assert_silent assert_throws
|
17
|
-
refute refute_empty refute_equal refute_in_delta refute_in_epsilon refute_includes refute_instance_of
|
18
|
-
refute_kind_of refute_match refute_nil refute_operator refute_path_exists refute_predicate
|
19
|
-
refute_respond_to refute_same
|
20
|
-
].freeze
|
21
|
-
|
22
|
-
FLUNK = 'flunk'
|
23
|
-
|
24
13
|
LIFECYCLE_HOOK_METHODS = %i[
|
25
14
|
before_setup
|
26
15
|
setup
|
@@ -84,19 +73,18 @@ module RuboCop
|
|
84
73
|
method_def.each_child_node(:send)
|
85
74
|
end
|
86
75
|
|
87
|
-
send_nodes.select { |send_node|
|
76
|
+
send_nodes.select { |send_node| assertion_method?(send_node) }
|
88
77
|
end
|
89
78
|
|
90
|
-
def
|
91
|
-
node.send_type?
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
96
|
-
end
|
79
|
+
def assertion_method?(node)
|
80
|
+
return false unless node.send_type?
|
81
|
+
|
82
|
+
ASSERTION_PREFIXES.any? do |prefix|
|
83
|
+
method_name = node.method_name
|
97
84
|
|
98
|
-
|
99
|
-
|
85
|
+
# TODO: Remove the fllowing `to_s` since Ruby 2.7 that supports `Symbol#start_with?`.
|
86
|
+
method_name.to_s.start_with?(prefix) || node.method?(:flunk)
|
87
|
+
end
|
100
88
|
end
|
101
89
|
|
102
90
|
def lifecycle_hook_method?(node)
|
data/mkdocs.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
site_name: "A RuboCop extension focused on enforcing Minitest best practices and coding conventions."
|
2
2
|
repo_url: https://github.com/rubocop/rubocop-minitest
|
3
3
|
edit_uri: edit/master/legacy-docs/
|
4
|
-
copyright: "Copyright ©
|
4
|
+
copyright: "Copyright © 2022 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO, and RuboCop contributors"
|
5
5
|
docs_dir: legacy-docs
|
6
6
|
pages:
|
7
7
|
- Home: index.md
|
data/relnotes/v0.17.1.md
ADDED
@@ -12,12 +12,12 @@ end
|
|
12
12
|
|
13
13
|
task update_cops_documentation: :yard_for_generate_documentation do
|
14
14
|
deps = ['Minitest']
|
15
|
-
CopsDocumentationGenerator.new(departments: deps).call
|
16
|
-
end
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
# NOTE: Update `<<next>>` version for docs/modules/ROOT/pages/cops_minitest.adoc
|
17
|
+
# when running release tasks.
|
18
|
+
RuboCop::Minitest::Inject.defaults!
|
19
|
+
|
20
|
+
CopsDocumentationGenerator.new(departments: deps).call
|
21
21
|
end
|
22
22
|
|
23
23
|
desc 'Syntax check for the documentation comments'
|
data/tasks/cut_release.rake
CHANGED
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.17.
|
4
|
+
version: 0.17.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:
|
13
|
+
date: 2022-01-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- relnotes/v0.15.2.md
|
153
153
|
- relnotes/v0.16.0.md
|
154
154
|
- relnotes/v0.17.0.md
|
155
|
+
- relnotes/v0.17.1.md
|
155
156
|
- relnotes/v0.2.0.md
|
156
157
|
- relnotes/v0.2.1.md
|
157
158
|
- relnotes/v0.3.0.md
|
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
197
|
- !ruby/object:Gem::Version
|
197
198
|
version: '0'
|
198
199
|
requirements: []
|
199
|
-
rubygems_version: 3.3.
|
200
|
+
rubygems_version: 3.3.3
|
200
201
|
signing_key:
|
201
202
|
specification_version: 4
|
202
203
|
summary: Automatic Minitest code style checking tool.
|