Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Flutter Pre-push not working with dart_code_metrics #1239

Copy link
Copy link
Open
@redevrx

Description

@redevrx
Issue body actions

Environment and configuration

DCM version:
Dart SDK version:

Configuration
<!-- Paste your configuration here -->
environment:
  sdk: '>=3.0.0 <4.0.0'
  flutter: ">=1.17.0"

dependencies:
  flutter:
    sdk: flutter
  dio: ^5.1.2
  http_parser: ^4.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  mockito: ^5.4.0
  build_runner: ^2.3.3
  flutter_lints: ^2.0.1
  coverage: ^1.6.3
  dart_code_metrics: ^5.7.4

</details>


### What did you do?

<!-- Paste the source code below: -->
Flutter Pre-push not working with dart_code_metrics
i 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}"

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



### 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_

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't workingSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.