xuzhongpeng / git_hooks Goto Github PK
View Code? Open in Web Editor NEWUsing dart prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge...).
License: MIT License
Using dart prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge...).
License: MIT License
Not all users have bash (eg zsh)
And source ~/.bash_profile
throw exception
How can I add the following commands to a pre-push?
As it is done here: https://medium.com/@MiBLT/improving-your-flutter-code-7424b10dc16a
Hi! Do you have any plans to create a null-safety release? I can help with this if you need any help although I don't really know how to properly create a tests for this.
The .git
configuration of the project is in the root of the monorepo, which is not a Flutter app (no pubspec.yaml). This monorepo contains different Flutter apps talking relatively importing each other. I'm interested to know if there are available workarounds getting git_hooks
to work subdirectories of Flutter apps in a monorepo.
git_hooks
within one of the Flutter subdirectory$ git_hooks create bin/git_hooks.dart
create files... /Invalid argument(s): .git is not exists in your project
git_hooks
in the root (obviously won't work)$ git_hooks create bin/git_hooks.dart
... app/pubspec.yaml' (OS Error: No such file or directory, errno = 2)
monorepo
Thanks for the great work on this tool
git commit 时提示
tool/git_hooks.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.16
I currently have a project that has built-in libraries as sub-modules, and I'd like to set up hooks for those as well. What would be the way?
I noticed that this package still has not migrated to the null safety, so I created PR #10
Dart recommends that internal tools and scripts should be added under the tool/
directory instead of bin/
(https://dart.dev/tools/pub/package-layout#internal-tools-and-scripts).
Use case:
When publishing packages to pub.dev, pub will complain if there are executables under bin/
that include dev_dependencies:
* line 4, column 1 of bin/git_hooks.dart: git_hooks is in the `dev_dependencies` section of `pubspec.yaml`. Packages used in bin/ must be declared in the `dependencies` section.
╷
4 │ import 'package:git_hooks/git_hooks.dart';
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
报错信息如下
../../Develop/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
^
../../Develop/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
^
../../Develop/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/banner_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/bottom_sheet.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
../../Develop/flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
git_hooks create
Can't load Kernel binary: Invalid kernel binary format version.
No active package git_hooks.
I can't run GitHooks.init(targetPath: "bin/git_hooks.dart"); because the path could not be received. Help me
E/flutter ( 6252): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PathNotFoundException: Cannot open file, path = '' (OS Error: No such file or directory, errno = 2)
E/flutter ( 6252): #0 _File.throwIfError (dart:io/file_impl.dart:629:7)
E/flutter ( 6252): #1 _File.openSync (dart:io/file_impl.dart:473:5)
E/flutter ( 6252): #2 _File.readAsBytesSync (dart:io/file_impl.dart:533:18)
E/flutter ( 6252): #3 _File.readAsStringSync (dart:io/file_impl.dart:578:18)
E/flutter ( 6252): #4 Utils.getOwnPath (package:git_hooks/utils/utils.dart:20:17)
E/flutter ( 6252): #5 GitHooks.init (package:git_hooks/runtime/git_hooks.dart:23:15)
I got this error on windows machine, on mac it doesn't have this error. It makes me unable to execute any commands with git
If you use commit using source tree or git ide, you will get an error. But if I use the terminal to commit: git commit -m 'test format', nothing happens. This makes error tracking impossible
$ git clone xxxxxx & cd xxxx
$ pub global activate git_hooks
$ git_hooks create git_hooks.dart
???
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.