Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reintroduce clang-tidy #1265

Merged
merged 8 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,16 @@ jobs:
name: "Build"
command: cond_spot_run_build circuits-wasm-linux-clang-assert 64

# TODO Disabling until this is 3-10x faster see #1152
# circuits-x86_64-linux-clang-tidy:
# docker:
# - image: aztecprotocol/alpine-build-image
# resource_class: small
# steps:
# - *checkout
# - *setup_env
# - run:
# name: "Build"
# command: cond_spot_run_build circuits-x86_64-linux-clang-tidy 64
circuits-x86_64-linux-clang-tidy:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Build"
command: cond_spot_run_build circuits-x86_64-linux-clang-tidy 64

circuits-x86_64-linux-clang:
docker:
Expand Down Expand Up @@ -1068,7 +1067,7 @@ workflows:
<<: *defaults
- circuits-wasm-linux-clang: *defaults
- circuits-wasm-linux-clang-assert: *defaults
# - circuits-x86_64-linux-clang-tidy: *defaults # TODO #1152
- circuits-x86_64-linux-clang-tidy: *defaults
- circuits-x86_64-linux-clang: *defaults
- circuits-x86_64-linux-clang-assert: *defaults
- circuits-wasm-tests:
Expand All @@ -1080,7 +1079,7 @@ workflows:
requires:
- circuits-wasm-linux-clang
- circuits-wasm-linux-clang-assert
# - circuits-x86_64-linux-clang-tidy # TODO #1152
- circuits-x86_64-linux-clang-tidy
- circuits-x86_64-linux-clang
- circuits-x86_64-linux-clang-assert
- circuits-wasm-tests
Expand Down
203 changes: 139 additions & 64 deletions circuits/cpp/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,147 @@
# So, it needs to omit certain checks or keep them as warnings only
# if they are too strict.

# TODO(AD): Picking a limited subset for now, pending a deeper dive into the performance issues. See #1152.
Checks: '
cert-*,
google-*,
cppcoreguidelines-*,
readability-*,
modernize-*,
bugprone-*,
misc-*,
performance-*,
clang-analyzer-*,
concurrency-*,
portability-*,
-bugprone-easily-swappable-parameters,
-bugprone-reserved-identifier,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-member-init,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cert-dcl59-cpp,
-google-build-namespaces,
-google-readability-avoid-underscore-in-googletest-name,
-google-readability-todo,
-misc-non-private-member-variables-in-classes,
-modernize-avoid-c-arrays,
-modernize-pass-by-value,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-readability-simplify-boolean-expr,
-readability-use-anyofallof,
clang-analyzer-apiModeling.Errno
clang-analyzer-apiModeling.StdCLibraryFunctions
clang-analyzer-apiModeling.TrustNonnull
clang-analyzer-apiModeling.TrustReturnsNonnull
clang-analyzer-apiModeling.google.GTest
clang-analyzer-apiModeling.llvm.CastValue
clang-analyzer-apiModeling.llvm.ReturnValue
clang-analyzer-core.CallAndMessage
clang-analyzer-core.CallAndMessageModeling
clang-analyzer-core.DivideZero
clang-analyzer-core.DynamicTypePropagation
clang-analyzer-core.NonNullParamChecker
clang-analyzer-core.NonnilStringConstants
clang-analyzer-core.NullDereference
clang-analyzer-core.StackAddrEscapeBase
clang-analyzer-core.StackAddressEscape
clang-analyzer-core.VLASize
clang-analyzer-core.builtin.BuiltinFunctions
clang-analyzer-core.builtin.NoReturnFunctions
clang-analyzer-core.uninitialized.ArraySubscript
clang-analyzer-core.uninitialized.Assign
clang-analyzer-core.uninitialized.Branch
clang-analyzer-core.uninitialized.CapturedBlockVariable
clang-analyzer-core.uninitialized.UndefReturn
clang-analyzer-cplusplus.InnerPointer
clang-analyzer-cplusplus.Move
clang-analyzer-cplusplus.NewDelete
clang-analyzer-cplusplus.PlacementNew
clang-analyzer-cplusplus.PureVirtualCall
clang-analyzer-cplusplus.SmartPtrModeling
clang-analyzer-cplusplus.StringChecker
clang-analyzer-cplusplus.VirtualCallModeling
clang-analyzer-deadcode.DeadStores
clang-analyzer-fuchsia.HandleChecker
clang-analyzer-nullability.NullPassedToNonnull
clang-analyzer-nullability.NullReturnedFromNonnull
clang-analyzer-nullability.NullabilityBase
clang-analyzer-nullability.NullableDereferenced
clang-analyzer-nullability.NullablePassedToNonnull
clang-analyzer-nullability.NullableReturnedFromNonnull
clang-analyzer-optin.cplusplus.UninitializedObject
clang-analyzer-optin.cplusplus.VirtualCall
clang-analyzer-optin.mpi.MPI-Checker
clang-analyzer-optin.osx.OSObjectCStyleCast
clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker
clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker
clang-analyzer-optin.performance.GCDAntipattern
clang-analyzer-optin.portability.UnixAPI
clang-analyzer-security.FloatLoopCounter
clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
clang-analyzer-security.insecureAPI.SecuritySyntaxChecker
clang-analyzer-security.insecureAPI.UncheckedReturn
clang-analyzer-security.insecureAPI.bcmp
clang-analyzer-security.insecureAPI.bcopy
clang-analyzer-security.insecureAPI.bzero
clang-analyzer-security.insecureAPI.decodeValueOfObjCType
clang-analyzer-security.insecureAPI.getpw
clang-analyzer-security.insecureAPI.gets
clang-analyzer-security.insecureAPI.mkstemp
clang-analyzer-security.insecureAPI.mktemp
clang-analyzer-security.insecureAPI.rand
clang-analyzer-security.insecureAPI.strcpy
clang-analyzer-security.insecureAPI.vfork
clang-analyzer-unix.API
clang-analyzer-unix.DynamicMemoryModeling
clang-analyzer-unix.Malloc
clang-analyzer-unix.MallocSizeof
clang-analyzer-unix.MismatchedDeallocator
clang-analyzer-unix.Vfork
clang-analyzer-unix.cstring.BadSizeArg
clang-analyzer-unix.cstring.CStringModeling
clang-analyzer-unix.cstring.NullArg
clang-analyzer-valist.CopyToSelf
clang-analyzer-valist.Uninitialized
clang-analyzer-valist.Unterminated
clang-analyzer-valist.ValistBase
clang-analyzer-webkit.NoUncountedMemberChecker
clang-analyzer-webkit.RefCntblBaseVirtualDtor
clang-analyzer-webkit.UncountedLambdaCapturesChecker
cppcoreguidelines-avoid-c-arrays
cppcoreguidelines-avoid-goto
cppcoreguidelines-explicit-virtual-functions
cppcoreguidelines-init-variables
cppcoreguidelines-interfaces-global-init
cppcoreguidelines-macro-usage
cppcoreguidelines-narrowing-conversions
cppcoreguidelines-prefer-member-initializer
cppcoreguidelines-pro-type-const-cast
cppcoreguidelines-pro-type-static-cast-downcast
cppcoreguidelines-pro-type-union-access
cppcoreguidelines-pro-type-vararg
cppcoreguidelines-slicing
cppcoreguidelines-virtual-class-destructor
performance-faster-string-find
performance-for-range-copy
performance-implicit-conversion-in-loop
performance-inefficient-algorithm
performance-inefficient-string-concatenation
performance-inefficient-vector-operation
performance-move-const-arg
performance-move-constructor-init
performance-no-automatic-move
performance-no-int-to-ptr
performance-noexcept-move-constructor
performance-trivially-destructible
performance-type-promotion-in-math-fn
performance-unnecessary-copy-initialization
portability-restrict-system-includes
portability-simd-intrinsics
portability-std-allocator-const
-bugprone-unchecked-optional-access
-bugprone-unhandled-self-assignment
-clang-analyzer-core.UndefinedBinaryOperatorResult
-clang-analyzer-cplusplus.NewDeleteLeaks
-clang-analyzer-optin.performance.Padding
-cert-err58-cpp
-cert-oop54-cpp
-cppcoreguidelines-avoid-non-const-global-variables
-cppcoreguidelines-avoid-magic-numbers
-cppcoreguidelines-c-copy-assignment-signature
-cppcoreguidelines-no-malloc
-cppcoreguidelines-owning-memory
-cppcoreguidelines-pro-type-cstyle-cast
-cppcoreguidelines-pro-type-reinterpret-cast
-cppcoreguidelines-special-member-functions
-google-build-using-namespace
-google-global-names-in-headers
-google-readability-casting
-misc-definitions-in-headers
-misc-no-recursion
-misc-unconventional-assign-operator
-modernize-return-braced-init-list
-performance-unnecessary-value-param
-readability-function-cognitive-complexity
-readability-magic-numbers
'

# We treat all warnings as errors except for these few.
# Some of these exceptions like 'google-build-using-namespace'
# we should be able to manually fix project-wide and then
# remove from the omissions list.
WarningsAsErrors: '
*,
-bugprone-unchecked-optional-access,
-bugprone-unhandled-self-assignment,
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-optin.performance.Padding,
-cert-err58-cpp,
-cert-oop54-cpp,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-c-copy-assignment-signature,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-special-member-functions,
-google-build-using-namespace,
-google-global-names-in-headers,
-google-readability-casting,
-misc-definitions-in-headers,
-misc-no-recursion,
-misc-unconventional-assign-operator,
-modernize-return-braced-init-list,
-performance-unnecessary-value-param,
-readability-function-cognitive-complexity,
-readability-magic-numbers,
'
# We treat all warnings as errors.
WarningsAsErrors: '*'
dbanks12 marked this conversation as resolved.
Show resolved Hide resolved

# Notes on specific Checks and WarningsAsErrors
#
Expand Down Expand Up @@ -134,4 +209,4 @@ WarningsAsErrors: '
# -readability-magic-numbers,

HeaderFilterRegex: 'src/aztec3/'
FormatStyle: file
FormatStyle: file
Loading