From 037564c6a3e976a05e1cb25ef22337d5823f8da8 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 28 Sep 2021 12:19:19 +1000 Subject: [PATCH] Adds workflow for code linting --- .github/workflows/lint.yaml | 28 ++++++++++++++++++++++++++++ analysis_options.yaml | 8 ++++++++ lib/widget/home.dart | 15 --------------- pubspec.lock | 7 +++++++ pubspec.yaml | 1 + 5 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/lint.yaml create mode 100644 analysis_options.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..b5300e5d --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,28 @@ +# Run flutter linting checks + +name: linting + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: subosito/flutter-action@v1 + with: + flutter-version: '2.2.3' + - run: flutter pub get + - run: flutter analyze + \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 00000000..f177c41e --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,8 @@ +include: package:lint/analysis_options.yaml + +linter: + rules: + # ------ Disable individual rules ----- # + # --- # + # Turn off what you don't like. # + # ------------------------------------- # diff --git a/lib/widget/home.dart b/lib/widget/home.dart index 1d7ef528..77f59ef5 100644 --- a/lib/widget/home.dart +++ b/lib/widget/home.dart @@ -261,25 +261,10 @@ class _InvenTreeHomePageState extends State { @override Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. return Scaffold( key: _homeKey, appBar: AppBar( title: Text(L10().appTitle), - actions: [ - // IconButton( - // icon: FaIcon(FontAwesomeIcons.barcode), - // tooltip: L10().scanBarcode, - // onPressed: () { - // _scan(context); - // }, - // ), - ], ), drawer: new InvenTreeDrawer(context), body: ListView( diff --git a/pubspec.lock b/pubspec.lock index 6a5f06d6..9d6d2aca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -336,6 +336,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.3" + lint: + dependency: "direct dev" + description: + name: lint + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" markdown: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f562a966..230d6628 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,6 +48,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_launcher_icons: + lint: ^1.0.0 flutter_icons: android: true