You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Paste your configuration here -->environment:
sdk: '>=3.0.0 <4.0.0'flutter: ">=1.17.0"dependencies:
flutter:
sdk: flutterdio: ^5.1.2http_parser: ^4.0.2dev_dependencies:
flutter_test:
sdk: fluttermockito: ^5.4.0build_runner: ^2.3.3flutter_lints: ^2.0.1coverage: ^1.6.3dart_code_metrics: ^5.7.4</details>### What did you do?<!-- Paste the source code below: -->Flutter Pre-push not working with dart_code_metricsi have error Missing blank line before return. but pre-psuh not break.
#!/bin/sh
printf "\e[33;1m%s\e[0m\n" 'Pre-Commit is running now.'
Undo the stash of the files
pop_stash_files () {
if [ -n "$hasChanges" ]; then
printf "\e[33;1m%s\e[0m\n" '=== Applying git stash changes ==='
git stash pop
fi
}
Stash unstaged files
hasChanges=$(git diff)
if [ -n "$hasChanges" ]; then
printf "\e[33;1m%s\e[0m\n" 'Stashing unstaged changes'
git stash push --keep-index
fi
Flutter formatter
printf "\e[33;1m%s\e[0m\n" '=== Running Flutter Formatter ==='
dart format .
hasNewFilesFormatted=$(git diff)
if [ -n "$hasNewFilesFormatted" ]; then
git add .
printf "\e[33;1m%s\e[0m\n" 'Formmated files added to git stage'
fi
printf "\e[33;1m%s\e[0m\n" 'Finished running Flutter Formatter'
printf '%s\n' "${avar}"
printf "\e[33;1m%s\e[0m\n" '=== Running Unit Tests ==='
flutter test
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" '=== Unit tests error ==='
pop_stash_files
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Finished running Unit Tests'
printf '%s\n' "${avar}"
pop_stash_files
### What did you expect to happen?
pre-push want break when have error analyze
### What actually happened?
pre-push not working with dart_code_metrics
### Participation
- [X] I am willing to submit a pull request for this issue.
### Additional comments
_No response_
Environment and configuration
DCM version:
Dart SDK version:
Configuration
#!/bin/sh
printf "\e[33;1m%s\e[0m\n" 'Pre-Commit is running now.'
Undo the stash of the files
pop_stash_files () {
if [ -n "$hasChanges" ]; then
printf "\e[33;1m%s\e[0m\n" '=== Applying git stash changes ==='
git stash pop
fi
}
Stash unstaged files
hasChanges=$(git diff)
if [ -n "$hasChanges" ]; then
printf "\e[33;1m%s\e[0m\n" 'Stashing unstaged changes'
git stash push --keep-index
fi
Flutter formatter
printf "\e[33;1m%s\e[0m\n" '=== Running Flutter Formatter ==='
dart format .
hasNewFilesFormatted=$(git diff)
if [ -n "$hasNewFilesFormatted" ]; then
git add .
printf "\e[33;1m%s\e[0m\n" 'Formmated files added to git stage'
fi
printf "\e[33;1m%s\e[0m\n" 'Finished running Flutter Formatter'
printf '%s\n' "${avar}"
Flutter Analyzer
printf "\e[33;1m%s\e[0m\n" '=== Running Flutter analyzer ==='
flutter analyze
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" '=== Flutter analyzer error ==='
pop_stash_files
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Finished running Flutter analyzer'
printf '%s\n' "${avar}"
Run Flutter metrics analyze command
printf "\e[33;1m%s\e[0m\n" '=== Running Flutter metrics analyzer ==='
flutter pub run dart_code_metrics:metrics analyze lib
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" '=== Flutter analyzer error ==='
pop_stash_files
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Finished running Flutter metrics analyzer'
printf '%s\n' "${avar}"
Unit tests
printf "\e[33;1m%s\e[0m\n" '=== Running Unit Tests ==='
flutter test
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" '=== Unit tests error ==='
pop_stash_files
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Finished running Unit Tests'
printf '%s\n' "${avar}"
pop_stash_files