aboutsummaryrefslogtreecommitdiff
path: root/kde-modules/kde-git-commit-hooks/clang-format.sh
AgeCommit message (Collapse)Author
2022-03-17KDEClangFormat: se the same source file extensions in clang-format script ↵Ahmad Samir
and target Previously the clang-format.sh git hook script didn't specify the file extensions to format; however it looks like with recent(?) clang-format versions 'git clang-format' will consider .json files if such files were changed by a commit, which makes the script fail, see: https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/254 Sepcify the file extensions by passing --extensions to 'git clang-format' command. Also add ".hpp" to the file extensions we format, and use the same list of file extensions everywhere.
2021-05-27Provide fallback error when no .clang-format file is presentAndreas Cord-Landwehr
This check fixes a probably rare case, where we land in a repository that contains this clang-format.sh hook but where the format file went missing. In such cases, clang-format falls back to the system defaults, which brings undesired defaults, e.g. enforced line breaks in comments after 90 chars, which cannot easily be reverted by a reformat. Since clang-format's --fallback-style=none option is not available for git clang-format, this comment reimplements the logic.
2021-01-16Add cmake function to configure git pre-commit hooksAlexander Lohnau
This will allow us to force QS checks before the developer commits a change. Currently only clang-format is supported, but as on #plasma and https://phabricator.kde.org/T11214 discussed we might want to add different formatters. By making the checks configurable we are flexible and can easily extend it.