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

False positive in "Statements should be on separate lines" #445

Closed
wichtounet opened this issue Apr 8, 2015 · 8 comments
Closed

False positive in "Statements should be on separate lines" #445

wichtounet opened this issue Apr 8, 2015 · 8 comments
Assignees
Labels
Milestone

Comments

@wichtounet
Copy link
Contributor

I have some false positives with the rule "Statements should be on separate lines".

I have this on using statements inside functions:

using type = typename A::value_type;

with this message: At most one statement is allowed per line, but 2 statements were found on this line.

I also have false positives on statements containing a lambda function:

return std::find_if(begin(expr), end(expr), [](auto& v){return !std::isfinite(v);}) == end(expr);

but in this case, depending on personal taste, some people may think that this is a true positive.

@guwirth guwirth added the bug label Apr 9, 2015
@guwirth guwirth added this to the M 0.9.3 milestone Apr 9, 2015
@guwirth
Copy link
Collaborator

guwirth commented Apr 10, 2015

@Bertk @Typz could one of you fix this?

@guwirth
Copy link
Collaborator

guwirth commented Apr 11, 2015

@wichtounet See #451. Does this fix your problem?

@guwirth
Copy link
Collaborator

guwirth commented Apr 17, 2015

Fixed with #451

@wichtounet
Copy link
Contributor Author

I finally took the time to install the last version of the plugin. The last commit of the master.

Unfortunately, I still have several of these false positives in my analysis. It seems that there is less issues than before, but I still have 63 of these. Maybe it is simply a coincidence but they all appear in template functions.

@wichtounet
Copy link
Contributor Author

I should also mention that I have several other false positives on lines with using statements:

using type = etl::fast_vector<ZZZ, 4>;
Redundant code: Found a statement that begins with numeric constant.

using IT = intrinsic_traits<value_t>;
Comparison of a boolean value using relational operator (<, >, <= or >=).

@LegalizeAdulthood
Copy link

*cough* clang libtooling

@Bertk
Copy link
Contributor

Bertk commented May 15, 2015

alias-issue
Please use #507 to report this kind of issues. The plugin parser (/cxx-squid/src/main/java/org/sonar/cxx/parser/CxxGrammarImpl.java) need to be improved for the C++11 alias declarations (http://en.cppreference.com/w/cpp/language/type_alias).
The statement check shows only the symptom of a parser problem and you can identify this parser issues with ‘C++ parser failure’ (rule: cxx:ParsingError) or ‘C++ skip parser error’ (rule: cxx:ParsingErrorRecovery).
This is a valuable input for the C++11 support and we will need to add some C++14/C++17 features as well.

@Bertk
Copy link
Contributor

Bertk commented May 15, 2015

@wichtounet Please provide a source code example for every single issues and create new issues if we do not have one open which has the identical root cause.

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

No branches or pull requests

4 participants