pac4j-core/src/main/java/org/pac4j/core/engine/DefaultLogoutLogic.java

Summary

Maintainability
D
1 day
Test Coverage

Method perform has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Object perform(final Config config, final String defaultUrl, final String inputLogoutUrlPattern, final Boolean inputLocalLogout,
                          final Boolean inputDestroySession, final Boolean inputCentralLogout, final FrameworkParameters parameters) {

        LOGGER.debug("=== LOGOUT ===");

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 perform has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public Object perform(final Config config, final String defaultUrl, final String inputLogoutUrlPattern, final Boolean inputLocalLogout,
                          final Boolean inputDestroySession, final Boolean inputCentralLogout, final FrameworkParameters parameters) {

        LOGGER.debug("=== LOGOUT ===");

    Method perform has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public Object perform(final Config config, final String defaultUrl, final String inputLogoutUrlPattern, final Boolean inputLocalLogout,
                              final Boolean inputDestroySession, final Boolean inputCentralLogout, final FrameworkParameters parameters) {
    Severity: Major
    Found in pac4j-core/src/main/java/org/pac4j/core/engine/DefaultLogoutLogic.java - About 50 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (logoutAction.isPresent()) {
                                      action = logoutAction.get();
                                      break;
                                  }
      Severity: Major
      Found in pac4j-core/src/main/java/org/pac4j/core/engine/DefaultLogoutLogic.java - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (redirectUrl != null) {
                                        redirectUrl = enhanceRedirectUrl(ctx, config, client.get(), redirectUrl);
                                        if (redirectUrl.startsWith(HttpConstants.SCHEME_HTTP) ||
                                            redirectUrl.startsWith(HttpConstants.SCHEME_HTTPS)) {
                                            targetUrl = redirectUrl;
        Severity: Major
        Found in pac4j-core/src/main/java/org/pac4j/core/engine/DefaultLogoutLogic.java - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status