6 Commits

Author SHA1 Message Date
Alexander Kuzmenkov
85f5efdc8f Fix -Wsign-compare with PG 15
It changed the type of Var.varno from Index to int. I'm starting to
wonder if it was a good idea to enable this warning, but maybe we can
give it the last try.
2022-10-28 17:10:13 +04:00
Alexander Kuzmenkov
7758f5959c Update .clang-format for version 14
The only configuration we're missing is the newline for braces after
case labels. The rest of the differences looks like bugs/omissions of
the version 8 that we use now.

Require clang-format-14 in cmake and use it in the CI check. We can't
support versions earlier than 14 because they have some
formatting differences that can't be configured.
2022-10-10 17:12:36 +03:00
Alexander Kuzmenkov
4a17d4c402 Add shellcheck to CI
Writing a shell script correctly can be hard even for a skilled
programmer. shellcheck is a static analysis tool that helps catch
common errors in shell scripts. We now have 36 executable scripts in
our repository, for which shellcheck reports 126 errors (calculated
like find . -type f -executable -exec bash -c '[ "$(file --brief
--mime-type "$1")" == "text/x-shellscript" ]' sh {} \; -exec shellcheck
-f gcc --exclude=SC2086 {} \; | cut -d: -f1 | sort | uniq | wc -l).
This commit fixes these warnings and adds a GitHub actions workflow
that runs shellcheck on all the executable shell scripts in the
repository. The warning SC2086: Double quote to prevent globbing and
word splitting is disabled globally, because it has little practical
consequences, sometimes leads to false positives, and is general is too
widespread because people forget to quote.
2021-11-15 14:54:14 +03:00
Mats Kindahl
3544e33fb4 Fix clang-format wrapper
The clang-format wrapper is always using `clang-format` even if a
different version of `clang-format` has been found and has the correct
version.

This commit fixes the issue by passing the name of the found version of
`clang-format` to the wrapper script using the `CLANG_FORMAT` varible.
It will default to use `clang-format` if `CLANG_FORMAT` is unset.
2020-12-02 10:02:31 +01:00
Mats Kindahl
3fa3822d08 Only update reformatted files
When running `make format` it will update all files. If a file does not
actually require reformatting, it will trigger a re-build of the entire
code base.

This commit instead compare the re-formatted file with the existing one
and does not update it unless it has actually changed.
2019-10-03 17:32:40 +02:00
Matvey Arye
cc52a78b9b Add scripts for clang-format
We are switching from pgindent to clang-format for several
reasons:
1) pgindent is harder to set up and depends on other tools
like gobjdump that differ between OSes making it harder
to set up a proper development environment.
2) clang-format is more standard and works better
with various IDEs and editors.

Our clang-format wrapper script is transactional in that this
version of the script copies all files to a temporary directory,
runs clang-format in the temp dir, and only then copies the files
back. This should prevent mis-formatting when the script is cancled
in the middle of running.

We changes travis to use clang-format instead of pgindent
and thus it uses a different docker image to do the format test.
We also changes travis to use the new clang docker
image for the license check and prefix checks for consistency.
This also paves the way for us to use more clang features for tests
in the future.
2019-02-05 16:55:16 -05:00