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 #7737] Add new Style/RedundantArguments cop #9077

Merged
merged 1 commit into from Nov 23, 2020

Conversation

tejasbubane
Copy link
Contributor

Closes #7737

Previous PR #7761


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.

@tejasbubane tejasbubane force-pushed the style-unnecessary-arguments-cop branch from 82db332 to bf38d80 Compare November 21, 2020 18:37
Description: 'Check for redundant arguments to methods.'
Enabled: pending
Safe: false
VersionAdded: '1.4'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we use <<next>> here.

# split: ' '
# foo: 2
#
# Limitations:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put those limitations before the configuration examples.

#
# @example
# # bad
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blank line is redundant.

# "first second".split
# A.foo
class RedundantArguments < Cop
MSG = 'Argument is redundant.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expand the message to mention the argument in question and some text saying that the argument is implied by default, so it's clearer what makes it redundant.

@tejasbubane tejasbubane force-pushed the style-unnecessary-arguments-cop branch from bf38d80 to 755785a Compare November 23, 2020 07:36
@tejasbubane
Copy link
Contributor Author

@bbatsov changes done

@bbatsov bbatsov merged commit 6da531b into rubocop:master Nov 23, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Nov 23, 2020

Thanks!

@tejasbubane tejasbubane deleted the style-unnecessary-arguments-cop branch November 23, 2020 08:04
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.

Remove unnecessary arguments for builtin methods.
2 participants