Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 8697a03

Browse files
authored
Run clang analyzer on iOS and macOS code in CI test when packages change (#2186)
1 parent 63d0571 commit 8697a03

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

script/lint_darwin_plugins.sh

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,52 @@ function lint_package() {
1313
local package_dir="${REPO_DIR}/packages/$package_name/"
1414
local failure_count=0
1515

16+
# These podspecs are temporary multi-platform adoption dummy files.
1617
local skipped_podspecs=(
17-
'url_launcher_web.podspec'
18+
"url_launcher_web.podspec"
1819
)
19-
find "${package_dir}" -type f -name '*\.podspec' | while read podspec; do
20-
# These podspecs are temporary multi-platform adoption dummy files.
21-
if [[ "${skipped_podspecs[*]}" =~ "$(basename ${podspec})" ]]; then
20+
21+
# TODO: These packages have analyzer warnings. Remove plugins from this list as issues are fixed.
22+
local skip_analysis_packages=(
23+
"camera.podspec" # https://github.com/flutter/flutter/issues/42673
24+
"image_picker.podspec" # https://github.com/flutter/flutter/issues/42678
25+
"in_app_purchase.podspec" # https://github.com/flutter/flutter/issues/42679
26+
)
27+
find "${package_dir}" -type f -name "*\.podspec" | while read podspec; do
28+
local podspecBasename=$(basename "${podspec}")
29+
if [[ "${skipped_podspecs[*]}" =~ "${podspecBasename}" ]]; then
2230
continue
2331
fi
2432

25-
echo "Linting $(basename ${podspec})"
33+
# TODO: Remove --allow-warnings flag https://github.com/flutter/flutter/issues/41444
34+
local lint_args=(
35+
lib
36+
lint
37+
"${podspec}"
38+
--allow-warnings
39+
--fail-fast
40+
--silent
41+
)
42+
if [[ ! "${skip_analysis_packages[*]}" =~ "${podspecBasename}" ]]; then
43+
lint_args+=(--analyze)
44+
echo "Linting and analyzing ${podspecBasename}"
45+
else
46+
echo "Linting ${podspecBasename}"
47+
fi
2648

2749
# Build as frameworks.
2850
# This will also run any tests set up as a test_spec. See https://blog.cocoapods.org/CocoaPods-1.3.0.
29-
# TODO: Add --analyze flag https://github.com/flutter/flutter/issues/41443
30-
# TODO: Remove --allow-warnings flag https://github.com/flutter/flutter/issues/41444
31-
pod lib lint "${podspec}" --allow-warnings --fail-fast --silent
51+
pod "${lint_args[@]}"
3252
if [[ "$?" -ne 0 ]]; then
33-
error "Package ${package_name} has framework issues. Run \"pod lib lint $podspec\" to inspect."
53+
error "Package ${package_name} has framework issues. Run \"pod lib lint ${podspec} --analyze\" to inspect."
3454
failure_count+=1
3555
fi
3656

3757
# Build as libraries.
38-
pod lib lint "${podspec}" --allow-warnings --use-libraries --fail-fast --silent
58+
lint_args+=(--use-libraries)
59+
pod "${lint_args[@]}"
3960
if [[ "$?" -ne 0 ]]; then
40-
error "Package ${package_name} has library issues. Run \"pod lib lint $podspec --use-libraries\" to inspect."
61+
error "Package ${package_name} has library issues. Run \"pod lib lint ${podspec} --use-libraries --analyze\" to inspect."
4162
failure_count+=1
4263
fi
4364
done

0 commit comments

Comments
 (0)