You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So i have applied linting with git hooks in my pre-commit hook. When I commit my code it runs the script for 'flutter analyze' and 'custom_lint' (from invertase) commands on my project..
What if I want to run these commands only on files i have made changes in and not in entire project.?
I have tried below code. But it does not work
#!/bin/bash
# Get the list of files staged for commit
staged_files=$(git diff --cached --name-only --diff-filter=ACM | grep ".dart$")
# Run custom_lint on staged files
if [ -n "$staged_files" ]; then
echo "Running custom_lint on staged files..."
echo "Staged Files: $staged_files"
dart pub global run custom_lint $staged_files
# Run flutter analyze on all Dart files
echo "Running flutter analyze on all Dart files..."
flutter analyze $staged_files
# Check the exit code of flutter analyze
if [ $? -ne 0 ]; then
echo "Linting issues found. Aborting commit."
exit 1
fi
fi
'flutter_analyze' runs on my changed files only with above code but not custom_lint.
Please can anyone help with this.
Thanks. :)
The text was updated successfully, but these errors were encountered:
hi @rrousselGit , I read across the #80 , Yes i am looking for same solution. But a bit confused on what steps should I take?
Do I have to make changes in the custom_lint code or is there some new package to be included to support same .
So i have applied linting with git hooks in my pre-commit hook. When I commit my code it runs the script for 'flutter analyze' and 'custom_lint' (from invertase) commands on my project..
What if I want to run these commands only on files i have made changes in and not in entire project.?
I have tried below code. But it does not work
'flutter_analyze' runs on my changed files only with above code but not custom_lint.
Please can anyone help with this.
Thanks. :)
The text was updated successfully, but these errors were encountered: