Skip to content

Add clang-tidy checks and apply them#1989

Merged
pcarruscag merged 9 commits intodevelopfrom
feature_clang-tidy
Apr 9, 2023
Merged

Add clang-tidy checks and apply them#1989
pcarruscag merged 9 commits intodevelopfrom
feature_clang-tidy

Conversation

@kursatyurt
Copy link
Copy Markdown
Contributor

Proposed Changes

clang-tidy is a well-known tool. This PR adds clang-tidy file with common checks and applies to the code base.

PR Checklist

Copy link
Copy Markdown
Contributor

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@kursatyurt
Copy link
Copy Markdown
Contributor Author

kursatyurt commented Mar 27, 2023

@pcarruscag
Copy link
Copy Markdown
Member

Else after return is fine but I don't like the others.
Isolate declarations is not addressing the true problem. Variables should be declared when needed and made const if possible.
We cannot use auto for the return type of operations with su2double

}

void CFEMStandardElementBase::IntegrationPointsTriangle(void) {
void CFEMStandardElementBase::IntegrationPointsTriangle() {

Check warning

Code scanning / CodeQL

Poorly documented large function

Poorly documented function: fewer than 2% comments for a function of 5388 lines.
}

void CFEMStandardElementBase::IntegrationPointsTetrahedron(void) {
void CFEMStandardElementBase::IntegrationPointsTetrahedron() {

Check warning

Code scanning / CodeQL

Poorly documented large function

Poorly documented function: fewer than 2% comments for a function of 4733 lines.

Xcoord.push_back(Airfoil_Coord[0]);
Ycoord.push_back(Airfoil_Coord[1] * factor * AirfoilScale);
Ycoord.emplace_back(Airfoil_Coord[1] * factor * AirfoilScale);

Check failure

Code scanning / CodeQL

Missing return-value check for a 'scanf'-like function

This variable is read, but may not have been written. It should be guarded by a check that the [call to scanf](1) returns at least 1.
@pcarruscag
Copy link
Copy Markdown
Member

I went over the changes very quickly, if someone else wants to take a look it would be nice.

@kursatyurt
Copy link
Copy Markdown
Contributor Author

@bigfooted, @tbellosta, @WallyMaier if any of you had time I would be great.

@bigfooted
Copy link
Copy Markdown
Contributor

@bigfooted, @tbellosta, @WallyMaier if any of you had time I would be great.

I've had a look at the changes. I do not have strong opinions about the checks that were chosen (or not chosen), but I am glad that we have this now.

Copy link
Copy Markdown
Contributor

@bigfooted bigfooted left a comment

Choose a reason for hiding this comment

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

Great work!

@pcarruscag pcarruscag merged commit 52f2450 into develop Apr 9, 2023
@pcarruscag pcarruscag deleted the feature_clang-tidy branch April 9, 2023 21:29
@pr-triage pr-triage bot added the PR: merged label Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants