andrewabest / Conventional

A suite of convention specifications for enforcing type and style conventions in your codebase
Microsoft Public License
97 stars 29 forks source link

MustOnlyContainInformativeCommentsConventionSpecification incorrectly identifies some Url schemas #37

Closed olevett closed 7 years ago

olevett commented 7 years ago

The MustOnlyContainInformativeCommentsConventionSpecification is a little bit aggressive, for example

var query = new Query("ftp://");

as well as arbitrary // in strings (that aren't http(s)://) causes the test to fail.

I'm not sure what the best way round this is (maybe something like "if it's within quotes discount it").

I can write up a minimal example of this issue/a test case if that's helpful?

andrewabest commented 7 years ago

Hi @olevett - I agree, we could certainly improve the URL expression to include most common formats (including file://, ftp:// etc).

What other examples do you have that you have run into while using this convention?

olevett commented 7 years ago

The specific example I have that got picked up was "blah://" -> a deliberately invalid string as I was testing some validation logic against, so think in this case it's better for me to opt out of the convention

andrewabest commented 7 years ago

OK, thanks for the thoughts anyway @olevett, appreciated!