fair-acc / chart-fx

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.
GNU Lesser General Public License v3.0
504 stars 93 forks source link

fix DragResizerUtil for south #606

Closed rsuna closed 1 year ago

rsuna commented 1 year ago

Make south resize working. See issue #605.

pr-explainer-bot[bot] commented 1 year ago

Pull Request Report

Hey there! I've prepared a report for the pull request. Let's dive in!

Changes

  1. Fixed the isSouth() method in DragResizerUtil.java to include the cases SW_RESIZE, S_RESIZE, and SE_RESIZE.

Suggestions

I have a couple of suggestions to improve the code:

  1. In the isSouth() method, it might be helpful to add comments explaining the purpose of each case. This would make the code more readable and easier to understand.

Bugs

I couldn't find any potential bugs in the code. Great job!

Improvements

I found a place in the code that could be refactored for better readability. Here's the snippet from DragResizerUtil.java:

public boolean isSouth() {
    switch (this) {
        case SW_RESIZE:
        case S_RESIZE:
        case SE_RESIZE:
            return true;
        default:
            return false;
    }
}

To improve readability, we can simplify the switch statement by using a Set to store the cases that return true. Here's the refactored code:

public boolean isSouth() {
    Set<DragResizer> southCases = new HashSet<>(Arrays.asList(SW_RESIZE, S_RESIZE, SE_RESIZE));
    return southCases.contains(this);
}

This way, it's easier to see which cases return true without having to read through the entire switch statement.

Rating

I would rate the code as follows:

Overall, the code is quite readable and performs well. It also seems to be secure. Great job!

That's all for the pull request report. Let me know if you need any further assistance. Cheers!

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02% :tada:

Comparison is base (ca15519) 49.62% compared to head (b028798) 49.65%. Report is 5 commits behind head on main.

:exclamation: Current head b028798 differs from pull request most recent head dcf893f. Consider uploading reports for the commit dcf893f to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #606 +/- ## ============================================ + Coverage 49.62% 49.65% +0.02% - Complexity 6236 6238 +2 ============================================ Files 379 379 Lines 37593 37579 -14 Branches 6159 6157 -2 ============================================ + Hits 18654 18658 +4 + Misses 17710 17693 -17 + Partials 1229 1228 -1 ``` | [Files Changed](https://app.codecov.io/gh/fair-acc/chart-fx/pull/606?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc) | Coverage Δ | | |---|---|---| | [...ava/io/fair\_acc/chartfx/utils/DragResizerUtil.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/606?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvdXRpbHMvRHJhZ1Jlc2l6ZXJVdGlsLmphdmE=) | `87.71% <ø> (-0.59%)` | :arrow_down: | | [...n/java/io/fair\_acc/chartfx/ui/ProfilerInfoBox.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/606?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvdWkvUHJvZmlsZXJJbmZvQm94LmphdmE=) | `98.78% <100.00%> (+18.57%)` | :arrow_up: | | [...fair\_acc/chartfx/utils/SimplePerformanceMeter.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/606?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvdXRpbHMvU2ltcGxlUGVyZm9ybWFuY2VNZXRlci5qYXZh) | `89.06% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/fair-acc/chart-fx/pull/606/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication