| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- # Exceptions. See /LICENSE for license information.
- # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- ---
- # Get colors when outputting through `bazel build --config=clang-tidy`.
- UseColor: true
- # This is necessary for `--config=clang-tidy` to catch errors.
- WarningsAsErrors: '*'
- # - bugprone-exception-escape finds issues like out-of-memory in main(). We
- # don't use exceptions, so it's unlikely to find real issues.
- # - bugprone-macro-parentheses has false positives in places such as using an
- # argument to declare a name, which cannot have parentheses. For our limited
- # use of macros, this is a common conflict.
- # - bugprone-switch-missing-default-case has false positives for `enum_base.h`.
- # Clang's built-in switch warnings cover most of our risk of bugs here.
- # - bugprone-unchecked-optional-access in clang-tidy 16 has false positives on
- # code like:
- # while (auto name_ref = insts().Get(inst_id).TryAs<SemIR::NameRef>()) {
- # inst_id = name_ref->value_id;
- # ^ unchecked access to optional value
- # }
- # - google-readability-function-size overlaps with readability-function-size.
- # - modernize-use-designated-initializers is disabled because it fires on
- # creation of SemIR typed insts, for which we do not currently want to use
- # designated initialization.
- # - modernize-use-nodiscard is disabled because it only fixes const methods,
- # not non-const, which yields distracting results on accessors.
- # - performance-unnecessary-value-param is disabled because it duplicate
- # modernize-pass-by-value.
- Checks:
- -*, bugprone-*, -bugprone-branch-clone, -bugprone-easily-swappable-parameters,
- -bugprone-exception-escape, -bugprone-macro-parentheses,
- -bugprone-narrowing-conversions, -bugprone-switch-missing-default-case,
- -bugprone-unchecked-optional-access, google-*,
- -google-readability-function-size, -google-readability-todo,
- misc-definitions-in-headers, misc-misplaced-const, misc-redundant-expression,
- misc-static-assert, misc-unconventional-assign-operator,
- misc-uniqueptr-reset-release, misc-unused-*, modernize-*,
- -modernize-avoid-c-arrays, -modernize-return-braced-init-list,
- -modernize-use-default-member-init, -modernize-use-designated-initializers,
- -modernize-use-emplace, -modernize-use-nodiscard, performance-*,
- -performance-unnecessary-value-param, readability-*,
- -readability-convert-member-functions-to-static,
- -readability-function-cognitive-complexity, -readability-else-after-return,
- -readability-identifier-length, -readability-implicit-bool-conversion,
- -readability-magic-numbers, -readability-make-member-function-const,
- -readability-static-definition-in-anonymous-namespace,
- -readability-suspicious-call-argument, -readability-use-anyofallof
- CheckOptions:
- - { key: readability-identifier-naming.ClassCase, value: CamelCase }
- - { key: readability-identifier-naming.ClassConstantCase, value: CamelCase }
- - {
- key: readability-identifier-naming.ConstexprVariableCase,
- value: CamelCase,
- }
- - { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
- - { key: readability-identifier-naming.StructCase, value: CamelCase }
- - {
- key: readability-identifier-naming.TemplateParameterCase,
- value: CamelCase,
- }
- - { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- - { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- - { key: readability-identifier-naming.UnionCase, value: CamelCase }
- - { key: readability-identifier-naming.VariableCase, value: lower_case }
- - { key: readability-identifier-naming.ParameterCase, value: lower_case }
- - { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
- - {
- key: readability-identifier-naming.MethodIgnoredRegexp,
- value: '^classof$',
- }
- - {
- # This erroneously fires in C++20 mode with LLVM 16 clang-tidy, due to:
- # https://github.com/llvm/llvm-project/issues/46097
- key: readability-identifier-naming.TemplateParameterIgnoredRegexp,
- value: '^expr-type$',
- }
|