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

Sign up
Appearance settings

Commit 17125bb

Browse files
Balázs VargaBalázs Varga
Balázs Varga
authored and
Balázs Varga
committed
Add a pre-commit hook for Flutter Application or Plugin development
1 parent 0539b79 commit 17125bb

File tree

3 files changed

+78
-3
lines changed

3 files changed

+78
-3
lines changed

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2020 Balázs Varga
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

‎README.md‎

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
1-
# flutter-git-hooks
2-
Git hooks collection for Flutter project
1+
# Git hooks
2+
This repo contains git hooks for Flutter Application or Plugin Development.
3+
4+
The purpose of this collection to gather some scripts which help to improve the quality of developed applications. I believe in fail-fast philosophy, thus I wrote these hooks.
5+
6+
In my mind, pre-commit hooks can reduce CI costs. Additionally, we will get quick feedback on our changes to the application.
7+
8+
## Description
9+
10+
This repo contains a __pre-commit__ hook for Flutter Application or Plugin development. It cleans the workspace and then runs `analyze` and `test` commands on the project.
11+
12+
## Requirements
13+
The `flutter` command must be available on the `PATH`.
14+
15+
## How to use
16+
17+
Add the contents of this repo to your root project as a git subtree. You can just copy it into `.git/hooks` folder. However, if you do not want to lose the benefits of git, please follow the description below.
18+
19+
```
20+
cd $PROJECT
21+
git remote add flutter-git-hooks https://github.com/warnyul/flutter-git-hooks.git
22+
git subtree add --prefix=git-hooks/ flutter-git-hooks master
23+
```
24+
__Any person who clones your project must symlink the folder into `.git` folder__
25+
26+
```
27+
mv .git/hooks .git/hooks.old && ln -s ../git-hooks .git/hooks
28+
```
29+
## Update hooks
30+
You can update the hooks inside your project if necessary. So, enter your project's folder and pull changes from remote.
31+
32+
```
33+
cd $PROJECT
34+
git remote add flutter-git-hooks https://github.com/warnyul/flutter-git-hooks.git
35+
git fetch flutter-git-hooks master
36+
git subtree pull --prefix=git-hooks/ flutter-git-hooks master
37+
```
38+
39+
# License
40+
41+
Copyright 2020 Balázs Varga
42+
43+
Licensed under the Apache License, Version 2.0 (the "License");
44+
you may not use this file except in compliance with the License.
45+
You may obtain a copy of the License at
46+
47+
http://www.apache.org/licenses/LICENSE-2.0
48+
49+
Unless required by applicable law or agreed to in writing, software
50+
distributed under the License is distributed on an "AS IS" BASIS,
51+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52+
See the License for the specific language governing permissions and
53+
limitations under the License.

‎pre-commit‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright (C) 2020 Balázs Varga
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
#!/usr/bin/env sh
18+
19+
# Clean workspace before check
20+
flutter clean
21+
# Static code analysis
22+
flutter analyze || exit 1
23+
# Run unit tests
24+
flutter test || exit 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /