-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An edge case missed by pytmc pragmalint #323
Comments
I think the |
Our regex looks like this: Lines 22 to 24 in 2c4f412
So it doesn't consider "oops they might have typed I'm up for suggestions as to how to better restructure that - just it's tough to say "oh this looks kinda like a pragma" |
I totally agree that this is tough- I made the issue fully knowing that we can't cover for every single kind of malformed entry, and if we try then we'll start flagging false positives of things that were never intended to be pytmc pragmas. No immediate "clearly good" ideas- maybe we can have a separate regex that's just "includes pytmc within curly brackets but doesn't get matched here"? But of course we still miss typos of pytmc and, again, if you go too far you'll find that you can no longer include the word "pytmc" in other pragmas without linter errors. "includes the word pytmc and has a pragma type that isn't on the list of existing pragma types" is a bit of an annoying mouthful. |
Well-stated @ZLLentz ... For pattern matching without being excessive (I share the same concern about taking it too far and overlapping with other uses of non-pytmc pragmas), maybe checking to see if the following fail to parse as pragmas could be good enough:
|
I need more time to think about the implications of doing those precise checks. I think our overall goal should be to handle these two cases:
To me, misspellings are most likely to be non-obvious when the first (and to a lesser extent, the last) letters are correct but there's some mix-up in the middle. So maybe something similar to your suggestions are all that's needed to hit these sorts of cases, without reaching too far into collateral damage areas. |
In this example, we miss the malformed pragma because it is so malformed that pytmc doesn't even register it as a pragma.
I'm not sure how wide the scope of pragmalint should be but I thought I'd note this here.
https://github.com/pcdshub/lcls-twincat-general/blob/73cdd56e72eea0bb6fcd871b207bf4f621023a57/LCLSGeneral/LCLSGeneral/DUTs/DUT_EPS.TcDUT#L31
The text was updated successfully, but these errors were encountered: