Age | Commit message (Collapse) | Author |
|
If the module is not included, the current message would be misleading.
Including the module by default is undesirable, because we print out a warning
that we do not override an existing module. While this warning is reasonable in most
cases, it is annoying for projects that have a custom clang-format file.
Checking if a .clang-format file exists and if not including KDEClangFormat is fragile,
because it depends on the include order of the modules.
Considering all that, a proper warning with instructions on how to fix the issue
is IMHO the best way to go.
|
|
It should be --extensions "cpp,h,hpp,c"; previously, I naively tested that
it didn't bother .json files, but I not if it'll actually trigger for e.g.
a .h file...
|
|
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.
|
|
Otherwise recent versions of git will complain with:
```
hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
```
|
|
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.
|
|
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.
|