Skip to content
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

Addresses #257 #303

Merged
merged 1 commit into from
Sep 20, 2024
Merged

Addresses #257 #303

merged 1 commit into from
Sep 20, 2024

Conversation

AlexisDrogoul
Copy link
Member

@AlexisDrogoul AlexisDrogoul commented Aug 31, 2024

Adds common modifiers (shift, alt, ctrl and cmd) to the list of possible triggers for event layers to fix #257

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: -0.14 (8.51 -> 8.37)

  • Declining Code Health: 4 findings(s) 🚩

View detailed results in CodeScene

Comment on lines +94 to +97
case KeyboardEventLayerDelegate.SHIFT_MODIFIER -> KEY_SHIFT;
case KeyboardEventLayerDelegate.CMD_MODIFIER -> KEY_CMD;
case KeyboardEventLayerDelegate.CONTROL_MODIFIER -> KEY_CTRL;
case KeyboardEventLayerDelegate.ALT_MODIFIER -> KEY_ALT;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
getListeningEvent increases in cyclomatic complexity from 18 to 22, threshold = 9

Suppress

Comment on lines +112 to +115
case KeyEvent.VK_SHIFT -> IEventLayerListener.KEY_SHIFT;
case KeyEvent.VK_ALT -> IEventLayerListener.KEY_ALT;
case KeyEvent.VK_CONTROL -> IEventLayerListener.KEY_CTRL;
case KeyEvent.VK_META -> IEventLayerListener.KEY_CMD;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ Getting worse: Complex Method
keyPressed increases in cyclomatic complexity from 19 to 23, threshold = 9

Comment on lines +350 to +353
case java.awt.event.KeyEvent.VK_SHIFT -> IEventLayerListener.KEY_SHIFT;
case java.awt.event.KeyEvent.VK_ALT -> IEventLayerListener.KEY_ALT;
case java.awt.event.KeyEvent.VK_CONTROL -> IEventLayerListener.KEY_CTRL;
case java.awt.event.KeyEvent.VK_META -> IEventLayerListener.KEY_CMD;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
getKeyAdapterForAWT increases in cyclomatic complexity from 24 to 28, threshold = 9

Suppress

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally stupid code checks. I get an error when trying to suppress them, @lesquoyb, can you remove these checks ? Thanks !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this pr or overall?
Cyclomatic complexity doesn't make sense for big switch methods obviously but I think it's a good indicator for "normal" algorithm complexity.
Anyway the bots are just giving clues on the quality of code and you can merge even if they're not happy

Comment on lines +155 to +166
case SWT.COMMAND:
delegate.specialKeyPressed(IEventLayerListener.KEY_CMD);
return;
case SWT.SHIFT:
delegate.specialKeyPressed(IEventLayerListener.KEY_SHIFT);
return;
case SWT.ALT:
delegate.specialKeyPressed(IEventLayerListener.KEY_ALT);
return;
case SWT.CTRL:
delegate.specialKeyPressed(IEventLayerListener.KEY_CTRL);
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
keyPressed increases in cyclomatic complexity from 12 to 16, threshold = 9

Suppress

Comment on lines +202 to +213
case SWT.COMMAND:
delegate.specialKeyReleased(IEventLayerListener.KEY_CMD);
return;
case SWT.SHIFT:
delegate.specialKeyReleased(IEventLayerListener.KEY_SHIFT);
return;
case SWT.ALT:
delegate.specialKeyReleased(IEventLayerListener.KEY_ALT);
return;
case SWT.CTRL:
delegate.specialKeyReleased(IEventLayerListener.KEY_CTRL);
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
keyReleased increases in cyclomatic complexity from 11 to 15, threshold = 9

Suppress

@@ -152,7 +152,18 @@ public void keyPressed(final KeyEvent e) {
case SWT.CR, SWT.KEYPAD_CR:
delegate.specialKeyPressed(IEventLayerListener.KEY_RETURN);
return;

case SWT.COMMAND:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 4.11 to 4.74, threshold = 4

@lesquoyb
Copy link
Contributor

lesquoyb commented Sep 5, 2024

Two remarks:

  1. in 3d display the ctrl modifier doesn't work, probably caught by the display to manipulate the view.
  2. the command modifier is not available on other operating systems than macos

Maybe we could add a warning in those cases ?

@lesquoyb
Copy link
Contributor

I'm merging this pr, I created a new issue for the cases I mentioned above

@lesquoyb lesquoyb merged commit b37140d into 2024-06 Sep 20, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create an event for some key pressed
3 participants