pac4j-oauth/src/main/java/org/pac4j/oauth/profile/facebook/converter/FacebookRelationshipStatusConverter.java

Summary

Maintainability
C
1 day
Test Coverage

Method convert has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public FacebookRelationshipStatus convert(final Object attribute) {
        if (attribute != null) {
            if (attribute instanceof String) {
                var s = ((String) attribute).toLowerCase();

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method convert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public FacebookRelationshipStatus convert(final Object attribute) {
        if (attribute != null) {
            if (attribute instanceof String) {
                var s = ((String) attribute).toLowerCase();

    Avoid too many return statements within this method.
    Open

                        return FacebookRelationshipStatus.SEPARATED;

      Avoid too many return statements within this method.
      Open

                          return FacebookRelationshipStatus.MARRIED;

        Avoid too many return statements within this method.
        Open

                            return FacebookRelationshipStatus.IN_AN_OPEN_RELATIONSHIP;

          Avoid too many return statements within this method.
          Open

                              return FacebookRelationshipStatus.ENGAGED;

            Avoid too many return statements within this method.
            Open

                                return FacebookRelationshipStatus.SINGLE;

              Avoid too many return statements within this method.
              Open

                                  return FacebookRelationshipStatus.ITS_COMPLICATED;

                Avoid too many return statements within this method.
                Open

                                    return FacebookRelationshipStatus.WIDOWED;

                  Avoid too many return statements within this method.
                  Open

                                      return FacebookRelationshipStatus.IN_A_RELATIONSHIP;

                    Avoid too many return statements within this method.
                    Open

                            return null;

                      There are no issues that match your filters.

                      Category
                      Status