-
Notifications
You must be signed in to change notification settings - Fork 79
Warnings and warn on angle defaults #7502
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
0a4a0ea
to
6b29456
Compare
CodSpeed Instrumentation Performance ReportMerging #7502 will not alter performanceComparing Summary
|
1a91290
to
1be094d
Compare
64b7c34
to
349544a
Compare
Signed-off-by: Nick Cameron <[email protected]>
Signed-off-by: Nick Cameron <[email protected]>
Signed-off-by: Nick Cameron <[email protected]>
Signed-off-by: Nick Cameron <[email protected]>
Signed-off-by: Nick Cameron <[email protected]>
Signed-off-by: Nick Cameron <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. One thing I noticed is that we don't display units in the UI in a lot of places. I started another PR #7619 to help with that.
preComments: [], | ||
commentStart: 0, | ||
let sufStr | ||
switch (suffix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I explicitly made format_number_literal()
and exposed it to TS so that we don't spread the units all over and separate the definition of the type from how it's converted to a string. What's the reason for not using that?
break | ||
case 'Unknown': | ||
sufStr = '_?' | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you ever do switch on an enum in TS, you should enforce the exhaustive match. Search the codebase for "exhaustiveCheck" to see how it's done.
This is two PRs in one, sorry!
Part one allows to allow/deny warnings using an attribute. There's a few follow-ups required for this. I'll file some issues soon. In particular, this only applies to warnings generated during execution, not parsing.
Part two adds a new warning for using numbers as angles without an explicit suffix (e.g., using
90
instead of90deg
). The intention with this is to make it less common to hit units issues with PI by discouraging AI and users from using math to convert between degrees and radians (and use implicit or explicit conversion instead). Long-term, I hope to make this a hard error in order to improve our units system, but since that is a breaking change, we'll need this warning for a long while first.As part of this change I have modified the frontend to always use suffixes with angles. However, I am very unsure that I have done this very well or completely, so please give a close review to the frontend parts.