configrd/configrd-service

View on GitHub

Showing 29 of 39 total issues

File GitConfigSource.java has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.configrd.core.git;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;
Severity: Minor
Found in src/main/java/io/configrd/core/git/GitConfigSource.java - About 3 hrs to fix

    Method main has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static void main(String[] args) throws Throwable {
    
        System.setProperty("org.jboss.logging.provider", "slf4j");
    
        Options options = new Options();
    Severity: Major
    Found in src/main/java/io/configrd/service/ConfigrdServer.java - About 2 hrs to fix

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

      @SuppressWarnings("serial")
      public class GitRepoDef extends DefaultRepoDef
          implements SecuredRepo, FileBasedRepo, GitCredentials {
      
        public enum AuthMethod {
      Severity: Minor
      Found in src/main/java/io/configrd/core/git/GitRepoDef.java - About 2 hrs to fix

        Method start has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected void start(Map<String, Object> initParama) throws Throwable {
        
            if (GitStreamSource.GIT.equalsIgnoreCase((String) initParama.get(RepoDef.SOURCE_NAME_FIELD))
                && !initParama.containsKey(GitRepoDef.LOCAL_CLONE_FIELD)) {
              initParama.put(GitRepoDef.LOCAL_CLONE_FIELD, DEFAULT_LOCAL_CLONE);
        Severity: Minor
        Found in src/main/java/io/configrd/service/ConfigrdServer.java - About 1 hr to fix

          Method valid has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            @Override
            public String[] valid() {
          
              List<String> err = new ArrayList<>();
          
          
          Severity: Minor
          Found in src/main/java/io/configrd/core/git/GitRepoDef.java - About 1 hr to fix

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

            public boolean put(String path, PropertyPacket packet) {
          
              long start = System.currentTimeMillis();
              CannedAccessControlList acl = CannedAccessControlList.AuthenticatedRead;
          
          
          Severity: Minor
          Found in src/main/java/io/configrd/core/aws/s3/S3StreamSource.java - About 1 hr to fix

            Method gitPush has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private boolean gitPush(RevCommit commit) {
            
                boolean success = true;
            
                RefSpec spec = null;
            Severity: Minor
            Found in src/main/java/io/configrd/core/git/GitConfigSource.java - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (StringUtils.hasText(getAuthMethod())
                      && (getAuthMethod().equals(AuthMethod.CodeCommitGitCreds.name())
                          || getAuthMethod().equals(AuthMethod.CodeCommitIAMUser.name())
                          || getAuthMethod().equals(AuthMethod.GitHub.name()))
                      && (!StringUtils.hasText(getUsername()) || getUsername().trim().startsWith("${")
              Severity: Critical
              Found in src/main/java/io/configrd/core/git/GitRepoDef.java - About 1 hr to fix

                Method valid has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  @Override
                  public String[] valid() {
                
                    List<String> err = new ArrayList<>();
                
                
                Severity: Minor
                Found in src/main/java/io/configrd/core/git/GitRepoDef.java - About 1 hr to fix

                  Method setupCredentials has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private void setupCredentials(String scheme, TransportCommand<? extends GitCommand, ?> command) {
                  
                      if (getStreamSource().getSourceConfig().getAuthMethod() != null
                          && (scheme == null || (!scheme.toLowerCase().startsWith("http")
                              && !scheme.toLowerCase().startsWith("git:")))) {
                  Severity: Minor
                  Found in src/main/java/io/configrd/core/git/GitConfigSource.java - About 1 hr to fix

                    Method write has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private String write(PropertyPacket packet) {
                    
                        final URI uri = toURI(packet);
                    
                        String content = null;
                    Severity: Minor
                    Found in src/main/java/io/configrd/core/git/GitStreamSource.java - About 1 hr to fix

                      Method gitPush has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        private boolean gitPush(RevCommit commit) {
                      
                          boolean success = true;
                      
                          RefSpec spec = null;
                      Severity: Minor
                      Found in src/main/java/io/configrd/core/git/GitConfigSource.java - About 1 hr to fix

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

                        @Override
                        public GitConfigSource newConfigSource(String name, Map<String, Object> values) {
                      
                          GitRepoDef def = new GitRepoDef(name, values);
                      
                      
                      Severity: Minor
                      Found in src/main/java/io/configrd/core/git/GitConfigSourceFactory.java - About 1 hr to fix

                        Method newConfigSource has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          @Override
                          public GitConfigSource newConfigSource(String name, Map<String, Object> values) {
                        
                            GitRepoDef def = new GitRepoDef(name, values);
                        
                        
                        Severity: Minor
                        Found in src/main/java/io/configrd/core/git/GitConfigSourceFactory.java - About 55 mins to fix

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

                          protected void init_repos(Map<String, Object> initParama) throws Exception {
                        
                            String path = (String) initParama.get(RepoDef.URI_FIELD);
                        
                            URI uri = URI.create(ConfigSourceResolver.DEFAULT_CONFIG_URI);
                        Severity: Minor
                        Found in src/main/java/io/configrd/service/ConfigrdServer.java - About 45 mins to fix

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

                          protected void start(Map<String, Object> initParama) throws Throwable {
                        
                            if (GitStreamSource.GIT.equalsIgnoreCase((String) initParama.get(RepoDef.SOURCE_NAME_FIELD))
                                && !initParama.containsKey(GitRepoDef.LOCAL_CLONE_FIELD)) {
                              initParama.put(GitRepoDef.LOCAL_CLONE_FIELD, DEFAULT_LOCAL_CLONE);
                        Severity: Minor
                        Found in src/main/java/io/configrd/service/ConfigrdServer.java - About 45 mins to fix

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

                          private void setupCredentials(String scheme, TransportCommand<? extends GitCommand, ?> command) {
                        
                            if (getStreamSource().getSourceConfig().getAuthMethod() != null
                                && (scheme == null || (!scheme.toLowerCase().startsWith("http")
                                    && !scheme.toLowerCase().startsWith("git:")))) {
                        Severity: Minor
                        Found in src/main/java/io/configrd/core/git/GitConfigSource.java - About 45 mins to fix

                        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 sign has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          private static byte[] sign(String key, String dateStamp, String regionName, String serviceName,
                              String toSign)
                        Severity: Minor
                        Found in src/main/java/io/configrd/core/git/CodeCommitCredentialHelper.java - About 35 mins to fix

                          Method compilePatterns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            protected Pattern compilePatterns(Map<String, Object> vals, final String key) {
                          
                              Pattern dest = Pattern.compile("a^");
                          
                              if (vals.get(key.toLowerCase()) != null) {
                          Severity: Minor
                          Found in src/main/java/io/configrd/core/aws/kms/AbstractKmsFilter.java - About 35 mins to fix

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

                            @Override
                            public Response putTextProperties(String repo, String path, String eTag, InputStream body)
                                throws Exception {
                          
                              Response resp = Response.serverError().build();
                          Severity: Minor
                          Found in src/main/java/io/configrd/service/ConfigrdServiceImpl.java - About 35 mins to fix

                          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