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 rubocop-hq/rubocop-performance#95] Fix to return correct info from multi-line regexp #7661

Merged
merged 1 commit into from Jan 24, 2020

Conversation

Tietew
Copy link
Contributor

@Tietew Tietew commented Jan 20, 2020

Fixes rubocop/rubocop-performance#95.

This PR fixes RuboCop::AST::RegexpNode to return correct information
from multi-line regexp.

  • #regopt - find regopt node instead of checking first node.
  • #content - join all child string nodes instead of returning first node.

Before submitting the PR make sure the following are checked:

  • 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.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@Tietew
Copy link
Contributor Author

Tietew commented Jan 21, 2020

@buehmann Fixed and force-pushed.

@koic
Copy link
Member

koic commented Jan 22, 2020

Can you add a changelog entry to Bug fixes section?
https://github.com/rubocop-hq/rubocop/blob/v0.79.0/CONTRIBUTING.md#changelog-entry-format

…multi-line regexp

Fixes rubocop/rubocop-performance#95.

This PR fixes `RuboCop::AST::RegexpNode` to return correct information
from multi-line regexp.

- `#regopt` - returns last node instead of checking first node.
- `#content` - joins all child string nodes instead of returning first node.
@Tietew
Copy link
Contributor Author

Tietew commented Jan 23, 2020

@koic Done.

@koic koic merged commit bd18c76 into rubocop:master Jan 24, 2020
@koic
Copy link
Member

koic commented Jan 24, 2020

Thanks!

@Tietew Tietew deleted the ast_regexp_multiline_fix branch January 24, 2020 04:26
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.

Performance/RegexpMatch false positive on multi-line regexp with named captures
3 participants