ci: add -Werror to CFLAGS, added clang build target
This is a followup for https://gitlab.labs.nic.cz/knot/knot-resolver/commit/a1c56f8f76270f45bd8a7ad843a7f27989ce70b5#note_65758
This MR adds stricter CI builds to prevent merges with common QA issues.
- Added -Werror to build phase
- Added a build step with clang (with no artifacts)
Merge request reports
Activity
I've added a target for linting C code using clang-tidy to fix common security and code quality issues early in the development workflow. The benefit is that less time has to be spent in code reviews to point out obvious problems, and ideally when the outstanding issues are fixed, clang-tidy (and clang-format) can also be used to to automatically fix basic problems and enforce common code style, similarly to
go vet && go fmt
workflow.I've relaxed the rules a bit for three reasons:
- there's a lot of occurrences for minor problems, like return-after-else code pattern, that I don't feel particularly motivated to fix
- there's a few functions like worker_process_tcp that are getting out of hand and shortening them warrants a separate refactoring task
- leak checkers can have false positives, so I disabled them to avoid annoying build failures
- Resolved by Marek Vavrusa
I've also disabled va_arg UB checker for now, as it's impossible to fix without more complicated refactoring, and the affected functions being rewritten in !405 (merged)
added 2 commits
added 1 commit
- 894165c9 - lib: fixed possible null pointers passed to nonnull arguments
added 1 commit
- 61ad51b6 - daemon: fixed garbage read when getsockname fails
added 1 commit
- 8b5b7109 - lint: enabled several readability linters and fixed issues
mentioned in issue #291