Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'max-warnings' option not respected #64

Open
bobbygryzynger opened this issue Nov 16, 2016 · 7 comments
Open

'max-warnings' option not respected #64

bobbygryzynger opened this issue Nov 16, 2016 · 7 comments

Comments

@bobbygryzynger
Copy link

bobbygryzynger commented Nov 16, 2016

Running the following code does not result in an error as expected:

  return gulp.src(CONFIG.styles.source)
    .pipe(sasslint({
        options: {'max-warnings': 1}
      }))
    .pipe(sasslint.format())
    .pipe(sasslint.failOnError());

In the console, the task finishes without errors, despite the following output:
screen shot 2016-11-15 at 8 21 51 pm

I am using version: 1.3.2.

@mloayzagahona
Copy link

I have the same problem but inside of the sass-lint.yaml file

image

@plateniteshow
Copy link

plateniteshow commented Jan 4, 2017

I'm experiencing the same issue in both yaml-file and javascript-code. I already browsed the original code and played with the warningCount-variable. It seems that it is possible to create a failOnError-like function which exits when reaching a certain amount of warnings. I don't want to customize the plugin, though... I'd really appreciate a solution for this problem!

I am using version 1.3.2 aswell

@esteinborn
Copy link

This may be due to the fact that sass-lint implementation may utilize the --verbose flag which will not fail on max-warnings but it's just a guess

@plateniteshow
Copy link

plateniteshow commented Jan 6, 2017

I unwillingly went for another workaround. I put a custom function in the gulp-pipe, in which I can access the original lint-file, which is generated via sass-lint, and exit the task if a certain warningCount is reached. My function also accessses the config-file, so it might be the best way until the plugin gets fixed.

...I'm at home right now and have no access to the code, but I'll post my (hacky?) solution on monday.

@webdevian
Copy link

@Kyriou Did you dig out your solution? I've been trying a few things like grep'ing the sassLint.format() but it feels incredibly hacky

@plateniteshow
Copy link

plateniteshow commented Jan 26, 2017

Totally forgot about that, sorry. This is my (hacky) solution. I referenced this function via .pipe(xyz) in the respective gulp task.

sasslinterrorhandling

Actually I can't recall how exactly this works. As far as I remember I copied this from the failOnError-function of the original sass-lint-plugin. Not sure, though.

It's not the cleanest solution, but it works. I'm open for better and cleaner solutions.

@webdevian
Copy link

webdevian commented Jan 26, 2017

I opted to just use exec in the end. Until something like #72 is merged it does the job

gulp.task('sass-lint', function(cb) {
  exec('sass-lint -v', function(err, stdout) {
    if (stdout) {
      gutil.log(stdout);
    }
    cb(shouldItExit ? err : 0);
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants