Skip to content

Conversation

junaruga
Copy link
Contributor

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
@korny korny added the Scanners label Feb 23, 2019
@junaruga
Copy link
Contributor Author

junaruga commented Feb 23, 2019

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

@korny
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 :)

@junaruga
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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants