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 Readability Checks #526

Merged
merged 4 commits into from
May 21, 2024
Merged

Clang-tidy Readability Checks #526

merged 4 commits into from
May 21, 2024

Conversation

boulderdaze
Copy link
Collaborator

Closes #516

We decided to disable the following three checks but I had to disable some more checks for the reason described below.

Disabled

  • readability-magic-numbers
parameters.c_[13] = 0.1631930543123136E+02;
error: 13 is a magic number; consider replacing it with a named constant
  • readability-avoid-const-params-in-decls
const std::function<LinearSolverPolicy(const SparseMatrixPolicy<double>, double)> create_linear_solver
error: parameter 'create_linear_solver' is const-qualified in the function declaration; 
const-qualification of parameters only has an effect in function definitions
  • readability-isolate-declaration
double d_ymax, d_scale;
error: multiple declarations in a single statement reduces readability

Conditional

  • readability-identifier-length
    turn on for parameters
    turn off for variables

This is disabled because it requires fairly large cleanup efforts. Since this involves with mainly re-defining variables in math domain, it requires communication within the team.

void Decompose(const SparseMatrixPolicy<T>& A, SparseMatrixPolicy<T>& L, SparseMatrixPolicy<T>& U) const
error: parameter name 'A' is too short, expected at least 3 characters

double k0 =
error: variable name 'k0' is too short, expected at least 3 characters

Disabled for the following reasons

  • readability-avoid-unconditional-preprocessor-if
    micm/util /error.hpp has the copyright comments that has to be removed for a fortran code in musica.
    LLVM recently added a feature to exclude headers from clang-tidy analysis. We can revisit this check when the next release is available.
#if 0
/* Copyright (C) 2023-2024 National Center for Atmospheric Research
 *
 * SPDX-License-Identifier: Apache-2.0
 */
  • readability-convert-member-functions-to-static
    : This wants to put static in the inlined function defined outside the class definition but static must be specified inside the class definition.

  • readability-named-parameter
    : false positives
    micm/include/micm/util/vector_matrix.hpp:167:50: error: all parameters should be named in a function

  167 |     VectorMatrix(const std::vector<std::vector<T>> &other)
      |                                                  ^
      |                                                   /*unused*/

@boulderdaze boulderdaze marked this pull request as ready for review May 16, 2024 21:07
@boulderdaze boulderdaze marked this pull request as draft May 16, 2024 21:11
@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.90%. Comparing base (20015ed) to head (90b554c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
- Coverage   92.90%   92.90%   -0.01%     
==========================================
  Files          42       42              
  Lines        3270     3268       -2     
==========================================
- Hits         3038     3036       -2     
  Misses        232      232              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@boulderdaze boulderdaze marked this pull request as ready for review May 16, 2024 21:46
Copy link
Collaborator

@mwaxmonsky mwaxmonsky left a comment

Choose a reason for hiding this comment

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

Great job @boulderdaze!

Copy link
Collaborator

@mattldawson mattldawson left a comment

Choose a reason for hiding this comment

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

nice work!

@boulderdaze boulderdaze merged commit bb19ece into main May 21, 2024
45 checks passed
@boulderdaze boulderdaze deleted the 516-readability-checks branch May 21, 2024 15:56
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 Readability Checks
5 participants