Skip to content

Add clang-tidy#26

Merged
marcoroth merged 1 commit intomainfrom
clang-tidy
Feb 14, 2025
Merged

Add clang-tidy#26
marcoroth merged 1 commit intomainfrom
clang-tidy

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Feb 14, 2025

This pull request introduces clang-tidy to enhance code quality and consistency.

High-Level Updates

  • .clang-tidy: Added a comprehensive set of clang-tidy checks to enforce best practices and catch potential issues.
  • Makefile: Updated to include a tidy command. Also DRY-ed up the project_files and extension_files used for formatting, linting and now tidying.
  • bin/tidy: Added a bin script that can be used to run the clang-tidy checked defined in the Makefile.
  • .github/workflows/test.yml: Added a new job to run bin/tidy on the codebase as part of the CI pipeline.
  • Brewfile: Added llvm to ensure clang-tidy is available in the development environment.
  • README.md: Updated to include instructions for installing clang-tidy and clarified its usage in the project.

Codebase Refinements detected by clang-tidy

  • Type Consistency: Updated various function signatures and struct members to use size_t instead of int for sizes and indices, improving type safety and consistency. All of these usages deal with numbers that are always positive, which removes the need for a signed int.
  • Macro: Updates macros in src/include/macros.h for readability.
  • Switch/Case handling : Updated the handling for switch cases where we didn't have a default or the same statements.
Note

For now we disabled the bugprone-suspicious-realloc-usage rule, but I'll follow up with a pull request to enable this rule and to address the valid warnings.

@marcoroth marcoroth merged commit 7b02b99 into main Feb 14, 2025
5 checks passed
@marcoroth marcoroth deleted the clang-tidy branch February 14, 2025 01:39
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.

1 participant