rubocop-minitest 0.15.0 → 0.17.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 +4 -4
- data/.circleci/config.yml +2 -5
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
- data/.github/workflows/spell_checking.yml +33 -0
- data/.rubocop.yml +6 -6
- data/.rubocop_todo.yml +2 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +30 -0
- data/CONTRIBUTING.md +3 -2
- data/Gemfile +1 -1
- data/Rakefile +4 -11
- data/codespell.txt +0 -0
- data/config/default.yml +13 -2
- data/docs/antora.yml +1 -1
- data/docs/modules/ROOT/pages/cops_minitest.adoc +133 -38
- data/lib/rubocop/cop/minitest/assert_empty.rb +12 -0
- data/lib/rubocop/cop/minitest/assert_empty_literal.rb +1 -1
- data/lib/rubocop/cop/minitest/assert_with_expected_argument.rb +3 -2
- data/lib/rubocop/cop/minitest/global_expectations.rb +109 -38
- data/lib/rubocop/cop/minitest/literal_as_actual_argument.rb +4 -5
- data/lib/rubocop/cop/minitest/refute_empty.rb +12 -0
- data/lib/rubocop/minitest/assert_offense.rb +183 -0
- data/lib/rubocop/minitest/support.rb +10 -0
- data/lib/rubocop/minitest/version.rb +1 -1
- data/relnotes/v0.15.1.md +5 -0
- data/relnotes/v0.15.2.md +5 -0
- data/relnotes/v0.16.0.md +11 -0
- data/relnotes/v0.17.0.md +5 -0
- data/rubocop-minitest.gemspec +2 -1
- data/tasks/changelog.rake +34 -0
- data/tasks/changelog.rb +166 -0
- data/tasks/cops_documentation.rake +4 -14
- data/tasks/cut_release.rake +18 -3
- metadata +16 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04d27399103835be508a28975344afe09018c9f480217824f65c0c43be34b3d
|
4
|
+
data.tar.gz: 3021b9fa8b826d056b69d2c91b6d447dc66a3acecc82bf439a2931e6f25ea9f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61ae0ab74e4a736221044989b3ef08e5c743b6cd43024c6ed236e276a4fefb0ec6c3fd23232f401ef205d0db5e8575c8cb1b85b31186a8e26c7be031e65f9772
|
7
|
+
data.tar.gz: a574a9d994741b69bf4280b91ef7321498aeeaec391cdfee7784230baf55a0d45bf4013a8395418b96b442a39fb13b5a33fa23b8bb03d2cce92bb77c040317c9
|
data/.circleci/config.yml
CHANGED
@@ -30,9 +30,6 @@ jobs:
|
|
30
30
|
- run:
|
31
31
|
name: Check documentation syntax
|
32
32
|
command: bundle exec rake documentation_syntax_check
|
33
|
-
- run:
|
34
|
-
name: Build documentation and verify that doc files are in sync
|
35
|
-
command: bundle exec rake verify_cops_documentation
|
36
33
|
|
37
34
|
workflows:
|
38
35
|
build:
|
@@ -54,5 +51,5 @@ workflows:
|
|
54
51
|
name: Ruby HEAD
|
55
52
|
image: rubocophq/circleci-ruby-snapshot:latest # Nightly snapshot build
|
56
53
|
- rake_default:
|
57
|
-
name: JRuby 9.
|
58
|
-
image: circleci/jruby:9.
|
54
|
+
name: JRuby 9.3
|
55
|
+
image: circleci/jruby:9.3
|
@@ -10,7 +10,7 @@ Before submitting the PR make sure the following are checked:
|
|
10
10
|
* [ ] Feature branch is up-to-date with `master` (if not - rebase it).
|
11
11
|
* [ ] Squashed related commits together.
|
12
12
|
* [ ] Added tests.
|
13
|
-
* [ ] Added an entry to the [
|
13
|
+
* [ ] 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
14
|
* [ ] The PR relates to *only* one subject with a clear title
|
15
15
|
and description in grammatically correct, complete sentences.
|
16
16
|
* [ ] Run `bundle exec rake default`. It executes all tests and RuboCop for itself, and generates the documentation.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Spell Checking
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
codespell:
|
7
|
+
name: Check spelling of all files with codespell
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
python-version: [3.8]
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Set up Python ${{ matrix.python-version }}
|
15
|
+
uses: actions/setup-python@v2
|
16
|
+
with:
|
17
|
+
python-version: ${{ matrix.python-version }}
|
18
|
+
- name: Install dependencies
|
19
|
+
run: |
|
20
|
+
python -m pip install --upgrade pip
|
21
|
+
pip install codespell
|
22
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
23
|
+
- name: Check spelling with codespell
|
24
|
+
run: codespell --ignore-words=codespell.txt || exit 1
|
25
|
+
misspell:
|
26
|
+
name: Check spelling of all files in commit with misspell
|
27
|
+
runs-on: ubuntu-latest
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v2
|
30
|
+
- name: Install
|
31
|
+
run: wget -O - -q https://git.io/misspell | sh -s -- -b .
|
32
|
+
- name: Misspell
|
33
|
+
run: git ls-files --empty-directory | xargs ./misspell -error
|
data/.rubocop.yml
CHANGED
@@ -15,6 +15,10 @@ AllCops:
|
|
15
15
|
InternalAffairs/NodeMatcherDirective:
|
16
16
|
Enabled: false
|
17
17
|
|
18
|
+
# FIXME: Workaround for a false positive caused by this cop when using `bundle exec rake`.
|
19
|
+
InternalAffairs/UndefinedConfig:
|
20
|
+
Enabled: false
|
21
|
+
|
18
22
|
Naming/PredicateName:
|
19
23
|
# Method define macros for dynamically generated method.
|
20
24
|
MethodDefinitionMacros:
|
@@ -38,6 +42,7 @@ Style/FormatStringToken:
|
|
38
42
|
Metrics/ClassLength:
|
39
43
|
Exclude:
|
40
44
|
- test/**/*
|
45
|
+
- tasks/changelog.rb
|
41
46
|
|
42
47
|
Layout/EndOfLine:
|
43
48
|
EnforcedStyle: lf
|
@@ -75,14 +80,12 @@ Lint/UselessAccessModifier:
|
|
75
80
|
- 'def_matcher'
|
76
81
|
- 'def_node_matcher'
|
77
82
|
|
78
|
-
Lint/BooleanSymbol:
|
79
|
-
Enabled: false
|
80
|
-
|
81
83
|
Metrics/BlockLength:
|
82
84
|
Exclude:
|
83
85
|
- 'Rakefile'
|
84
86
|
- '**/*.rake'
|
85
87
|
- 'test/**/*.rb'
|
88
|
+
- 'rubocop-minitest.gemspec'
|
86
89
|
|
87
90
|
Naming/FileName:
|
88
91
|
Exclude:
|
@@ -91,6 +94,3 @@ Naming/FileName:
|
|
91
94
|
Metrics/ModuleLength:
|
92
95
|
Exclude:
|
93
96
|
- 'test/**/*.rb'
|
94
|
-
|
95
|
-
Performance/ChainArrayAllocation:
|
96
|
-
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,35 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.17.0 (2021-11-23)
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
* [#155](https://github.com/rubocop/rubocop-minitest/issues/155): Provide `assert_offense`, `assert_correction`, and `assert_no_offenses` testing APIs for custom Minitest cop development. ([@koic][])
|
10
|
+
|
11
|
+
## 0.16.0 (2021-11-14)
|
12
|
+
|
13
|
+
### New features
|
14
|
+
|
15
|
+
* [#147](https://github.com/rubocop/rubocop-minitest/issues/147): Add `EnforcedStyle` config parameter for `Minitest/GlobalExpectations`. ([@gi][])
|
16
|
+
|
17
|
+
### Bug fixes
|
18
|
+
|
19
|
+
* [#142](https://github.com/rubocop/rubocop-minitest/issues/142): Fix `Minitest/GlobalExpectations` autocorrect when receiver is lambda. ([@gi][])
|
20
|
+
* [#150](https://github.com/rubocop/rubocop-minitest/issues/150): Fix a false positive for `Minitest/AssertEmpty` and `RefuteEmpty` cops when using `empty` method with any arguments. ([@koic][])
|
21
|
+
|
22
|
+
## 0.15.2 (2021-10-11)
|
23
|
+
|
24
|
+
### Bug fixes
|
25
|
+
|
26
|
+
* [#145](https://github.com/rubocop/rubocop-minitest/pull/145): Mark `Minitest/AssertEmptyLiteral` as safe auto-correction. ([@koic][])
|
27
|
+
|
28
|
+
## 0.15.1 (2021-09-26)
|
29
|
+
|
30
|
+
### Bug fixes
|
31
|
+
|
32
|
+
* [#143](https://github.com/rubocop/rubocop-minitest/issues/143): Fix an error for `Minitest/LiteralAsActualArgumentTest` when expected and actual arguments are literals. ([@koic][])
|
33
|
+
|
5
34
|
## 0.15.0 (2021-08-09)
|
6
35
|
|
7
36
|
### New features
|
@@ -234,3 +263,4 @@
|
|
234
263
|
[@tsmmark]: https://github.com/tsmmark
|
235
264
|
[@cstyles]: https://github.com/cstyles
|
236
265
|
[@ghiculescu]: https://github.com/ghiculescu
|
266
|
+
[@gi]: https://github.com/gi
|
data/CONTRIBUTING.md
CHANGED
@@ -33,7 +33,7 @@ $ rubocop -V
|
|
33
33
|
* If your change has a corresponding open GitHub issue, prefix the commit message with `[Fix #github-issue-number]`.
|
34
34
|
* Make sure to add tests for it. This is important so I don't break it
|
35
35
|
in a future version unintentionally.
|
36
|
-
* Add an entry to the [Changelog](CHANGELOG.md)
|
36
|
+
* Add an entry to the [Changelog](CHANGELOG.md) by creating a file `changelog/{type}_{some_description}.md`. See [changelog entry format](#changelog-entry-format) for details.
|
37
37
|
* Please try not to mess with the Rakefile, version, or history. If
|
38
38
|
you want to have your own version, or is otherwise necessary, that
|
39
39
|
is fine, but please isolate to its own commit so I can cherry-pick
|
@@ -53,12 +53,13 @@ Here are a few examples:
|
|
53
53
|
* New cop `ElseLayout` checks for odd arrangement of code in the `else` branch of a conditional expression. ([@bbatsov][])
|
54
54
|
```
|
55
55
|
|
56
|
+
* Create one file `changelog/{type}_{some_description}.md`, where `type` is `new` (New feature), `fix` or `change`, and `some_description` is unique to avoid conflicts. Task `changelog:fix` (or `:new` or `:change`) can help you.
|
56
57
|
* Mark it up in [Markdown syntax][6].
|
57
58
|
* The entry line should start with `* ` (an asterisk and a space).
|
58
59
|
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/rubocop/rubocop-minitest/issues/123): `.
|
59
60
|
* Describe the brief of the change. The sentence should end with a punctuation.
|
60
61
|
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
|
61
|
-
*
|
62
|
+
* Alternatively, you may modify the CHANGELOG file directly, but this may result in conflicts later on. Also, if this is your first contribution to RuboCop Minitest project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.
|
62
63
|
|
63
64
|
[1]: https://github.com/rubocop/rubocop-minitest/issues
|
64
65
|
[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
task release: 'changelog:check_clean' # Before task is required
|
4
|
+
|
3
5
|
require 'bundler'
|
4
6
|
require 'bundler/gem_tasks'
|
5
7
|
|
@@ -24,16 +26,10 @@ Rake::TestTask.new do |t|
|
|
24
26
|
end
|
25
27
|
|
26
28
|
desc 'Run RuboCop over itself'
|
27
|
-
RuboCop::RakeTask.new(:internal_investigation)
|
28
|
-
if RUBY_ENGINE == 'ruby' &&
|
29
|
-
RbConfig::CONFIG['host_os'] !~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
30
|
-
task.options = %w[--parallel]
|
31
|
-
end
|
32
|
-
end
|
29
|
+
RuboCop::RakeTask.new(:internal_investigation)
|
33
30
|
|
34
31
|
task default: %i[
|
35
32
|
documentation_syntax_check
|
36
|
-
generate_cops_documentation
|
37
33
|
test
|
38
34
|
internal_investigation
|
39
35
|
]
|
@@ -47,10 +43,7 @@ task :new_cop, [:cop] do |_task, args|
|
|
47
43
|
exit!
|
48
44
|
end
|
49
45
|
|
50
|
-
|
51
|
-
github_user = 'your_id' if github_user.empty?
|
52
|
-
|
53
|
-
generator = RuboCop::Cop::Generator.new(cop_name, github_user)
|
46
|
+
generator = RuboCop::Cop::Generator.new(cop_name)
|
54
47
|
|
55
48
|
generator.write_source
|
56
49
|
generator.write_test
|
data/codespell.txt
ADDED
File without changes
|
data/config/default.yml
CHANGED
@@ -11,9 +11,8 @@ Minitest/AssertEmpty:
|
|
11
11
|
VersionAdded: '0.2'
|
12
12
|
|
13
13
|
Minitest/AssertEmptyLiteral:
|
14
|
-
Description: 'This cop enforces the test to use `assert_empty` instead of using `
|
14
|
+
Description: 'This cop enforces the test to use `assert_empty` instead of using `assert_equal([], object)`.'
|
15
15
|
Enabled: true
|
16
|
-
SafeAutoCorrect: false
|
17
16
|
VersionAdded: '0.5'
|
18
17
|
VersionChanged: '0.11'
|
19
18
|
|
@@ -104,7 +103,19 @@ Minitest/GlobalExpectations:
|
|
104
103
|
Description: 'This cop checks for deprecated global expectations.'
|
105
104
|
StyleGuide: 'https://minitest.rubystyle.guide#global-expectations'
|
106
105
|
Enabled: true
|
106
|
+
EnforcedStyle: any
|
107
|
+
Include:
|
108
|
+
- '**/test/**/*'
|
109
|
+
- '**/*_test.rb'
|
110
|
+
- '**/spec/**/*'
|
111
|
+
- '**/*_spec.rb'
|
112
|
+
SupportedStyles:
|
113
|
+
- _
|
114
|
+
- any
|
115
|
+
- expect
|
116
|
+
- value
|
107
117
|
VersionAdded: '0.7'
|
118
|
+
VersionChanged: '0.16'
|
108
119
|
|
109
120
|
Minitest/LiteralAsActualArgument:
|
110
121
|
Description: 'This cop enforces correct order of `expected` and `actual` arguments for `assert_equal`.'
|