Fix indentation

This commit is contained in:
Lukas Klingsbo
2020-05-26 00:02:33 +02:00
parent 3a36709d26
commit bc417537d6

View File

@ -1,54 +1,54 @@
#!/usr/bin/env bash -xe #!/usr/bin/env bash -xe
if [[ $(flutter format -n .) ]]; then if [[ $(flutter format -n .) ]]; then
echo "flutter format issue" echo "flutter format issue"
exit 1 exit 1
fi fi
flutter pub get flutter pub get
result=$(dartanalyzer lib/) result=$(dartanalyzer lib/)
if ! echo "$result" | grep -q "No issues found!"; then if ! echo "$result" | grep -q "No issues found!"; then
echo "$result" echo "$result"
echo "dartanalyzer issue: lib" echo "dartanalyzer issue: lib"
exit 1 exit 1
fi fi
analyzer() { analyzer() {
cd $1 cd $1
flutter pub get flutter pub get
result=$(dartanalyzer .) result=$(dartanalyzer .)
if ! echo "$result" | grep -q "No issues found!"; then if ! echo "$result" | grep -q "No issues found!"; then
echo "$result" echo "$result"
echo "dartanalyzer issue: $1" echo "dartanalyzer issue: $1"
exit 1 exit 1
fi fi
cd - > /dev/null cd - > /dev/null
} }
analyzer "example" analyzer "example"
# Examples that are changed # Examples that are changed
changed=$(git diff --name-only develop... doc/examples \ changed=$(git diff --name-only develop... doc/examples \
| xargs -I {} dirname {} | sed 's/\/lib$//' | uniq \ | xargs -I {} dirname {} | sed 's/\/lib$//' | uniq \
| xargs -I {} find {} -name pubspec.yaml | xargs -I {} dirname {}) | xargs -I {} find {} -name pubspec.yaml | xargs -I {} dirname {})
# Examples that are affected by changed code # Examples that are affected by changed code
affected=$(git diff --name-only develop... lib/ \ affected=$(git diff --name-only develop... lib/ \
| xargs -I {} basename {} | xargs -I {} grep -r -l --include \*.dart {} doc/examples/ \ | xargs -I {} basename {} | xargs -I {} grep -r -l --include \*.dart {} doc/examples/ \
| xargs -I {} dirname {} | sed 's/\/lib$//' | uniq \ | xargs -I {} dirname {} | sed 's/\/lib$//' | uniq \
| xargs -I {} find {} -name pubspec.yaml | xargs -I {} dirname {}) | xargs -I {} find {} -name pubspec.yaml | xargs -I {} dirname {})
both=("${changed[@]}" "${affected[@]}") both=("${changed[@]}" "${affected[@]}")
lint_examples=$(printf "%s\n" "${both[@]}" | sort -u) lint_examples=$(printf "%s\n" "${both[@]}" | sort -u)
for d in $lint_examples; do for d in $lint_examples; do
analyzer $d analyzer $d
done done
for f in doc/examples/**/pubspec.yaml; do for f in doc/examples/**/pubspec.yaml; do
d=$(dirname $f) d=$(dirname $f)
if [[ ! " ${lint_examples[@]} " =~ " ${d} " ]]; then if [[ ! " ${lint_examples[@]} " =~ " ${d} " ]]; then
analyzer $d analyzer $d
fi fi
done done
echo "success" echo "success"