Ignore snippets in UndefinedObject#160
Conversation
Can be turned back on w/ `ignore_snippets: false` Fixes #159
|
|
||
| UndefinedObject: | ||
| enabled: true | ||
| ignore_snippets: true |
There was a problem hiding this comment.
Should this be the opposite? default to false and can be turned on?
There was a problem hiding this comment.
dont_ignore_snippets: false? :p
Good point! renaming
There was a problem hiding this comment.
Actually, would it make more sense to name it exclude_snippets: true ?
To mimic the other one we already have: https://github.com/Shopify/theme-check/blob/master/config/default.yml#L33
There was a problem hiding this comment.
Actually I'm saying this should be opt-in in Dawn rather than by default to everyone.
There was a problem hiding this comment.
Oh I don't think this will roll. We want to use the same things internally that we'll promote externally.
So maybe this shouldn't even be an option? Always ignore the snippets.
There was a problem hiding this comment.
Right but what's the difference between a typo and an optional parameter in this case? Should you be flagged if you use a typo'ed argument?
This would turn off the rule by default in snippet files always. Seems like if I don't know anything about theme development, I would expect the UndefinedObject rule to flag me in that file if I'm using a typo'ed argument.
There was a problem hiding this comment.
Yes I agree that we should. But I can't think of a way to allow optional parameters in snippets, and check for this at the same time.
I think we had two choices:
- Force users to declare optional parameters (using
| default: ...) - Stop checking snippets for this, because snippets are not
I wished we could stick w/ 1, but I agree it does make the code more complicated, as mentioned Slack.
And we're going w/ 2, because "we don't want to encourage the use of snippets as functions" anyways.
Maybe there's another solution, but I don't see it atm.
To be consistent with other configs
jplhomer
left a comment
There was a problem hiding this comment.
❤️ I echo all of the smart things you and @charlespwd have discussed 😛
See #134 for a previous attempt at a fix. But we ended up recommending to use
defaulton all optional parameters. But this is not a good solution.See context in: https://shopify.slack.com/archives/C01F4ASU4G7/p1613572406096700?thread_ts=1613513255.092400&cid=C01F4ASU4G7
Can be turned back on w/
ignore_snippets: falseFixes #159