-
Notifications
You must be signed in to change notification settings - Fork 30
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
Create rule S7116: The first element of an array should not be accessed implicitly CPP-5674 #4377
Conversation
9770543
to
80879b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly suggesting changes in the wording.
Co-authored-by: Loïc Joly <[email protected]>
rules/S7116/cfamily/rule.adoc
Outdated
==== Compliant solution | ||
|
||
If the access to the first element was intentional, you can use subscript explicitly: | ||
[source,cpp,diff-id=1,diff-type=compliant] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet in the next example, you highlight a solution that does change the meaning of the code... (I also considered removing it there, but that solution really seemed more meaningful than the other, while here all suggestions look as likely to me)
Maybe we can wait and see how it looks in the product, I'm afraid it will not look good.
Co-authored-by: Loïc Joly <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't fully agree on the issue of diffs, but it's not large enough to block this PR.
Added the comment to PR: https://sonarsource.atlassian.net/browse/CPP-5674?focusedCommentId=671412, to check how RSPEC look in product. |
|
|
|
|
CPP-5674
You can preview this rule here (updated a few minutes after each push).
Review
A dedicated reviewer checked the rule description successfully for: