-
-
Notifications
You must be signed in to change notification settings - Fork 49
[SIL.WIndows.Forms] In CustomDropDown, fixed timer check #1433
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: master
Are you sure you want to change the base?
Conversation
…oint equality check
Palaso Tests 4 files ±0 4 suites ±0 11m 11s ⏱️ +56s Results for commit d9cc485. ± Comparison against base commit 23dc405. This pull request skips 1 test.
♻️ This comment has been updated with latest results. |
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.
Reviewed 1 of 2 files at r2, all commit messages.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @imnasnainaec)
SIL.Windows.Forms/Widgets/CustomDropDown.cs
line 187 at r2 (raw file):
{ Opacity += 0.1; if (Opacity > .99)
Should we also actually force opacity to be 1f? In practice, I imagine it won't make a noticeable difference (maybe not any difference), so maybe this is just me feeling angst over the imprecision.
if (Opacity > .99) | ||
Opacity = 1f; |
Check warning
Code scanning / CodeQL
Misleading indentation Warning
the control flow successor
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 minutes ago
To fix the problem, we will add braces {}
around the body of the if
statement on line 187. This ensures that the scope of the if
statement is explicit and matches the indentation. The braces will clarify that Opacity = 1f;
is conditionally executed, while timer.Stop();
is always executed after the if
statement. No additional imports, methods, or definitions are required for this fix.
-
Copy modified line R188 -
Copy modified lines R190-R191
@@ -187,4 +187,6 @@ | ||
if (Opacity > .99) | ||
{ | ||
Opacity = 1f; | ||
timer.Stop(); | ||
} | ||
timer.Stop(); | ||
}; |
If you start with
double
0 and add .1 ten times, you can end up with (e.g.) 0.9999999999999999 instead of1f
.This fixes https://github.com/sillsdev/libpalaso/security/code-scanning/2627
Of the other 14 warnings for "Equality check on floating point values" (https://github.com/sillsdev/libpalaso/security/code-scanning?query=is%3Aopen+branch%3Amaster+rule%3Acs%2Fequality-on-floats), three involve screen DPI (2624, 2625, 2626), and the rest involve font size.
This change is