-
Notifications
You must be signed in to change notification settings - Fork 11
Adding addRule function #25
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
Conversation
@lukasoppermann Code style check failed. Seems I messed up in #22 and don't fail the build... |
@SimenB sorry, I don't get it, do I need to fix/change something? |
run |
@SimenB ahh, now I get it, fixed the missing space. thanks. |
@lukasoppermann Seems there's no rule for it, but braces in general are on same line as conditionals in this source code. No JSCS rule for it though... if (condition) { not if (condition)
{ @lazd I just hijacked this, whoop! Could you update the rc's to be more strict maybe? Or do you want me to do it? |
@SimenB so how is else? Option 1: } else { or Option 2: }
else { |
@lukasoppermann That I don't know. Doesn't seem to be any other How about adding |
@SimenB I just removed the need for else. |
@lukasoppermann Ah, nice! |
@lukasoppermann Add some documentation to README and we can merge this! |
Hey @lazd I added the docs, but the coverage stuff now freaked. :) Wasn't there before, I just changed the readme. |
Yeah, we just added test-coverage from Coveralls yesterday. You could add a test? 😃 |
@SimenB had a look but I have no idea how to write a test for this. I do not have much experience with gulp plugins. |
I think the best way to test this is to provide a fixture that passes with the default ruleset, but fails with a rule that you add using the new API. Then, run that fixture against the plugin and |
Hey, my problem is rather that I can not write the complete test, because writing a test for a gulp plugin is something I don't know how to do. Can you just merge it and write the test? You seem to have a pretty good idea of how to do it, so I guess you could wip up a test within a minute or so. |
@lukasoppermann, it's pretty easy, and there's no better time to learn than now :) Just look at the existing tests and modify one to fit your needs. This test expects something to fail, so you can copy paste it, use a different fixture, invoke your new |
@lazd I added a test, but I can't get it to work the whole gulp thing is just over the top for me. Please help. |
1 similar comment
@lukasoppermann Does it fail runtime? As in actually adding that rule and running against a real codebase? I'm really bad at regexp, but from what I understand, the last part (allowing alphanumerics) is wrong, and only matches one char. '.o-foo'.match(/^\.(_)?(o|c|u|is|has|js|qa)-[a-z0-9]$/)
> null '.o-f'.match(/^\.(_)?(o|c|u|is|has|js|qa)-[a-z0-9]$/)
> [".o-f", undefined, "o"] EDIT: Adding a plus at the end makes it pass. '.o-foo'.match(/^\.(_)?(o|c|u|is|has|js|qa)-[a-z0-9]+$/)
> [".o-foo", undefined, "o"] But fail at other '.bogus-foo'.match(/^\.(_)?(o|c|u|is|has|js|qa)-[a-z0-9]+$/)
> null Note: Not tested in your code/CSSLint, just using Node.js console |
@SimenB thanks for catching it. Actually my problem was a wrong css file. This is why it did not report and error, which means not passing the test. :) |
Ah, OK. Nice you got it running. Travis seems to have problems |
I restarted the build and all is well. Looks good, thanks for the contribution! |
Hey, could you maybe release a version with this merge in it? |
Users should be able to add their own rules, just like with the csslint plugin. This solves #24