csvlint.rb
csvlint.rb copied to clipboard
Pre-commit passes a list of files to lint but csvlint can only accept one
Expected Behaviour
When running csvlint in a pre-commit hook pre-commit will pass a list of files to it as seperate args. csvlint should take the list and generate a response for all. cfn-lint
has an example of this support https://github.com/aws-cloudformation/cfn-lint#basic-usage
Current Behaviour (for problems)
csvlint errors:
ERROR: "csvlint validate" was called with arguments ["file1.csv", "file2.csv"] Usage: "csvlint myfile.csv OR csvlint http://example.com/myfile.csv"
Steps to Reproduce (for problems)
Use a pre-commit config like:
---
default_language_version:
ruby: 2.7.8
repos:
- repo: https://github.com/Data-Liberation-Front/csvlint.rb
rev: v1.3.0
hooks:
- id: csvlint
name: lint files/*.csv
files: 'file.*\.csv'
pass_filenames: true
against files like:
file1.csv
file2.csv
file3.csv
Current workaround is to use xargs to run csvlint against each file:
- id: csvlint
name: lint files/*.csv
files: 'file.*\.csv'
entry: bash -xc 'echo "$@" | xargs -n 1 -I filename csvlint filename --schema=schema/csv' --