Comments (7)
Hi. What exactly is your problem? Maybe you can show some error logs. Running the tool inside of a subfolder is already supported. All you need to do is specify the directory to run the command in:
# simply cd into your directory before running the script
cd my/subdir
dart run dart_pre_commit
# or install it globally...
dart pub global activate dart_pre_commit
# ... and use the `-d` switch
dart pub global run dart_pre_commit -d my/subdir
from dart_pre_commit.
Hi, So actually I'm using DartPreCommit
via git_hooks
package, so basically I'm running it with dart via DartPreCommit.run();
So this runs from root of my git folder, hence not able to find the pubspec.yaml
file which is inside a subfolder.
Only if there was a parameter to pass to DartPreCommit.run()
to specify the project subfolder, it would find the pubspec.yaml
file
See what I'm doing:
void main(List<String> arguments) {
Map<Git, UserBackFun> params = {
Git.preCommit: _preCommit,
};
GitHooks.call(arguments, params);
}
Future<bool> _preCommit() async {
final result = await DartPreCommit.run();
return result.isSuccess;
}
from dart_pre_commit.
I am not sure if it is possible to use the git_hooks
package without a top level pubspec.yaml
. However, if we assume it does work, you can easily set the directory to be scanned by changing the current working directory of the script:
Future<bool> _preCommit() async {
Directory.current = 'my/subdir';
final result = await DartPreCommit.run();
return result.isSuccess;
}
from dart_pre_commit.
Did this fix your problem?
from dart_pre_commit.
Did this fix your problem?
Hi, yes this worked perfectly for me.
I think we should include this piece of information in the readme, if you allow me I'd like to add
from dart_pre_commit.
Yes, I am always happy to accepts PRs, feel free to do so
from dart_pre_commit.
Thankyou, I'll send PR.
from dart_pre_commit.
Related Issues (20)
- Allow manual selection of logger backend from commandline
- stderr-forwarding does not sync with status message
- Add check the makes sure library imports are not used in tests or src files
- Add check the verifies that all src files are exported
- Analyze Task is broken
- Error: Member not found: 'Hooks.create' HOT 3
- dart format line length option HOT 3
- lib-exports on flutter skeleton app HOT 3
- dart_test_tools-4.7.0/.../test_import_linter.dart: Error: A value of type 'String?' can't be assigned to a variable of type 'DirectiveUri?'. HOT 4
- Add support for fvm HOT 8
- Document custom-lint task HOT 1
- pre-commit fails in VSCode due to `version solving failed` in flutter project HOT 1
- `error-level` option does not work under `analyze` task HOT 2
- run specific tasks on staged files only HOT 2
- Installation and install docs HOT 1
- Add support for custom commit hook steps
- Add outdated packages check
- --check-pull-up does not work if dart package is not the git root
- Make fix imports work for multiline and commented imports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart_pre_commit.