diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed13c9084..53425c73e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,5 +15,5 @@ jobs: with: channel: 'stable' - run: flutter pub get - - run: ./scripts/format.sh + - run: ./scripts/lint.sh - run: flutter test diff --git a/lib/box2d/box2d_game.dart b/lib/box2d/box2d_game.dart index 8def1dfa5..501a51362 100644 --- a/lib/box2d/box2d_game.dart +++ b/lib/box2d/box2d_game.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:flame/box2d/box2d_component.dart'; import 'package:flame/box2d/contact_callbacks.dart'; import 'package:flame/components/component.dart'; diff --git a/lib/components/component.dart b/lib/components/component.dart index 8a1b74ac8..96fd1fa85 100644 --- a/lib/components/component.dart +++ b/lib/components/component.dart @@ -78,7 +78,7 @@ abstract class PositionComponent extends Component { bool renderFlipX = false; bool renderFlipY = false; bool debugMode = false; - List _effects = []; + final List _effects = []; Color get debugColor => const Color(0xFFFF00FF); diff --git a/lib/components/flare_component.dart b/lib/components/flare_component.dart index f1af890d5..f61b6dc5b 100644 --- a/lib/components/flare_component.dart +++ b/lib/components/flare_component.dart @@ -46,12 +46,16 @@ class FlareComponent extends PositionComponent { @override set width(_width) { super.width = _width; - if (loaded()) _flareAnimation.width = width; + if (loaded()) { + _flareAnimation.width = width; + } } @override set height(_height) { super.height = _height; - if (loaded()) _flareAnimation.height = height; + if (loaded()) { + _flareAnimation.height = height; + } } } diff --git a/lib/flame.dart b/lib/flame.dart index 619fb73d7..64ed74c19 100644 --- a/lib/flame.dart +++ b/lib/flame.dart @@ -1,8 +1,6 @@ library flame; import 'package:audioplayers/audio_cache.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; diff --git a/scripts/format.sh b/scripts/format.sh deleted file mode 100755 index d6703875d..000000000 --- a/scripts/format.sh +++ /dev/null @@ -1,6 +0,0 @@ -if [[ $(flutter format -n .) ]]; then - echo "files not formatted" - exit 1 -else - exit 0 -fi \ No newline at end of file diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 000000000..2751a3dcb --- /dev/null +++ b/scripts/lint.sh @@ -0,0 +1,13 @@ +if [[ $(flutter format -n .) ]]; then + echo "flutter format issue" + exit 1 +fi + +result=`dartanalyzer lib/` +if ! echo "$result" | grep -q "No issues found!"; then + echo "dartanalyzer issue" + exit 1 +fi + +echo "success" +exit 0