Closed mlarcher closed 9 years ago
thanks @mlarcher
I've been looking for a solution to this but I am currently blocked because I don't know why when I use scss-lint
glob with node exec
I get an unexpected output. I think I will ask for help in ruby scss-lint
Thank you. Please give us feedback when you can. Would you have an issue on scss-lint we can follow up too ?
they already have helped me. :smiley:
https://github.com/juanfran/gulp-scss-lint#glob-pattern-without-gulpsrc
Thanks for the quick response, but it seems the issue is not resolved yet. I upgraded to 0.3.1 and tried to use the new syntax, but I am facing an error.
gulp.task('scss-lint', function() {
return scsslint({
shell: 'bash', // your shell must support glob
src: '**/*.scss'
});
});
->
[13:24:49] Error in plugin 'gulp-scss-lint'
Message:
You need to have Ruby and scss-lint gem installed
Of course, I do have ruby and scss-lint gem installed. And I can't presuppose of what shell will be available on the machine running the job. As stated in the issue title, the problem is related to the windows command line, where "bash" isn't usually available, so I'm not sure how this is supposed to work. Could you please reopen or provide additionnal explanation if I'm missing something ?
Also, the files I'm willing to lint are dispatched in two directories, and I'm not sure the current solution would allow for arrays of globs such as
[ 'C:\\path\\to\\www\\project\\folder1\\path\\styles\\**\\*.scss',
'C:\\path\\to\\www\\project\\folder2\\styles\\**\\*.scss']
If you are using windows remove the shell option. Sorry I will update the documentation because it is not very clear.
The src
has to be the same as scss-lint on the command line, so something like this should work.
gulp.task('scss-lint', function() {
return scsslint({
src: 'C:\\path\\to\\www\\project\\folder1\\path\\styles\\**\\*.scss C:\\path\\to\\www\\project\\folder2\\styles\\**\\*.scss'
});
});
I don't have windows right know, if you have problems I will try on windows tomorrow
I tried that already, but without the shell option I get:
Input file did not exist or was not readable
even though the command line looks about fine, i.e. something like that:
scss-lint C:\path\to\www\project\folder1\path\styles\**\*.scss C:\path\to\www\project\folder2\styles\**\*.scss --config=C:\path\to\www\project\.scss-lint.yml --format=JSON
I've found two bug on windows :sob: that I've fixed, try the 0.3.2 version
but the bugs that I found doesn't return that output..., after update could you try without the config and if it still fails change the src
option with relative paths?
Hi @juanfran , what do you mean by "without the config" ? Also, could you please reopen the issue until we find a working solution for it ? I've tried again with 0.3.2, here's the output:
[22:30:42] Launch scss linting
scss-lint C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\styles\**\*.scss C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\project-root\**\*.scss --config=C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\.scss-lint.yml --format=JSON
[22:30:42] 'scss-lint' errored after 24 ms
[22:30:42] Error in plugin 'gulp-scss-lint'
Message:
Error code 3221225477
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "scss-lint C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\styles\**\*.scss C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\project-root\**\*.scss --config=C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\.scss-lint.yml --format=JSON"
Could you run this in cmd?
scss-lint C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\styles\**\*.scss C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\project-root\**\*.scss --config=C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\.scss-lint.yml --format=JSON
and if it doesn't work run this
scss-lint C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\styles\**\*.scss C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\project-root\**\*.scss --format=JSON
I get
No such file or directory @ rb_sysopen - C:UwAmpwwwNouveau_dossierNouveau_dossierNouveau_dossierNouveau_dossierproject_folder.scss-lint.yml
umm that is strange... scss-lint doesn't like your paths, I'll try again tomorrow on a windows machine, sorry for the delay
thanks
Thank you. By the way, it fails with the same error code when I omit the "config" key:
scss-lint C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\styles\**\*.scss C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\project-root\**\*.scss --format=JSON
->
Invalid argument @ rb_sysopen - C:UwAmpwwwNouveau_dossierNouveau_dossierNouveau_dossierNouveau_dossierproject_foldersrcstyles***.scss
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/engine.rb:229:in `read'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/engine.rb:229:in `for_file'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/engine.rb:46:in `build_from_file'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/engine.rb:21:in `initialize'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/runner.rb:25:in `new'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/runner.rb:25:in `find_lints'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/runner.rb:17:in `block in run'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/runner.rb:16:in `each'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/runner.rb:16:in `run'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/cli.rb:54:in `scan_for_lints'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/cli.rb:48:in `act_on_options'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/lib/scss_lint/cli.rb:27:in `run'
c:/outils/Ruby22-x64/lib/ruby/gems/2.2.0/gems/scss-lint-0.38.0/bin/scss-lint:6:in `<top (required)>'
c:/outils/Ruby22-x64/bin/scss-lint:23:in `load'
c:/outils/Ruby22-x64/bin/scss-lint:23:in `<main>'
Report this bug at https://github.com/brigade/scss-lint/issues
Hi!
I've update gulp-scss-lint to the 0.3.3 because I've found another bug in windows but I think it isn't your bug...
After update, test again with verbose option true
if it doesn't work copy an run the output on cmd. If you get the same as yesterday Invalid argument @ rb_sysopen
please ask in scss-lint because there I can't help you sorry.
After checking with @sds on the scss-lint repository, it appears that glob syntax just won't cut it for windows, but folder names will. This looks like an acceptable solution, considering folder paths are a subset of globs. Still, the same command that works and reports errors when launching scss-lint directly from the command line returns with no error code and no output when launched from gulp-scss-lint. i.e.
scss-lint "C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\styles" "C:\UwAmp\www\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\Nouveau_dossier\project_folder\src\project-root" --format=JSON
returns linting errors (so it works), but
gulp.task('scss-lint', function () {
return scsslint({
'verbose': true,
//'config': "C:\\UwAmp\\www\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\project_folder\\.scss-lint.yml",
'src': "\"C:\\UwAmp\\www\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\project_folder\\src\\styles\"" + " " +
"\"C:\\UwAmp\\www\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\project_folder\\src\\project-root\""
});
});
outputs the same command but exits as a success without any warning/error (even though linting errors do exist).
From what I gather, there are two key points:
We're closing in, but I think some minor adjustments still need to be done on your side to tackle the issue. Could you please check on it in light of these new informations ?
yes!, check the version 0.3.4, it should work but you still need the quotes on the 'src' option
thanks
Version 0.3.4 works nice with the following syntax:
gulp.task('scss-lint', function () {
gutil.log(gutil.colors.bgCyan('Launch scss linting'));
return scsslint({
'verbose': true,
'config': path.join(config.root, '/.scss-lint.yml'),
'src': 'src': "C:\\UwAmp\\www\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\project_folder\\src\\styles" + " " + "C:\\UwAmp\\www\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\Nouveau_dossier\\project_folder\\src\\project-root",
'reporterOutput': path.join(config.reports, '/scssReport.xml'),
'maxBuffer': 5 * 1024 * 1024
});
});
It seems escaped quotes are not needed anymore btw. Thanks for your help ! I still have to figure out how to plug the failReporter and .on('error',...) handler on that kind of syntax, but I guess you can mark the issue as fixed now.
Actually, this error reporting handling appears to be an issue, as the syntax I showed above lets the task exit with a 0 error code even though there are arrors spotted. So I have errors in the console, but the gulp task doesn't know about it and acts as if everything was fine. Could you please provide a working syntax that allows for correct error reporting and handling ?
Hm, I made the task work as expected with the following syntax:
gulp.task('scss-lint', function () {
gutil.log(gutil.colors.bgCyan('Launch scss linting'));
// Nonsensical source to fall back to files listed in src attribute
return gulp.src('./nonExistingFileName')
.pipe(scsslint({
//'verbose': true,
'config': path.join(config.root, '/.scss-lint.yml'),
// provide a list of folders to avoid glob issue on windows
// cf https://github.com/juanfran/gulp-scss-lint/issues/51#issuecomment-141783075
// add quotes around each path to avoid issues with spaces in folder names
'src': '"' + config.styles.srcFolders.join('" "') + '"',
'reporterOutput': path.join(config.reports, '/scssReport.xml'),
'maxBuffer': 5 * 1024 * 1024
}))
.on('error', handleErrors)
.pipe(scsslint.failReporter('E'));
});
But it wasn't working on one of my coworkers' machine. We narrowed it down to the git bash version. After upgrading git (and hence git bash), I now get an error with that syntax: [Uncaught error:] shutdown EPIPE
.
Returning the scsslint() with no gulp.src/on/pipe doesn't raise the error, but doesn't return the correct error code either (see above).
Could you please provide guidance on how to set things up correctly ?
Could you try to move .pipe(scsslint.failReporter('E'))
before .on('error', handleErrors)
?
I tried that, and also removing them and return the stream or not, couldn't find a working configuration yet.
Could you try with the last version?
thanks
I tried, and it fails with the same error. In case it helps, you can get free windows VMs from Microsoft at https://dev.modern.ie/tools/vms/linux/ for testing purposes. Let me know if there's anything I can do to help you further debugging.
I've tried this and I get an error code '1' when it's an error in a scss file
gulp.task('test', function() {
return gulp.src('./*.scss')
.pipe(scsslint())
.pipe(scsslint.failReporter('E'));
});
Sure, but then it doesn't use the syntax you proposed with src:
to work around the initial issue
sorry, this is the code
gulp.task('test', function() {
return scsslint({
src: 'folder1\\*.scss'
})
.pipe(scsslint.failReporter('E'));
});
I've tested in windows 10 with node 4.1 and gulp 3.9
FYI we run the project on Windows7 x64, with Gulp 3.9, node 0.12.7, and scss_lint 0.42.2. I tried installing node 4.1 (and rebuilding the packages) and here is what I saw:
src: 'folder\\*.scss'
I get an Error code 3221225477
Using the generated scss-lint command directly results in a "segmentation fault" error.
I get the same result with src: 'folder\\**\\*.scss'
(I don't have any file scss directly at folder level)src: 'folder'
, I get the expected output in the console, but the process never exits (as opposed to having a shutdown EPIPE
error when using node 0.12)
Using the scss-lint command directly results in the expected output.It seems 0.12 is more verbose about the issue, and that's the version we have on the CI, so I reverted to it. Here is the complete output:
$ gulp scss-lint --color
[13:50:44] Using gulpfile C:\project\gulpfile.js
[13:50:44] Starting 'scss-lint'...
scss-lint "C:\project\src\project-root" --config="C:\project\.scss-lint.yml" --format=JSON
[13:50:46] 1 issues found in C:\project\src\project-root\common\_sass\_modal.scss
[13:50:46] _modal.scss:21 [W] ColorVariable: Color literals like `rgba(147, 147, 147, 0.8)` should only be used in variable declarations; they should be referred to via variable everywhere else.
[13:50:46] 1 issues found in C:\project\src\project-root\company-creation\_sass\__company-creation.scss
[13:50:46] __company-creation.scss:5 [E] EmptyLineBetweenBlocks: Rule declaration should be followed by an empty line
[13:50:46] 'scss-lint' errored after 1.84 s
[13:50:46] Error in plugin 'gulp-scss-lint'
Message:
ScssLint failed for: __company-creation.scss
events.js:85
throw er; // Unhandled 'error' event
^
Error: shutdown EPIPE
at exports._errnoException (util.js:746:11)
at Socket.onSocketFinish (net.js:240:26)
at Socket.emit (events.js:104:17)
at finishMaybe (_stream_writable.js:484:14)
at endWritable (_stream_writable.js:493:3)
at Socket.Writable.end (_stream_writable.js:459:5)
at Socket.end (net.js:415:31)
at process._tickCallback (node.js:355:11)
when running task
gulp.task('scss-lint', function () {
return scsslint({
'verbose': true,
'config': '"C:\\project\\.scss-lint.yml"',
'src': '"C:\\project\\src\\project-root"'
}).pipe(scsslint.failReporter('E'));
}
I just found out about an important piece of information: the problem only occurs in the "git-bash" shell! The same command in the default windows command prompt doesn't throw the "shutdown EPIPE" error and exits as expected. Sorry I didn't notice that before. I hope it will help finding out what the issue is about!
that's the key. thanks!
I haven't found a solution yet, and I can't spend time next week, sorry
Thanks for the update. I hope you can get back to it soon.
I think is finally fixed :smile:
What syntax are you using ? I just tried with 0.3.4 and still have the Error: shutdown EPIPE
error in git-bash.
Here's the gulp task I'm using:
gulp.task('scss-lint', function () {
return scsslint({
'verbose': true,
'config': "C:\\project\\.scss-lint.yml",
'src': "C:\\project\\src\\styles" + " " +
"C:\\project\\src\\project-root"
}).pipe(scsslint.failReporter('E'));
});
Oops, I was trying the wrong version. The problem doesn't occur anymore with 0.3.7! Thank you @juanfran. I'm closing the issue, but i'd be interested in knowing what was the core cause. Could you provide some insights about that ?
yes! the problem was that when the option src
exists I need to create a new stream
and I use process.stdin
but this is a bad idea for the latest node versions.... so I changed it to https://nodejs.org/api/stream.html#stream_class_stream_readable and that's it
gg, thanks for the fix :)
We're hitting a "The command line is too long" error in windows while using this plugin.
As it appears, command line cannot be longer than 8192 characters on windows, and gulp-scss-lint calls "cmd.exe /s /c "scss-lint" with all files to lint as inline parameters with full path, quickly reaching this limit. There is only 85 scss files in the project so far, so I'm a bit surprised to see that kind of error.
Could you please check on why this is happening and how to fix it ? Perhaps the plugin could just forward the glob it receives to scss-lint, as it seems scss-lint can handle those... Please let me know if I can help in any way.