Skip to content
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

[Fix #11517] Make Lint/Debugger aware of some debug methods #11518

Merged

Conversation

koic
Copy link
Member

@koic koic commented Jan 29, 2023

Fixes #11517.

This PR makes Lint/Debugger aware of p, PP.pp, and pp methods. These are used for debugging purposes basically. OTOH, puts is not included in the config because it is used for the intended standard output.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

Fixes rubocop#11517.

This PR makes `Lint/Debugger` aware of `p`, `PP.pp`, and `pp` methods.
These are used for debugging purposes basically. OTOH, `puts` is not included in the config
because it is used for the intended standard output.
@bbatsov
Copy link
Collaborator

bbatsov commented Jan 30, 2023

Looks good to me. Thanks!

@koic koic deleted the make_lint_debugger_aware_of_some_debug_methods branch January 30, 2023 06:59
@ShockwaveNN
Copy link
Contributor

What to you think about excluding spec files by default for this cop?

I agree that it should be not present in library/applicatoin itself, but not sure that some additional print statements in spec files are really bad

koic added a commit to koic/rubocop that referenced this pull request Feb 10, 2023
This PR rolls back the print debug default configuration (rubocop#11518) of `Lint/Debugger`
based on the following feedback.

- rubocop#11557 (comment)
- rubocop#11552 (comment)
- rubocop#11518 (comment)

It seems like it was a bad idea to mix debugger and print debug methods by default.

This PR updates `Lint/Debugger` cop defaults to handle only debugger methods as per the cop name.
OTOH, it leaves the logic in rubocop#11557 to prevent false positives when user configures
print debug methods. e.g. rubocop#11517 (comment)
@koic
Copy link
Member Author

koic commented Feb 10, 2023

I reconsidered based on some feedback and opened #11564. Thank you.

bbatsov pushed a commit that referenced this pull request Feb 11, 2023
This PR rolls back the print debug default configuration (#11518) of `Lint/Debugger`
based on the following feedback.

- #11557 (comment)
- #11552 (comment)
- #11518 (comment)

It seems like it was a bad idea to mix debugger and print debug methods by default.

This PR updates `Lint/Debugger` cop defaults to handle only debugger methods as per the cop name.
OTOH, it leaves the logic in #11557 to prevent false positives when user configures
print debug methods. e.g. #11517 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discussion] do you think adding a Cop to detect puts/ap/p/pp usage in code reasonable ?
3 participants