Skip to content

clang-tidy script never reports linter issues #93279

@jmagman

Description

@jmagman

clang-tidy reports linter issues as warnings (except for compilation clang-diagnostic-errors), which doesn't get reported as failures or printed by the ci/lint.sh script.

🔶 linting flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm
Jobs: 100% done,   1/1   completed,  0 in progress,   0 pending,   0 failed.    

No lint problems found.

https://github.com/flutter/engine/blob/1ae721c0230e8e3f3618f7e9d301ad2133b2fd61/tools/clang_tidy/lib/clang_tidy.dart#L224

When I run the clang-tidy command directly, I see issues being reported:

$ ../../buildtools/mac-x64/clang/bin/clang-tidy /Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm --config= --  ++ -MD  obj/flutter/shell/platform/darwin/ios/framework/Source/flutter_framework_source.FlutterTextInputPlugin.o.d  -DFLUTTER_FRAMEWORK=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -D_DEBUG -DSHELL_ENABLE_SOFTWARE -DSHELL_ENABLE_GL -DSHELL_ENABLE_METAL -DSK_GL -DSK_METAL -DSK_ENABLE_DUMP_GPU -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_CODEC_DECODES_PNG -DSK_ENCODE_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_WEBP -DSK_HAS_WUFFS_LIBRARY -DSK_DISABLE_AAA -DSK_PARAGRAPH_LIBTXT_SPACES_RESOLUTION -DSK_LEGACY_INNER_JOINS -DSK_DISABLE_LEGACY_SHADERCONTEXT -DSK_DISABLE_LOWP_RASTER_PIPELINE -DSK_FORCE_RASTER_PIPELINE_BLITTER -DSK_DISABLE_EFFECT_DESERIALIZATION -DSK_ENABLE_SKSL -DSK_ASSUME_GL_ES=1 -DSK_ENABLE_API_AVAILABLE -DFLUTTER_RUNTIME_MODE_DEBUG=1 -DFLUTTER_RUNTIME_MODE_PROFILE=2 -DFLUTTER_RUNTIME_MODE_RELEASE=3 -DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4 "-DDART_LEGACY_API=[[deprecated]]" -DFLUTTER_RUNTIME_MODE=1 -DFLUTTER_JIT_RUNTIME=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DRAPIDJSON_HAS_STDSTRING -DRAPIDJSON_HAS_CXX11_RANGE_FOR -DRAPIDJSON_HAS_CXX11_RVALUE_REFS -DRAPIDJSON_HAS_CXX11_TYPETRAITS -DRAPIDJSON_HAS_CXX11_NOEXCEPT -DFLUTTER_API_SYMBOL_PREFIX=Embedder -DFLUTTER_NO_EXPORT  -I../.. -Igen -I../../third_party/skia -I../../third_party/vulkan/src -I../../third_party/vulkan/include -I../../flutter/third_party/txt/src -I../../third_party/harfbuzz/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/rapidjson -I../../third_party/rapidjson/include -I../../third_party/dart/runtime -I../../third_party/dart/runtime/include -I../../flutter/third_party -I../../flutter -I../../flutter/shell/platform/darwin/common/framework/Headers -isysroot /Users/m/Applications/Xcode-13_rc.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk -mios-simulator-version-min=9.0  -fno-strict-aliasing -arch x86_64 -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -Wunguarded-availability -Wno-deprecated-declarations -fvisibility=hidden -stdlib=libc++ -Wstring-conversion -Wnewline-eof -O0 -g2   -Werror=overriding-method-mismatch -Werror=undeclared-selector -fvisibility-inlines-hidden -fobjc-call-cxx-cdtors -std=c++17 -fno-rtti -fno-exceptions -nostdinc++ -isystem /Users/m/Applications/Xcode-13_rc.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1  -c ../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm -o  obj/flutter/shell/platform/darwin/ios/framework/Source/flutter_framework_source.FlutterTextInputPlugin.o
4 warnings generated.
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:414:5: warning: Incorrect decrement of the reference count of an object that is not owned at this point by the caller [clang-analyzer-osx.cocoa.RetainCount]
    [array release];
    ^
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:1310:71: note: Calling 'start'
  NSUInteger currentIndex = ((FlutterTextPosition*)_selectedTextRange.start).index;
                                                                      ^~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:440:10: note: Calling 'positionWithIndex:'
  return [FlutterTextPosition positionWithIndex:self.range.location];
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:405:11: note: Calling 'initWithIndex:'
  return [[[FlutterTextPosition alloc] initWithIndex:index] autorelease];
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:410:7: note: 'self' is non-nil
  if (self) {
      ^~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:410:3: note: Taking true branch
  if (self) {
  ^
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:413:22: note: NSArray literal is an object with a +0 retain count
    NSArray *array = @[@"test"];
                     ^~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:414:5: note: Incorrect decrement of the reference count of an object that is not owned at this point by the caller
    [array release];
    ^~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:506:25: warning: Nullable pointer is passed to a callee that requires a non-null 1st parameter [clang-analyzer-nullability.NullablePassedToNonnull]
  NSString* textAfter = [_textInputView
                        ^
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:507:19: note: Nullability 'nullable' is inferred
      textInRange:[_textInputView textRangeFromPosition:position
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:506:25: note: Nullable pointer is passed to a callee that requires a non-null 1st parameter
  NSString* textAfter = [_textInputView
                        ^
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:740:3: warning: The '_markedTextStyle' ivar in 'FlutterTextInputView' was copied by a synthesized property but not released before '[super dealloc]' [clang-analyzer-osx.cocoa.Dealloc]
  [super dealloc];
  ^
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:544:3: note: Calling 'dealloc'
  [super dealloc];
  ^~~~~~~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:740:3: note: The '_markedTextStyle' ivar in 'FlutterTextInputView' was copied by a synthesized property but not released before '[super dealloc]'
  [super dealloc];
  ^~~~~~~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:740:3: warning: The '_textContentType' ivar in 'FlutterTextInputView' was copied by a synthesized property but not released before '[super dealloc]' [clang-analyzer-osx.cocoa.Dealloc]
  [super dealloc];
  ^
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:544:3: note: Calling 'dealloc'
  [super dealloc];
  ^~~~~~~~~~~~~~~
/Users/m/Projects/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm:740:3: note: The '_textContentType' ivar in 'FlutterTextInputView' was copied by a synthesized property but not released before '[super dealloc]'
  [super dealloc];
  ^~~~~~~~~~~~~~~

We probably don't want all warnings reported as errors, but probably some can be turned on.

See #91857 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.engineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions