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

Add Cyclomatic Complexity implementation for Java #786

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

marco-ballario
Copy link
Contributor

@marco-ballario marco-ballario commented Feb 10, 2022

This PR adds the Cyclomatic Complexity metrics implementation for the Java language. Two unit tests are added to verify the correct computation of the measures. Thanks in advance for the review.

@Luni-4 Luni-4 requested a review from calixteman February 10, 2022 15:56
@marco-c
Copy link
Collaborator

marco-c commented Feb 10, 2022

CC @dburriss, since he's interested in Java support

@marco-ballario marco-ballario force-pushed the cyclomatic-java branch 2 times, most recently from 727c782 to 5600c46 Compare February 10, 2022 16:40
@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2022

Codecov Report

Merging #786 (0722e37) into master (e378b60) will decrease coverage by 0.06%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #786      +/-   ##
==========================================
- Coverage   39.76%   39.69%   -0.07%     
==========================================
  Files          51       51              
  Lines        6810     6827      +17     
  Branches      972      975       +3     
==========================================
+ Hits         2708     2710       +2     
- Misses       3446     3453       +7     
- Partials      656      664       +8     
Impacted Files Coverage Δ
src/metrics/cyclomatic.rs 77.02% <88.23%> (+1.45%) ⬆️
src/node.rs 71.15% <0.00%> (-15.39%) ⬇️
src/getter.rs 76.52% <0.00%> (-2.61%) ⬇️
src/spaces.rs 74.39% <0.00%> (-1.22%) ⬇️
src/metrics/nargs.rs 74.41% <0.00%> (-0.39%) ⬇️
src/metrics/loc.rs 80.28% <0.00%> (+0.24%) ⬆️
src/metrics/cognitive.rs 72.07% <0.00%> (+0.32%) ⬆️
src/metrics/halstead.rs 72.98% <0.00%> (+0.57%) ⬆️
src/metrics/exit.rs 74.77% <0.00%> (+0.90%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e378b60...0722e37. Read the comment docs.

@dburriss
Copy link
Contributor

Nice good to see.

@Luni-4 Luni-4 requested a review from calixteman February 11, 2022 08:51
Copy link
Collaborator

@calixteman calixteman left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

@Luni-4 Luni-4 merged commit d488b6e into mozilla:master Feb 11, 2022
@Luni-4 Luni-4 deleted the cyclomatic-java branch February 11, 2022 09:02
@calixteman
Copy link
Collaborator

Unrelated to this change, but in looking to the code for js, I think we (I ??) missed to add operators like ?? and ?. (maybe others ?): they're lazy evaluated like a || or a &&.
Oh and probably ||=, &&= are missing too.

@Luni-4
Copy link
Collaborator

Luni-4 commented Feb 11, 2022

Yep, right, we forgot them. Could you please open an issue in order to remember them? Thank you @calixteman! :)

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.

Implement metrics for Java code
6 participants