[PR #564] [MERGED] [enhancement] Added Clang tidy based static code analysis and formatting #989

Open
opened 2026-01-29 15:16:38 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/564
Author: @kvedala
Created: 7/10/2020
Status: Merged
Merged: 7/11/2020
Merged by: @kvedala

Base: masterHead: clang-tidy


📝 Commits (10+)

  • caf5e91 added clang-tidy config file
  • 26322e0 update workflow to use clang-tidy checks and apply necessary fixes
  • 61998c0 fix config syntax & disable rand error
  • b6270ea treat warnings as errors
  • f261bf5 fix file for clang-tidy errors
  • 38f88de disable all insecureAPI warnings
  • 08aae08 disable auto-fix
  • fd2c883 enable errors when clang-tidy cannot auto-fix
  • 22202f0 test passing multiple files
  • f13781f test commit

📊 Changes

3 files changed (+144 additions, -71 deletions)

View changed files

.clang-tidy (+6 -0)
📝 .github/workflows/awesome_workflow.yml (+110 -65)
📝 numerical_methods/qr_eigen_values.c (+28 -6)

📄 Description

Description of Change

Benefits of clang-tidy:

  • Robust static code analysis
  • More control on types of tests to checks than with LGTM
  • Able to apply auto-code fixes when possible - Users must enable GitHub Actions for their respective forks. Otherwise, the main repo will apply the fixes, which is also fine.
  • Also performs code-formatting per specs when code was written not using the VSCode for which the repo provides with settings.

Moved git-push to after all checks.

References

Similar implementation for C++ repo:
https://github.com/TheAlgorithms/C-Plus-Plus/pull/943 and
https://github.com/TheAlgorithms/C-Plus-Plus/pull/947

List of all checks available: https://clang.llvm.org/extra/clang-tidy/checks/list.html

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/TheAlgorithms/C/pull/564 **Author:** [@kvedala](https://github.com/kvedala) **Created:** 7/10/2020 **Status:** ✅ Merged **Merged:** 7/11/2020 **Merged by:** [@kvedala](https://github.com/kvedala) **Base:** `master` ← **Head:** `clang-tidy` --- ### 📝 Commits (10+) - [`caf5e91`](https://github.com/TheAlgorithms/C/commit/caf5e9190a4d2d59faeee310a27a5fed956b0dc4) added clang-tidy config file - [`26322e0`](https://github.com/TheAlgorithms/C/commit/26322e0ddbe88dfdd0fab1f4e61606b84535ed1e) update workflow to use clang-tidy checks and apply necessary fixes - [`61998c0`](https://github.com/TheAlgorithms/C/commit/61998c0446502e2eece967fa20e5bdc93705fdf9) fix config syntax & disable rand error - [`b6270ea`](https://github.com/TheAlgorithms/C/commit/b6270eaf2d0dedb11d9ab22558f6f702151da1e9) treat warnings as errors - [`f261bf5`](https://github.com/TheAlgorithms/C/commit/f261bf590b343c6307bad2bc61d43a1571d2d404) fix file for clang-tidy errors - [`38f88de`](https://github.com/TheAlgorithms/C/commit/38f88ded81fe41be4840906aaf2d2b34b2fdb7b8) disable all insecureAPI warnings - [`08aae08`](https://github.com/TheAlgorithms/C/commit/08aae084c93258d54f470bcf7c3f5d9fdb5dfaee) disable auto-fix - [`fd2c883`](https://github.com/TheAlgorithms/C/commit/fd2c883883fbd0abb4beebe969625bf324480d2d) enable errors when clang-tidy cannot auto-fix - [`22202f0`](https://github.com/TheAlgorithms/C/commit/22202f0cea59c0ca240f215425175cf03e692a36) test passing multiple files - [`f13781f`](https://github.com/TheAlgorithms/C/commit/f13781f35c3b489f97993547c19e1b1fa71b92f5) test commit ### 📊 Changes **3 files changed** (+144 additions, -71 deletions) <details> <summary>View changed files</summary> ➕ `.clang-tidy` (+6 -0) 📝 `.github/workflows/awesome_workflow.yml` (+110 -65) 📝 `numerical_methods/qr_eigen_values.c` (+28 -6) </details> ### 📄 Description #### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/CONTRIBUTING.md --> Benefits of clang-tidy: * Robust [static code analysis](https://en.wikipedia.org/wiki/Static_program_analysis) * More control on types of tests to checks than with LGTM * Able to apply auto-code fixes when possible - Users must enable GitHub Actions for their respective forks. Otherwise, the main repo will apply the fixes, which is also fine. * Also performs code-formatting per specs when code was written not using the VSCode for which the repo provides with settings. Moved git-push to after all checks. #### References <!-- Add any reference to previous pull-request or issue --> Similar implementation for C++ repo: https://github.com/TheAlgorithms/C-Plus-Plus/pull/943 and https://github.com/TheAlgorithms/C-Plus-Plus/pull/947 List of all checks available: https://clang.llvm.org/extra/clang-tidy/checks/list.html #### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [x] Added description of change - [ ] Added file name matches [File name guidelines](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md#New-File-Name-guidelines) - [x] Added tests and example, test must pass - [x] Relevant documentation/comments is changed or added - [x] PR title follows semantic [commit guidelines](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md#Commit-Guidelines) - [x] Search previous suggestions before making a new one, as yours may be a duplicate. - [x] I acknowledge that all my contributions will be made under the project's license. Notes: <!-- Please add a one-line description for developers or pull request viewers --> <a href="https://gitpod.io/#https://github.com/TheAlgorithms/C/pull/564"><img src="https://gitpod.io/api/apps/github/pbs/github.com/kvedala/C.git/25ceda9b5e8e2af86953681ce3e483295a1a37a2.svg" /></a> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 15:16:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#989