lint.fish receives arguments that contain multiple includes and defines.
As a result, we passed arguments like
"-I/usr/include -I$HOME/fish-shell/build -I/usr/include"
to cppcheck which interprets this as a single include directory.
This leads to errors like this one (because the "build" dir was missing):
src/common.h:4:0: information: Include file: "config.h" not found. [missingInclude]
This used "argparse" to parse the args, which broke since CXXFLAGS
contained options.
Instead we pass "--all" before any other arguments, and then stop
argparse at nonoptions.
I'm starting to wonder if IWYU is worth the effort. Nonetheless, this
makes it lint clean on macOS and reduces the number of warnings on
FreeBSD and Linux.
Commit 8645aa94 was made because it seemed necessary at the time. However,
when I run `make lint-all` now it complains about include loops for header
`signal.h`. This reverts part of that earlier commit to get sane behavior
from IWYU again.
This fixes some of the IWYU and cppcheck lint warnings. And only on
macOS (formerly OS X). Fixing these types of warnings on a broader set
of platforms should be done but this is a baby step to making `make
lint-all` have few, if any, warnings. This reduces the number of lines
in the `make lint-all` output on macOS by over 500 lines.
I found that after fixing the args to `cppcheck` it started reporting
lots of varFuncNullUB warnings. Suppress them as they should be safe to
ignore. Also, improve the readability of the script.
I recently noticed there were several invocations of `wcwidth()` that should
have been `fish_wcwidth()`. This adds custom cppcheck rules to detect that
mistake.
Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.
Fixes#2957
I just noticed that depending on the state of your working tree there can be
one or more spaces after the modification token and the file name. If there is
more than one space that causes the `string split` to produce unexpected
output.
Include information about how to deal with lint warnings and suppress
`clang-format` reformatting of blocks of code.
Move information only relevant to developers from the README.md to the
CONTRIBUTING.md document.
Closes#2901
This changes implements two new make targets: `style` and `style-all`. These
make it easy to ensure that a change conforms to the project style guides for
C++ and fish code.
Fixes#571