koraktor/mavanagaiata

View on GitHub

Showing 19 of 68 total issues

File JGitRepository.java has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * This code is free software; you can redistribute it and/or modify it under
 * the terms of the new BSD License.
 *
 * Copyright (c) 2012-2020, Sebastian Staudt

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

    public class JGitRepository extends AbstractGitRepository {
    
        static final String COMMONDIR_FILE = "commondir";
        static final Pattern DESCRIBE_PATTERN = Pattern.compile("(.*)-([1-9][0-9]*)-g([0-9a-f]+)$");
        static final String GITDIR_FILE = "gitdir";

      Method buildRepository has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          final void buildRepository(File workTree, File gitDir) throws GitRepositoryException {
              if (gitDir == null && workTree == null) {
                  throw new GitRepositoryException("Neither worktree nor GIT_DIR is set.");
              } else {
                  if (workTree != null && !workTree.exists()) {

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

          void parseMailMap(File mailMap) throws IOException {
              try (BufferedReader mailMapReader = new BufferedReader(new FileReader(mailMap))) {
                  String line;
                  while ((line = mailMapReader.readLine()) != null) {
                      line = line.trim();
      Severity: Minor
      Found in src/main/java/com/github/koraktor/mavanagaiata/git/MailMap.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 parseMailMap has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          void parseMailMap(File mailMap) throws IOException {
              try (BufferedReader mailMapReader = new BufferedReader(new FileReader(mailMap))) {
                  String line;
                  while ((line = mailMapReader.readLine()) != null) {
                      line = line.trim();
      Severity: Minor
      Found in src/main/java/com/github/koraktor/mavanagaiata/git/MailMap.java - About 1 hr to fix

        Method run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void run(GitRepository repository) throws MavanagaiataMojoException {
                try {
                    GitCommit commit = repository.getHeadCommit();
                    String abbrevId  = repository.getAbbreviatedCommitId();
                    String shaId     = commit.getId();
        Severity: Minor
        Found in src/main/java/com/github/koraktor/mavanagaiata/mojo/CommitMojo.java - About 1 hr to fix

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

              @Override
              protected void writeOutput(GitRepository repository)
                      throws MavanagaiataMojoException {
                  try {
                      mailMap = repository.getMailMap();

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

                void printCompareLink(String currentRef, String lastRef, boolean isBranch) {
                    if (baseUrl == null) {
                        return;
                    }
            
            

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

                    protected void run() throws GitRepositoryException {
                        if (skipCommitsPattern != null && skipCommitsPattern.matcher(currentCommit.getMessage()).find()) {
                            return;
                        }
            
            

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

                private void resolveLinkedWorkTree(File workTree, File foundGitDir, FileRepositoryBuilder repositoryBuilder) throws IOException {
                    if (directoryContains(foundGitDir.getParentFile(), workTree)) {
                        repositoryBuilder.setGitDir(foundGitDir);
                        repositoryBuilder.setWorkTree(foundGitDir.getParentFile());
                    } else {

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

                @Override
                public GitTagDescription describe() throws GitRepositoryException {
                    DescribeCommand command = getDescribeCommand();
            
                    try {

              Method getValueSource has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  MapBasedValueSource getValueSource(GitRepository repository)
                          throws GitRepositoryException {
                      GitTagDescription description = repository.describe();
              
                      String abbrevId  = repository.getAbbreviatedCommitId();

                Method initConfiguration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    protected void initConfiguration() {
                        super.initConfiguration();
                
                        format = formatTemplate.getFormat().apply(format);
                Severity: Minor
                Found in src/main/java/com/github/koraktor/mavanagaiata/mojo/ChangelogMojo.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 writeOutput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    protected void writeOutput(GitRepository repository)
                            throws MavanagaiataMojoException {
                        try {
                            mailMap = repository.getMailMap();

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

                    @Override
                    public GitTagDescription describe() throws GitRepositoryException {
                        DescribeCommand command = getDescribeCommand();
                
                        try {

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

                    @Override
                    public Map<String, GitTag> getTags()
                            throws GitRepositoryException {
                        Map<String, GitTag> tags = new HashMap<>();
                
                

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

                    private void checkTag(GitRepository repository)
                            throws GitRepositoryException, CheckMojoException {
                        if (checkTag) {
                            if (!repository.describe().isTagged()) {
                                throw new CheckMojoException(CheckMojoException.Type.UNTAGGED);
                Severity: Minor
                Found in src/main/java/com/github/koraktor/mavanagaiata/mojo/CheckMojo.java - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    protected final void run(GitRepository repository) throws MavanagaiataMojoException {
                        if (getOutputFile() == null) {
                            printStream = System.out;
                            generateOutput(repository);

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

                    public final void execute()
                            throws MojoExecutionException, MojoFailureException {
                        if (skip) {
                            return;
                        }
                Severity: Minor
                Found in src/main/java/com/github/koraktor/mavanagaiata/mojo/AbstractGitMojo.java - About 25 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