Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Make the code in scanner/groovy.rb robust.#228

Open
junaruga wants to merge 1 commit intorubychan:master from
junaruga:hotfix/scanner-groovy
Open

Make the code in scanner/groovy.rb robust. #228
junaruga wants to merge 1 commit intorubychan:master from
junaruga:hotfix/scanner-groovy

Conversation

@junaruga
Copy link
Contributor

@junaruga junaruga commented Aug 27, 2018

Fix small issues for lib/coderay/scanners/groovy.rb.

inline_block_paren_depth is initialized as nil.
But the code inline_block_paren_depth += 1, inline_block_paren_depth -= 1, inline_block_paren_depth == 0 has a possibility to raise unintended NoMethodError.
It looks good to initialize inline_block_paren_depth is initialized as 0 or add checks before the codes.

  1. string_delimiter can be nil as a possibility. Adding checks looks better.

@korny korny self-assigned this Feb 23, 2019
Copy link
Contributor Author

junaruga commented Feb 23, 2019
edited
Loading

This report is by a static code analysis tool in our company (Maybe Coverity Scan).

Copy link
Member

korny commented Feb 23, 2019

Mmh. I don’t think there’s really a bug here, since I never got an error with the current version even with thorough testing (see the scanner test suite). While I agree with the first change, the second one would slow down the scanner. I don’t think we need such checks unless someone can actually produce an error here :)

Copy link
Contributor Author

Sure, @korny . I respect your decision. It's up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /