瀏覽代碼

For CI - upgrade to Clang-Tidy 4.0.

Yao Wei Tjong 8 年之前
父節點
當前提交
cfb6cdacf1
共有 3 個文件被更改,包括 18 次插入9 次删除
  1. 15 5
      .clang-tidy
  2. 1 1
      .travis.yml
  3. 2 3
      Rakefile

+ 15 - 5
.clang-tidy

@@ -22,17 +22,17 @@
 
 ---
 
-Checks: '*,-cert-env33-c,-cert-dcl50-cpp,-cert-dcl59-cpp,-cert-err58-cpp,-cppcoreguidelines-no-malloc,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-static-cast-downcast,-google-*,google-default-arguments,google-explicit-constructor,google-runtime-member-string-references,google-runtime-memset,google-runtime-operator,-hicpp-named-parameter,-hicpp-no-assembler,-hicpp-function-size,-hicpp-special-member-functions,-llvm-*,-readability-else-after-return,-readability-implicit-bool-cast,-readability-named-parameter,-readability-simplify-boolean-expr,-readability-braces-around-statements,-readability-identifier-naming,-readability-function-size,-readability-redundant-member-init,-misc-bool-pointer-implicit-conversion,-misc-definitions-in-headers,-misc-unused-alias-decls,-misc-unused-parameters,-misc-unused-using-decls,-modernize-use-default-member-init,-modernize-use-using,-modernize-raw-string-literal,-clang-diagnostic-*,-clang-analyzer-*'
+Checks: '*,-cert-env33-c,-cert-dcl50-cpp,-cert-dcl59-cpp,-cert-err58-cpp,-cppcoreguidelines-no-malloc,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-cstyle-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-static-cast-downcast,-google-*,google-default-arguments,google-explicit-constructor,google-runtime-member-string-references,google-runtime-memset,google-runtime-operator,-hicpp-named-parameter,-hicpp-no-assembler,-hicpp-function-size,-hicpp-special-member-functions,-llvm-*,-readability-else-after-return,-readability-implicit-bool-cast,-readability-named-parameter,-readability-simplify-boolean-expr,-readability-braces-around-statements,-readability-identifier-naming,-readability-function-size,-readability-redundant-member-init,-readability-redundant-declaration,-misc-bool-pointer-implicit-conversion,-misc-definitions-in-headers,-misc-unused-alias-decls,-misc-unused-parameters,-misc-unused-using-decls,-modernize-use-default-member-init,-modernize-use-using,-modernize-raw-string-literal,-clang-diagnostic-*,-clang-analyzer-*'
 WarningsAsErrors: ''
 HeaderFilterRegex: '/(?!ThirdParty)/'
 AnalyzeTemporaryDtors: false
 CheckOptions:
+  - key:             cert-err09-cpp.CheckThrowTemporaries
+    value:           '1'
   - key:             cert-err61-cpp.CheckThrowTemporaries
     value:           '1'
   - key:             cert-oop11-cpp.IncludeStyle
     value:           llvm
-  - key:             cert-oop11-cpp.UseCERTSemantics
-    value:           '1'
   - key:             google-readability-braces-around-statements.ShortStatementLines
     value:           '1'
   - key:             google-readability-function-size.StatementThreshold
@@ -41,6 +41,8 @@ CheckOptions:
     value:           '10'
   - key:             google-readability-namespace-comments.SpacesBeforeComments
     value:           '2'
+  - key:             misc-argument-comment.StrictMode
+    value:           '0'
   - key:             misc-assert-side-effect.AssertMacros
     value:           assert
   - key:             misc-assert-side-effect.CheckFunctionCalls
@@ -51,8 +53,6 @@ CheckOptions:
     value:           '1'
   - key:             misc-move-constructor-init.IncludeStyle
     value:           llvm
-  - key:             misc-move-constructor-init.UseCERTSemantics
-    value:           '0'
   - key:             misc-sizeof-expression.WarnOnSizeOfCompareToConstant
     value:           '1'
   - key:             misc-sizeof-expression.WarnOnSizeOfConstant
@@ -63,6 +63,8 @@ CheckOptions:
     value:           '8388608'
   - key:             misc-string-constructor.WarnOnLargeLength
     value:           '1'
+  - key:             misc-suspicious-enum-usage.StrictMode
+    value:           '0'
   - key:             misc-suspicious-missing-comma.MaxConcatenatedTokens
     value:           '5'
   - key:             misc-suspicious-missing-comma.RatioThreshold
@@ -85,6 +87,8 @@ CheckOptions:
     value:           CamelCase
   - key:             modernize-pass-by-value.IncludeStyle
     value:           llvm
+  - key:             modernize-pass-by-value.ValuesOnly
+    value:           '0'
   - key:             modernize-replace-auto-ptr.IncludeStyle
     value:           llvm
   - key:             modernize-use-auto.RemoveStars
@@ -95,10 +99,16 @@ CheckOptions:
     value:           '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
   - key:             modernize-use-nullptr.NullMacros
     value:           'NULL'
+  - key:             modernize-use-transparent-functors.SafeMode
+    value:           '0'
   - key:             performance-faster-string-find.StringLikeClasses
     value:           'std::basic_string'
   - key:             performance-for-range-copy.WarnOnAllAutoCopies
     value:           '0'
+  - key:             performance-inefficient-string-concatenation.StrictMode
+    value:           '0'
+  - key:             performance-type-promotion-in-math-fn.IncludeStyle
+    value:           llvm
   - key:             performance-unnecessary-value-param.IncludeStyle
     value:           llvm
 

+ 1 - 1
.travis.yml

@@ -144,7 +144,7 @@ matrix:
     - stage: lint
       <<: *base
       env: URHO3D_LINT=1
-      before_script: git clone --depth 1 https://github.com/urho3d/fastcomp-clang.git && export PATH=$(pwd)/fastcomp-clang/bin:$PATH
+      before_script: git clone --depth 1 -b incoming https://github.com/urho3d/fastcomp-clang.git && export PATH=$(pwd)/fastcomp-clang/bin:$PATH
       script: *ci
 
 ---

+ 2 - 3
Rakefile

@@ -377,10 +377,9 @@ task :ci do
     lint_err = File.read('/tmp/lint.err')
     puts "\nLinter result:\n\n#{lint_err}\n"; $stdout.flush
     # Exclude ThirdParty and generated code
-    # Also exclude a false positive caused by "modernize-use-bool-literals" check on FD_ZERO macro; TODO: to be removed after upgrading to version 4.0
-    filtered_lint_err = lint_err.scan(/(.+:\d+:\d+:.+\[.+\])/).flatten.select { |it| it =~ /\[\w+-.+\]/ }.reject { |it| it =~ /ThirdParty|generated|NamedPipe.cpp.+?modernize-use-bool-literals/ }
+    filtered_lint_err = lint_err.scan(/(.+:\d+:\d+:.+\[.+\])/).flatten.select { |it| it =~ /\[\w+-.+\]/ }.reject { |it| it =~ /ThirdParty|generated|HashMap\.h.+?clang-analyzer-core.CallAndMessag/ }
     unless filtered_lint_err.empty?
-      puts "New linter error(s) found:\n"
+      puts "New linter error(s) found:\n\n"
       filtered_lint_err.each { |it| puts it }
       puts; $stdout.flush
       abort 'Failed to pass linter checks'