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
I'd like a linter that checks for verbatim text that has leading whitespace. I had a go at creating this linter and came up with the following:
moduleSlimLint# Searches for verbatim text with leading whitespaceclassLinter::LeadingWhitespace < LinterincludeLinterRegistryon[:slim,:text,:verbatim]do |sexp|
_,_,_,content=sexpnextunlesscontent[/\A\s+/]# This line is obviously wrongreport_lint(sexp,'Line contains leading whitespace')endendend
With this simple test:
context'when line contains leading spaces'dolet(:slim){"' Text with unecessary whitespace"}it{shouldreport_lintline: 1}end
content ends up being:
[<#Atom :multi>, [<#Atom :slim>, <#Atom :interpolate>, <#Atom " Text with unecessary whitespace">]]
I'm not sure what the best way to match on this and extract the text so that it can be checked for leading whitespace.
Are you able to point me in the right direction?
The text was updated successfully, but these errors were encountered:
I'd like a linter that checks for verbatim text that has leading whitespace. I had a go at creating this linter and came up with the following:
With this simple test:
content
ends up being:[<#Atom :multi>, [<#Atom :slim>, <#Atom :interpolate>, <#Atom " Text with unecessary whitespace">]]
I'm not sure what the best way to match on this and extract the text so that it can be checked for leading whitespace.
Are you able to point me in the right direction?
The text was updated successfully, but these errors were encountered: