eclint icon indicating copy to clipboard operation
eclint copied to clipboard

check doesn't handle file paths with spaces

Open RobPierce opened this issue 6 years ago • 0 comments

I'm trying to use eclint to check editorconfig rules as part of a build pipeline in azure devops. It will run fine locally (on a windows machine) but I can't get it to run on our default windows build servers for the pipeline (after installing the eclint package globally via npm, powershell still complains that eclint is not a recognised command). So I tried using a Docker build agent and using the bash build step and that runs eclint but then it breaks down as some of my file paths have a space in them and eclint treats the space as a new file path.

I'm running the following script:

eclint check $(git ls-files  '*' ':!:*.sln' ':!:*.csproj' ':!:*.config')

And I get the following error:

2019-08-01T10:27:56.4898963Z events.js:160
2019-08-01T10:27:56.4900286Z       throw er; // Unhandled 'error' event
2019-08-01T10:27:56.4900728Z       ^
2019-08-01T10:27:56.4900993Z 
2019-08-01T10:27:56.4901542Z Error: File not found with singular glob: /home/ec2-user/ado-agent/_work/1/s/GlobalInpart.Api/Connected\ (if this was purposeful, use `allowEmpty` option)
2019-08-01T10:27:56.4902196Z     at Glob.<anonymous> (/home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob-stream/readable.js:84:17)
2019-08-01T10:27:56.4902533Z     at Glob.g (events.js:292:16)
2019-08-01T10:27:56.4902924Z     at emitOne (events.js:96:13)
2019-08-01T10:27:56.4903191Z     at Glob.emit (events.js:188:7)
2019-08-01T10:27:56.4903678Z     at Glob._finish (/home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob/glob.js:197:8)
2019-08-01T10:27:56.4904222Z     at done (/home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob/glob.js:182:14)
2019-08-01T10:27:56.4904771Z     at Glob._processSimple2 (/home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob/glob.js:688:12)
2019-08-01T10:27:56.4905387Z     at /home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob/glob.js:676:10
2019-08-01T10:27:56.4906236Z     at Glob._stat2 (/home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob/glob.js:772:12)
2019-08-01T10:27:56.4906754Z     at lstatcb_ (/home/ec2-user/ado-agent/_work/_tool/node/6.17.1/x64/lib/node_modules/eclint/node_modules/glob/glob.js:764:12)
2019-08-01T10:27:56.5059245Z ##[error]Bash exited with code '1'.
2019-08-01T10:27:56.5114663Z ##[section]Finishing: Bash Script

I've tried updating the commands to put single, or double, quotes around the file list from git, escaping the space with a backslash etc... but no matter what I do it won't work.

Am I missing something or is there no easy way to get eclint to cope with spaces in paths when using a bash script?

If there isn't, then is there any way to run the check command against all files recursively while also excluding certain file types - I could get it to run with just the eclint check command but I can't see any way to give it patterns to exclude (unless using something like git ls-files etc...)?

RobPierce avatar Aug 01 '19 11:08 RobPierce