Skip to content

Commit

Permalink
ci: reintroduce limited tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad committed Jul 28, 2023
1 parent eb4aa93 commit 252b37c
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 79 deletions.
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
180 changes: 116 additions & 64 deletions circuits/cpp/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,124 @@
# 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.
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.UndefinedBinaryOperatorResult
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.SelfAssignment
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
'

# 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: '*'

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

HeaderFilterRegex: 'src/aztec3/'
FormatStyle: file
FormatStyle: file
4 changes: 2 additions & 2 deletions circuits/cpp/scripts/tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ echo "Before running clang-tidy, MD5 of all C++ files was: $BEFORE_MD5"
echo "*************************************************************************"

# Need run-clang-tidy version 15, but it doesn't have a --version flag
RUN_TIDY=$(which run-clang-tidy-15 || which run-clang-tidy)
RUN_TIDY=$(which run-clang-tidy-15 || which run-clang-tidy || which run-clang-tidy-mp-15)
# tidy all sources
$RUN_TIDY -p $BUILD_DIR $SOURCES $FIX_OPT -use-color || {\
echo "Errors encountered when running clang-tidy!" &&
Expand Down Expand Up @@ -99,4 +99,4 @@ else
echo "To apply these fixes later, run the following from circuits/cpp:"
echo " clang-apply-replacements --format --style file $EXPORT_DIR"
fi
echo "*************************************************************************"
echo "*************************************************************************"

0 comments on commit 252b37c

Please sign in to comment.