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

Sonar refactoring - IdentityProviderEndpoints class #2890

Merged
merged 12 commits into from
May 29, 2024
Merged

Conversation

strehle
Copy link
Member

@strehle strehle commented May 14, 2024

See

old:
https://sonarcloud.io/code?id=cloudfoundry-identity-parent&selected=cloudfoundry-identity-parent%3Aserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fcloudfoundry%2Fidentity%2Fuaa%2Fprovider%2FIdentityProviderEndpoints.java

vs.

new:
https://sonarcloud.io/code?id=cloudfoundry-identity-parent&pullRequest=2890&selected=cloudfoundry-identity-parent%3Aserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fcloudfoundry%2Fidentity%2Fuaa%2Fprovider%2FIdentityProviderEndpoints.java

Sonar:
https://sonarcloud.io/summary/new_code?id=cloudfoundry-identity-parent&pullRequest=2890

Did refactoring because of

  1. Working on a fix for Cannot remove a secret from IdP via REST #2880 showed that code coverage is too less.
  2. Duplication rate of 4% withing a class is too high. Duplication rate always reduces coverage and always is a risk that in one case everything is ok, but in the other case we have no tests and no knowledge about our code.
    x. The rest, e.g. logging or instance of are changes which came from plugins in IDE.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/187603855

The labels on this github issue will be updated when the story is started.

@strehle strehle changed the title Sonar refactoring - no change to logger Sonar refactoring - IdentityProviderEndpoints class May 15, 2024
@strehle strehle mentioned this pull request May 15, 2024
@strehle strehle requested a review from a team May 15, 2024 05:40
@strehle strehle requested a review from hsinn0 May 23, 2024 06:32
…torIdp2

# Conflicts:
#	server/src/main/java/org/cloudfoundry/identity/uaa/provider/IdentityProviderEndpoints.java
Copy link
Contributor

@hsinn0 hsinn0 left a comment

Choose a reason for hiding this comment

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

Will come back to review once the test failures are resolved.

@strehle strehle requested a review from hsinn0 May 24, 2024 13:28
return new ResponseEntity<>(body, UNPROCESSABLE_ENTITY);
}
updatedIdp.setSerializeConfigRaw(rawConfig);
setAuthMethod(updatedIdp);
redactSensitiveData(updatedIdp);

return new ResponseEntity<>(updatedIdp, OK);
return new ResponseEntity<>(updatedIdp, status);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this not end up returning different status for the same result after this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

this part was a duplicated one, see
image

now an extra method persistIdentityProviderChange for create and update

@strehle strehle requested a review from hsinn0 May 27, 2024 15:43
@strehle
Copy link
Member Author

strehle commented May 27, 2024

@hsinn0 compare sonar findings from develop compared to this branch, see
#2890 (comment)

@Tallicia Tallicia added the accepted Accepted the issue label May 29, 2024
@strehle strehle merged commit 333ffcc into develop May 29, 2024
20 checks passed
@strehle strehle deleted the refactorIdp2 branch May 29, 2024 14:47
@cf-gitbot cf-gitbot removed unscheduled accepted Accepted the issue labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants