You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
Too many or too few arguments are passed in for a script snippet
Filter is platform specific and current platform does not support it
A script snippet injection rule only have negated domain (it will be converted to an exception rule)
A filter will match word boundary but the boundary character is not explicitly given
A common mistake is detected
Common mistakes:
||example.com^$generichide - Forgot @@ or important
It is quite rare that someone want to use important on generichide, chances are he forgot @@.
Detection logic: If a filter has generhichide but not important and is not an exception filter, then dispatch a warning.
|example.com^ - Missed one |
Can happen when copying filter, didn't select the whole line.
Detection logic: For start anchor, if what is anchored does not include protocol, dispatch a warning.
||example.com - Forgot ^
Although the filter works, it is usually a mistake as it can match example.communicate.example.org.
Detection logic: If a filter has host name anchor but no ^ nor : nor /, dispatch a warning.
example.blogspot.*##element - Wildcard matching half of public suffix
Filter will not work as expected.
Detection logic: Could be difficult to implement.
Whitelist Linter
Show warning if:
RegExp is used but that is unlikely to be the intent of the user
||example.com^$~document discards the filter and gives a cannot be negated error, but document can be negated and the filter should be valid
@||example.com^ no error is given but filter is missing a @ at the start
||example.com^,domain=example2.com no error is given but it's an invalid filter
||example.com^$third-party,$image accidental use of $ for image makes it invalid
x||example.com^ becomes invalid filter due to x, usually due to some typo or accidental copying
example.blogspot.*##element error should be given whenever trying to match partial public suffix. Might also be applicable to other static filter syntax
||example.com^$third-party,~image,image looks like image block takes precedence over negated. Not sure if some error could be given for this kind of accidental double syntax
@grenzor
The linter is always right when it comes to showing errors since it uses the exact same parsing engine. If it shows error, then the filter is rejected, if it does not show error, then the filter is accepted, although how will the filter behave is another question.
By design, the linter will never show error if the filter is accepted, but I do agree warnings should be shown for some of these cases. I'll work on that later.
I think these should generate warning:
@||example.com^
example.blogspot.*##element
||example.com^$third-party,~image,image
The error in ||example.com^,domain=example2.com and ||example.com^$third-party,$image are pretty obvious from syntax highlighting, so no extra linter warning is needed. Also, I think x||example.com^ is really unlikely to happen.
The error in ||example.com^,domain=example2.com and ||example.com^$third-party,$image are pretty obvious from syntax highlighting
They may be easy to spot if you have a few filters, but for someone with 100s/1000s of their own filters it is not easy at all. It's easier for the user to scroll down and just look at the sidebar for an icon of error or warning than manually checking each line's color syntaxing.
@grenzor
I think you should be writing one filter at a time, and not 1000 then test together. Beside, even if the filter doesn't contain obvious mistake, it doesn't mean it'll work.
Activity
[-]Add filter linter[/-][+]Nano Linter issues mega thread[/+]jspenguin2017 commentedon Dec 29, 2017
ameshkov commentedon Dec 29, 2017
gorhill commentedon Dec 29, 2017
ameshkov commentedon Dec 29, 2017
gorhill commentedon Dec 29, 2017
jspenguin2017 commentedon Dec 29, 2017
ameshkov commentedon Dec 29, 2017
3 remaining items
grenzor commentedon Feb 27, 2018
Some Linter issues:
||example.com^$~documentdiscards the filter and gives a cannot be negated error, butdocumentcan be negated and the filter should be valid@||example.com^no error is given but filter is missing a@at the start||example.com^,domain=example2.comno error is given but it's an invalid filter||example.com^$third-party,$imageaccidental use of$for image makes it invalidx||example.com^becomes invalid filter due tox, usually due to some typo or accidental copyingexample.blogspot.*##elementerror should be given whenever trying to match partial public suffix. Might also be applicable to other static filter syntax||example.com^$third-party,~image,imagelooks like image block takes precedence over negated. Not sure if some error could be given for this kind of accidental double syntaxjspenguin2017 commentedon Feb 27, 2018
@grenzor
The linter is always right when it comes to showing errors since it uses the exact same parsing engine. If it shows error, then the filter is rejected, if it does not show error, then the filter is accepted, although how will the filter behave is another question.
By design, the linter will never show error if the filter is accepted, but I do agree warnings should be shown for some of these cases. I'll work on that later.
I think these should generate warning:
@||example.com^example.blogspot.*##element||example.com^$third-party,~image,imageThe error in
||example.com^,domain=example2.comand||example.com^$third-party,$imageare pretty obvious from syntax highlighting, so no extra linter warning is needed. Also, I thinkx||example.com^is really unlikely to happen.grenzor commentedon Feb 28, 2018
They may be easy to spot if you have a few filters, but for someone with 100s/1000s of their own filters it is not easy at all. It's easier for the user to scroll down and just look at the sidebar for an icon of error or warning than manually checking each line's color syntaxing.
jspenguin2017 commentedon Feb 28, 2018
@grenzor
I think you should be writing one filter at a time, and not 1000 then test together. Beside, even if the filter doesn't contain obvious mistake, it doesn't mean it'll work.
grenzor commentedon Feb 28, 2018
I agree, but my use case was someone with already written filters in uBO who then imported them into Nano.
jspenguin2017 commentedon Feb 28, 2018
@grenzor
You should still have validated each filter when you wrote them to make sure they actually work.
jspenguin2017 commentedon Mar 2, 2018
grenzor commentedon Mar 2, 2018
jspenguin2017 commentedon Aug 5, 2018
ameshkov commentedon Aug 6, 2018
jspenguin2017 commentedon Aug 10, 2018
jspenguin2017 commentedon Jul 11, 2020