From e0da1c9567e4dccd3c1624b0f33320815d624b9c Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 11 Oct 2019 17:45:06 -0700 Subject: [PATCH 1/2] Run clang analyzer on iOS and macOS code when packages change --- script/lint_darwin_plugins.sh | 43 ++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/script/lint_darwin_plugins.sh b/script/lint_darwin_plugins.sh index 6bcf93f336a9..f01b394c1d78 100755 --- a/script/lint_darwin_plugins.sh +++ b/script/lint_darwin_plugins.sh @@ -13,31 +13,52 @@ function lint_package() { local package_dir="${REPO_DIR}/packages/$package_name/" local failure_count=0 + # These podspecs are temporary multi-platform adoption dummy files. local skipped_podspecs=( - 'url_launcher_web.podspec' + "url_launcher_web.podspec" ) - find "${package_dir}" -type f -name '*\.podspec' | while read podspec; do - # These podspecs are temporary multi-platform adoption dummy files. - if [[ "${skipped_podspecs[*]}" =~ "$(basename ${podspec})" ]]; then + + # TODO: These packages have analyzer warnings. Remove plugins from this list as issues are fixed. + local skip_analysis_packages=( + "camera.podspec" + "image_picker.podspec" + "in_app_purchase.podspec" + ) + find "${package_dir}" -type f -name "*\.podspec" | while read podspec; do + local podspecBasename=$(basename "${podspec}") + if [[ "${skipped_podspecs[*]}" =~ "${podspecBasename}" ]]; then continue fi - echo "Linting $(basename ${podspec})" + # TODO: Remove --allow-warnings flag https://github.com/flutter/flutter/issues/41444 + local lint_args=( + lib + lint + "${podspec}" + --allow-warnings + --fail-fast + --silent + ) + if [[ ! "${skip_analysis_packages[*]}" =~ "${podspecBasename}" ]]; then + lint_args+=(--analyze) + echo "Linting and analyzing ${podspecBasename}" + else + echo "Linting ${podspecBasename}" + fi # Build as frameworks. # This will also run any tests set up as a test_spec. See https://blog.cocoapods.org/CocoaPods-1.3.0. - # TODO: Add --analyze flag https://github.com/flutter/flutter/issues/41443 - # TODO: Remove --allow-warnings flag https://github.com/flutter/flutter/issues/41444 - pod lib lint "${podspec}" --allow-warnings --fail-fast --silent + pod "${lint_args[@]}" if [[ "$?" -ne 0 ]]; then - error "Package ${package_name} has framework issues. Run \"pod lib lint $podspec\" to inspect." + error "Package ${package_name} has framework issues. Run \"pod lib lint ${podspec} --analyze\" to inspect." failure_count+=1 fi # Build as libraries. - pod lib lint "${podspec}" --allow-warnings --use-libraries --fail-fast --silent + lint_args+=(--use-libraries) + pod "${lint_args[@]}" if [[ "$?" -ne 0 ]]; then - error "Package ${package_name} has library issues. Run \"pod lib lint $podspec --use-libraries\" to inspect." + error "Package ${package_name} has library issues. Run \"pod lib lint ${podspec} --use-libraries --analyze\" to inspect." failure_count+=1 fi done From a8bfb132db4dd2b5e1305fa19069fb64ab6719a0 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Mon, 14 Oct 2019 12:54:21 -0700 Subject: [PATCH 2/2] Add analyzer issue links --- script/lint_darwin_plugins.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/lint_darwin_plugins.sh b/script/lint_darwin_plugins.sh index f01b394c1d78..0ae55c957f69 100755 --- a/script/lint_darwin_plugins.sh +++ b/script/lint_darwin_plugins.sh @@ -20,9 +20,9 @@ function lint_package() { # TODO: These packages have analyzer warnings. Remove plugins from this list as issues are fixed. local skip_analysis_packages=( - "camera.podspec" - "image_picker.podspec" - "in_app_purchase.podspec" + "camera.podspec" # https://github.com/flutter/flutter/issues/42673 + "image_picker.podspec" # https://github.com/flutter/flutter/issues/42678 + "in_app_purchase.podspec" # https://github.com/flutter/flutter/issues/42679 ) find "${package_dir}" -type f -name "*\.podspec" | while read podspec; do local podspecBasename=$(basename "${podspec}")