Commit Graph

15 Commits

Author SHA1 Message Date
Jacques Lucke 725973485a Clang Tidy: enable readability-non-const-parameter warning
Clang Tidy reported a couple of false positives. I disabled
those `NOLINTNEXTLINE`.

Differential Revision: https://developer.blender.org/D8199
2020-07-13 11:27:09 +02:00
Sebastian Parborg d7dbf90a02 Clang-tidy: Enable braces-around-statements warning 2020-07-03 21:23:33 +02:00
Sergey Sharybin cad2d32be6 Clang-Tidy: Enable bugprone-misplaced-widening-cast 2020-07-03 17:10:27 +02:00
Jacques Lucke 4a5389816b Clang-Tidy: enable readability-named-parameter 2020-07-03 17:07:13 +02:00
Jacques Lucke 1019c9f582 Clang-Tidy: enable bugprone-too-small-loop-variable 2020-07-03 16:54:08 +02:00
Jacques Lucke 883f9dd6e5 Clang-Tidy: enable bugprone-assert-side-effect
Looks like we have no assertions with side effects.
2020-07-03 16:48:16 +02:00
Jacques Lucke 14fd91e7e8 Clang-Tidy: enable bugprone-argument-comment
It was called `inverted` in the header.
2020-07-03 16:39:06 +02:00
Sergey Sharybin f891d4e2ad Clang-Tidy: Fix readability-delete-null-pointer warnings
Also enable it in the configuration.
2020-07-03 16:32:51 +02:00
Jacques Lucke 88d358902f Clang-Tidy: Enable readability-redundant-string-cstr 2020-07-03 15:55:09 +02:00
Hans Goudey 19ff145e66 Clang-Tidy: Enable readability-redundant-control-flow 2020-07-03 09:41:55 -04:00
Jacques Lucke 2633683b52 Clang-tidy: enable readability-container-size-empty warning
Reviewers: sergey

Differential Revision: https://developer.blender.org/D8197
2020-07-03 14:59:27 +02:00
Sergey Sharybin 6fea8ec183 Clang-Tidy: Enable redundant static qualifier warning
This change enables readability-static-definition-in-anonymous-namespace
warning in .clang-tidy configuration.
2020-07-03 12:58:13 +02:00
Sergey Sharybin 83eeaddce8 Clang-tidy: Enable bugprone-lambda-function-name warning 2020-07-03 12:30:20 +02:00
Sergey Sharybin dfdd23bae6 Clang-Tidy: Silence warning affecting newer code
For now Clang-Tidy should be passable with the codebase as is. This warning
will be addressed as quality day task.
2020-07-03 10:23:44 +02:00
Sergey Sharybin 9ea5469178 Initial support of clang-tidy toolchain
Clang Tidy is a Clang based "linter" tool which goal is to help
fixing typical programming errors.

It is run as a separate compile step of every file, which slows
compilation down but allows to fully analyze the file the same
way as compiler does and catch non-trivial bugprone cases.

This change includes:

- CMake option called `WITH_CLANG_TIDY` which enables Clang Tidy
  linter tool on all source in the `source/` directory.

  This option is only available on Linux, as it is currently the
  easiest platform to get the Clang Tidy toolchain to work.

- CMake module which is aimed to find latest available Clang Tidy.

- Set of rules which allows to have Blender fully compiled without
  extra issues.

The goal of this change is to provide a base ground so that solving
all the warnings can happen later on, as a team effort.

It should be possible to use Clang Tidy side-by-side with both GCC
and Clang, but there seems to be some tweaks to be done in CMake to
make it really work for Blender. For now use Clang toolchain if
there are issues with GCC+Clang Tidy.

It will be worked on in the nearest future to bring seamless
experience for all configurations.

Currently there is no official way of getting Clang Tidy on macOS,
and on Windows there are some difficulties of hooking up Clang Tidy
from LLVM package to the MSVC compiler toolchain.

The actual warnings in the code will be addressed as a part of the
Code Quality Days, task T78535.

Differential Revision: https://developer.blender.org/D7937
2020-07-03 09:57:41 +02:00