-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Minitest/NonPublicTestMethod
cop
#229
Conversation
d6f1072
to
3c58541
Compare
First, it should be enough if it is confirmed with rails/rails repo 👍 Can you update this cop name to |
config/default.yml
Outdated
@@ -158,6 +158,11 @@ Minitest/GlobalExpectations: | |||
VersionAdded: '0.7' | |||
VersionChanged: '0.26' | |||
|
|||
Minitest/HiddenTestMethod: | |||
Description: 'Detects hidden (marked as `private` or `protected`) test methods.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: 'Detects hidden (marked as `private` or `protected`) test methods.' | |
Description: 'Detects non public (marked as `private` or `protected`) test methods.' |
config/default.yml
Outdated
@@ -158,6 +158,11 @@ Minitest/GlobalExpectations: | |||
VersionAdded: '0.7' | |||
VersionChanged: '0.26' | |||
|
|||
Minitest/HiddenTestMethod: | |||
Description: 'Detects hidden (marked as `private` or `protected`) test methods.' | |||
Enabled: pending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's probably Severity: warning
.
Enabled: pending | |
Enabled: pending | |
Severity: warning |
module RuboCop | ||
module Cop | ||
module Minitest | ||
# Detects hidden (marked as `private` or `protected`) test methods. Minitest runs only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Detects hidden (marked as `private` or `protected`) test methods. Minitest runs only | |
# Detects non `public` (marked as `private` or `protected`) test methods. Minitest runs only |
include MinitestExplorationHelpers | ||
include DefNode | ||
|
||
MSG = 'Hidden test method detected. Make it public for it to run.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSG = 'Hidden test method detected. Make it public for it to run.' | |
MSG = 'Non `public` test method detected. Make it `public` for it to run.' |
3c58541
to
80fd3da
Compare
Updated. |
Minitest/HiddenTestMethod
copMinitest/NonPublicTestMethod
cop
I ran this on Shopify's main app. No errors, and it caught a good number of unintentionally private tests. |
Cool! Glad it works. Thank you for checking ❤️ |
Thanks! |
Closes #220.
Tested on
rails/rails
- no offenses there.Does anyone know other large OSS projects with minitest tests in it?