Showing 241 of 391 total issues

Method renewSession has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected void renewSession(final CallContext ctx, final Config config) {
        val context = ctx.webContext();
        val sessionStore = ctx.sessionStore();

        val optOldSessionId = sessionStore.getSessionId(context, true);

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

GitHubProfile has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

public class GitHubProfile extends OAuth20Profile {

    @Serial
    private static final long serialVersionUID = -8030906034414268058L;

    CommonHelper has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public final class CommonHelper {
    
        /**
         * Return if the String is not blank.
         *
    Severity: Minor
    Found in pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java - About 2 hrs to fix

      Config has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @Setter
      @Getter
      @With
      @AllArgsConstructor
      @Accessors(chain = true)
      Severity: Minor
      Found in pac4j-core/src/main/java/org/pac4j/core/config/Config.java - About 2 hrs to fix

        DefaultSOAPPipelineFactory has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

        @SuppressWarnings("unchecked")
        public class DefaultSOAPPipelineFactory implements HttpClientMessagePipelineFactory {
            protected final SAML2Configuration configuration;
        
            protected final SAML2MetadataResolver idpMetadataResolver;

          WebContext has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public interface WebContext {
          
              /**
               * Return a request parameter.
               *
          Severity: Minor
          Found in pac4j-core/src/main/java/org/pac4j/core/context/WebContext.java - About 2 hrs to fix

            FacebookMusicListen has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public final class FacebookMusicListen implements Serializable {
            
                @Serial
                private static final long serialVersionUID = 3904637830042371121L;
            
            

              UserProfile has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "class")
              public interface UserProfile extends Serializable {
              
                  /**
                   * <p>getId.</p>
              Severity: Minor
              Found in pac4j-core/src/main/java/org/pac4j/core/profile/UserProfile.java - About 2 hrs to fix

                FacebookPhoto has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public final class FacebookPhoto implements Serializable {
                
                    @Serial
                    private static final long serialVersionUID = -1230468571423177489L;
                
                

                  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 storeMetadata has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      public boolean storeMetadata(final String metadata, final boolean force) throws Exception {
                          if (metadataResource == null || CommonHelper.isBlank(metadata)) {
                              logger.info("No metadata or resource is provided");
                              return false;

                  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 buildAuthnRequest has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @SuppressWarnings("unchecked")
                      protected final AuthnRequest buildAuthnRequest(final SAML2MessageContext context,
                                                                     final Endpoint assertionConsumerService,
                                                                     final Endpoint ssoService) {
                          val configContext = context.getConfigurationContext();

                  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 extract has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      public Optional<Credentials> extract(final CallContext ctx) {
                          val webContext = ctx.webContext();
                  
                          var username = Optional.<String>empty();

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

                      @Override
                      public Config build(final Object... parameters) {
                  
                          final List<Client> clients = new ArrayList<>();
                          final Map<String, Authenticator> authenticators = new HashMap<>();

                    Method buildProfile has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected void buildProfile(final SAML2AuthenticationCredentials credentials) {
                            UserProfile profile = (SAML2Profile) getProfileDefinition().newProfile();
                    
                            val nameId = credentials.getNameId();
                            profile.setId(nameId.getValue());

                      StravaProfile has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      public class StravaProfile extends OAuth20Profile {
                      
                          @Serial
                          private static final long serialVersionUID = 995023712830997358L;
                      
                      

                        BaseClient has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        @Getter
                        @Setter
                        @ToString(exclude = "logger")
                        @Accessors(chain = true)
                        public abstract class BaseClient extends InitializableObject implements Client {
                        Severity: Minor
                        Found in pac4j-core/src/main/java/org/pac4j/core/client/BaseClient.java - About 2 hrs to fix

                          Method tryCreatePasswordEncoder has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public void tryCreatePasswordEncoder(final Map<String, org.pac4j.core.credentials.password.PasswordEncoder> encoders) {
                                  for (var i = 0; i <= MAX_NUM_ENCODERS; i++) {
                                      val type = getProperty(SPRING_ENCODER_TYPE, i);
                                      if (isNotBlank(type)) {
                                          final PasswordEncoder encoder;

                            Method retrieveMatchers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected List<Matcher> retrieveMatchers(final String matcherName, final Map<String, Matcher> matchersMap) {
                                    final List<Matcher> results = new ArrayList<>();
                                    for (val entry : matchersMap.entrySet()) {
                                        if (areEqualsIgnoreCaseAndTrim(entry.getKey(), matcherName)) {
                                            results.add(entry.getValue());

                            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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                                @Override
                                public Object convert(final Object attribute) {
                                    if (attribute != null) {
                                        if (clazz.isAssignableFrom(attribute.getClass())) {
                                            return attribute;

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language