Usage of variables in "includes" glob pattern #113
ThijmenDam
started this conversation in
Ideas
Replies: 1 comment
-
|
Hi @ThijmenDam, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @alirezanet and contributors, first of all I'd like to thank you for this very useful package.
So, our team would greatly benefit from the possibility of using variables in the "include" glob pattern. For example:
{ "tasks": [ { "name": "dotnet-format-staged-files", "group": "pre-commit-operations", "command": "dotnet", "args": [ "format", "${args}", "--verbosity", "diagnostic", "--no-restore", "--include", "${staged}" ], "include": [ "${args}/**/*.cs" <---- this is what I refer to ] } ] }The reason this would be very useful for our team is performance. To elaborate, some of our repositories contain multiple solutions, and without variables in the "include" glob pattern, we are not able to execute
dotnet formatonly for the solutions that contain staged files. This means thatdotnet formatis executed for every solution, even if there are no staged files from that solution (which slows down the pre-commit hook by a lot).To illustrate, consider the following pre-commit hook:
We pass the solution directory as argument, because
dotnet formatrequires the workspace to be provided as command line argument wheneverdotnet formatis executed from a directory that does not contain a solution file (i.e. the root of our repository).To conclude, if we could use the
${args}variable in the "include" glob pattern,dotnet formatwould only be executed for solutions that contain staged files. Which saves a lot of time for repositories with multiple solutions!Thanks for reading, and I'd love to hear what you think of this.
Best,
Thijmen
Beta Was this translation helpful? Give feedback.
All reactions