looker-open-source / look-at-me-sideways

A style guide and linter for Looker's LookML data modeling language
MIT License
123 stars 37 forks source link

E7 - issue with explore refinements #171

Open mariana-s-fernandes opened 4 months ago

mariana-s-fernandes commented 4 months ago

I get the error

Error evaluating rule: Cannot read properties of undefined (reading 'length')

for explores with emojis or strange characters in the labels.

fabio-looker commented 2 months ago

Hi @mariana-s-fernandes

Do you mean in the "label" parameter , or in the object name? In the latter case, it could be a parser issue..

A small repro would help, as my attempt to repro it didn't run into any issues:

image

(note: Test in https://github.com/looker-open-source/look-at-me-sideways/tree/issue-171-rule-e7-emojis )

mariana-s-fernandes commented 2 months ago

I mean the label parameter. The label that is failing is "⭐️ Properties, Companies, Shareholders & More" It seems to me that javascript is not able to get the length of the string in this line of code: https://github.com/looker-open-source/look-at-me-sideways/blob/master/rules/e7.js#L23

Let me know if you need anything else!

mariana-s-fernandes commented 2 months ago

This is the result from LAMS, if it helps:

image
mariana-s-fernandes commented 2 months ago

I have tried to remove the emoji and it seems that's not the cause for the problem. My customers explore is also only named "Customers" so I have no idea what could be causing this...

image
#LAMS
#rule: K7 {} # Provide one `primary_key`
#rule: F1 {} # No cross-view fields
#rule: F2 {} # No view-labeled fields
#rule: F4 {} # Description or hidden
#rule: T1 {} # Triggers use datagroups
#rule: E1 {} # Join with subst'n operator
#rule: E7 {options: {maxLength: 50}}
#rule: W1 {} # Block indentation
fabio-looker commented 2 months ago

Given the "+" in the location, I assume it is an issue related to handling of refinements in the LookML parser. I don't think the refinements should be exposed individually in the model. If you would be able to send a zipped copy of your LookML to fabble@google.com, I could use it to repro this issue more quickly?

mariana-s-fernandes commented 2 months ago

I'm testing LAMS and the parser locally and the problem is with the parser. These explores are the only ones that have quick start queries. The quick start queries are defined in a refined explore (hence the "+" sign). I am trying to exclude them from LAMS but they are still getting caught...

I will let you know once I find out more about it!

mariana-s-fernandes commented 2 months ago

So the problem is that the parser/linter does not support explore refinements. I have removed them on my end and it's working now! But you may want to investigate on how to support them, if you think that makes sense.

fabio-looker commented 1 month ago

I am still not sure exactly what triggered this error, but in v3.1.4, I did make some parser fixes around "include" functionality which could have contributed to this error.