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

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

Original Pull Request: https://github.com/TheAlgorithms/C/pull/564

State: closed
Merged: Yes


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:

**Original Pull Request:** https://github.com/TheAlgorithms/C/pull/564 **State:** closed **Merged:** Yes --- #### 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>
claunia added the pull-request label 2026-01-29 15:16:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#992