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

Add Clang-Tidy converter #2367

Merged
merged 3 commits into from
Jun 16, 2021
Merged

Add Clang-Tidy converter #2367

merged 3 commits into from
Jun 16, 2021

Conversation

shaopeng-gh
Copy link
Collaborator

No description provided.

@@ -3,6 +3,7 @@
## **v2.4.9** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/2.4.9) | [Driver](https://www.nuget.org/packages/Sarif.Driver/2.4.9) | [Converters](https://www.nuget.org/packages/Sarif.Converters/2.4.9) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/2.4.9) | [Multitool Library](https://www.nuget.org/packages/Sarif.Multitool.Library/2.4.9)
* FEATURE: Report inner exception details if available. [#2357](https://github.com/microsoft/sarif-sdk/pull/2357)
* FEATURE: Add support for git blame. [#2358](https://github.com/microsoft/sarif-sdk/pull/2358)
* FEATURE: Add Clang-Tidy converter. [#2367](https://github.com/microsoft/sarif-sdk/pull/2367)
Copy link
Collaborator

@eddynaka eddynaka Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FEATURE: Add Clang-Tidy converter.

move this to line 2.
This change wasn't released in 2.4.9. #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, fixed


Result result = new Result()
{
RuleId = entry.DiagnosticName,
Copy link
Collaborator

@eddynaka eddynaka Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

entry.DiagnosticName

from this, you can create the ReportingDescriptor #Closed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each rule can point to its own documentation: https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-trailing-return-type.html

change modernize-use-trailing-return-type to another ruleid and it will work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the rules.

{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/lsp/projects/staticlib/src/Hello.cpp",
Copy link
Collaborator

@eddynaka eddynaka Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

home/lsp/projects/staticlib/src/Hello.cpp

check other converters to see if we normally use the artifacts property or if we use the artifactLocation.

right now, you are duplicating the information #ByDesign

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean the uri is not needed here because the url is already in the artifacts section, since we have the index here, we can know the url by looking at artifacts section by index right.

this is same as LintConverter, it is also duplicating this info,

the index is automaticlly added by code, once we specifc the url here. I think ideally the code that automaticlly add index can delete the url at the same time, if we want to do that. let me know if we want make changes.

@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2021

This pull request introduces 1 alert when merging 3eea2e5 into 60363e6 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

In reply to: 861791781

private static (List<ReportingDescriptor>, List<Result>) ExtractRulesAndResults(ClangTidyLog log)
{
var rules = new List<ReportingDescriptor>();
var ruleIds = new HashSet<string>();
Copy link
Collaborator

@eddynaka eddynaka Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u could replace by dict<string, reportingdescriptor> #Resolved

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the stringcomparison to ignore case

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, fixed

DefaultConfiguration = new ReportingConfiguration
{
Level = FailureLevel.Warning,
},
Copy link
Collaborator

@eddynaka eddynaka Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think u dont need to add this. #Resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry did not get you, removing
},
will have compile error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove entire DefaultConfiguration

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh do you mean remove the whole DefaultConfiguration since no need. I am fixing it.

DefaultConfiguration = new ReportingConfiguration
{
Level = FailureLevel.Warning,
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning is default. so we dont need to express.

Copy link
Collaborator

@eddynaka eddynaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@eddynaka eddynaka merged commit 9f8e08a into main Jun 16, 2021
@eddynaka eddynaka deleted the users/shaopeng-gh/clangtidy branch June 16, 2021 00:03
@eddynaka eddynaka linked an issue Jun 16, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clang-tidy converter
2 participants