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

clang-tidy: modernize-use-nodiscard check message breaks regex #1719

Closed
jspam opened this issue May 13, 2019 · 2 comments · Fixed by #1742
Closed

clang-tidy: modernize-use-nodiscard check message breaks regex #1719

jspam opened this issue May 13, 2019 · 2 comments · Fixed by #1742
Assignees
Labels
Milestone

Comments

@jspam
Copy link

jspam commented May 13, 2019

Sample file

class A {
  bool empty() const;
};

clang-tidy output

clang-tidy --extra-arg=-std=c++17 -checks=modernize-use-nodiscard nodiscard.cpp

1 warning generated.
/tmp/nodiscard.cpp:2:3: warning: function 'empty' should be marked [[nodiscard]] [modernize-use-nodiscard]
  bool empty() const;
  ^
  [[nodiscard]] 

Expected behavior

The clang-tidy sensor adds a new finding with ID ClangTidy:modernize-use-nodiscard

Actual behavior

clang-tidy sensor fails to add the issue with an error message

07:59:32.406 ERROR - Could not add the issue 'CxxReportIssue [ruleId=[nodiscard, locations=CxxReportLocation [file=/tmp/nodiscard.cpp, line=2, info=function 'empty' should be marked]]':The rule 'ClangTidy:[nodiscard' does not exist.
', skipping issue
@guwirth
Copy link
Collaborator

guwirth commented Jul 25, 2019

Current regex is parsing for first string in square brackets.
Here we have two: [[nodiscard]] [modernize-use-nodiscard]

@guwirth
Copy link
Collaborator

guwirth commented Jul 26, 2019

Hi @jspam you can try with the snapshot https://ci.appveyor.com/project/SonarOpenCommunity/sonar-cxx/branch/master/artifacts. Regards.

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

Successfully merging a pull request may close this issue.

2 participants