Merge pull request #322 from flame-engine/luan.fix-linter

Adding linter to build & fix lint issues
This commit is contained in:
Luan Nico
2020-05-09 14:06:58 -04:00
committed by GitHub
7 changed files with 21 additions and 14 deletions

View File

@ -15,5 +15,5 @@ jobs:
with:
channel: 'stable'
- run: flutter pub get
- run: ./scripts/format.sh
- run: ./scripts/lint.sh
- run: flutter test

View File

@ -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';

View File

@ -78,7 +78,7 @@ abstract class PositionComponent extends Component {
bool renderFlipX = false;
bool renderFlipY = false;
bool debugMode = false;
List<PositionComponentEffect> _effects = [];
final List<PositionComponentEffect> _effects = [];
Color get debugColor => const Color(0xFFFF00FF);

View File

@ -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;
}
}
}

View File

@ -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';

View File

@ -1,6 +0,0 @@
if [[ $(flutter format -n .) ]]; then
echo "files not formatted"
exit 1
else
exit 0
fi

13
scripts/lint.sh Executable file
View File

@ -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