-
-
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/SkipWithoutReason
cop
#199
Conversation
I think this cop can be published without a config option first. How about a rule like the one below for conditions? # bad
if condition
do_something
skip
end
# good
skip if condition
if condition
skip
end It is clear when the
# bad
do_something while condition And It's a corner case, I think the following is also bad. # bad
if condition
skip
else
skip
end Can you add test cases and adjust the implementation? |
# # good | ||
# skip if condition? | ||
# | ||
class SkipWithoutComment < Base |
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.
How about a name like SkipWithoutArgument
, SkipWithoutMessageArgument
, or SkipWithoutReason
? Because "comment" might imagine source code comment.
f3bfda5
to
41713bc
Compare
@koic Changed the name and adjusted the logic accordingly to the comments. |
I tried running it with the rails/rails repo. In the following, all case connection.class::ADAPTER_NAME
when "PostgreSQL"
unless connection.instance_variable_get(:@raw_connection).transaction_status == ::PG::PQTRANS_INTRANS
connection.instance_variable_get(:@raw_connection).async_exec("begin")
end
connection.instance_variable_get(:@raw_connection).async_exec("set idle_in_transaction_session_timeout = '10ms'")
sleep 0.05
when "Mysql2"
connection.send(:internal_execute, "set @@wait_timeout=1")
sleep 1.2
else
skip
end It also seems obvious to begin
@cache.delete_matched("*")
rescue NotImplementedError
skip
end @fatkodima Can you take a look at this? |
41713bc
to
ef1eeb4
Compare
@koic Updated with the suggested cases. |
ef1eeb4
to
f2d0dda
Compare
Thanks for another review! Added more suggested changes. |
Let's start with this behavior and adjust it according to feedback use cases. Thank you! |
Minitest/SkipWithoutComment
copMinitest/SkipWithoutReason
cop
Closes #198.
I am thinking: do we need a config option to be able to always enforce
skip
with comments (no matter if in conditional or not)?