macgregor/alexandria

View on GitHub

Showing 263 of 263 total issues

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

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        if(isExecutionRoot()) {
            try {
                init();

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

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        if(isExecutionRoot()) {
            try {
                init();

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public RelativeFileFilter(Path basePath, String wildcard){
            super(wildcard);
            if (basePath == null) {
                throw new IllegalArgumentException("Relative base paths must not be null");
            }
alexandria-core/src/main/java/com/github/macgregor/alexandria/PathFinder.java on lines 375..381

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 41.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public RelativeFileFilter(Path basePath, List<String> wildcards){
            super(wildcards);
            if (basePath == null) {
                throw new IllegalArgumentException("Relative base paths must not be null");
            }
alexandria-core/src/main/java/com/github/macgregor/alexandria/PathFinder.java on lines 360..366

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 41.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if(place.resources != null && place.resources.containsKey("html")){
            metadata.setExtraProperty(JIVE_PARENT_URI, place.resources.get("html").ref);
        }
alexandria-remote-jive/src/main/java/com/github/macgregor/alexandria/remotes/JiveRemote.java on lines 425..427

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this method.
Open

        return false;

    Avoid too many return statements within this method.
    Open

                        return State.UPDATE;

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if(place.resources != null && place.resources.containsKey("self")){
                  metadata.setExtraProperty(JIVE_PARENT_API_URI, place.resources.get("self").ref);
              }
      alexandria-remote-jive/src/main/java/com/github/macgregor/alexandria/remotes/JiveRemote.java on lines 422..424

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid too many return statements within this method.
      Open

                  return State.CURRENT;

        Method init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public Alexandria init() throws IOException {
                if(inputs == null || inputs.isEmpty()){
                    inputs = new ArrayList<>();
                    inputs.add(rootDir());
                }

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

            @Override
            public boolean wants(String rawLink) {
                if(StringUtils.isBlank(rawLink)){
                    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 isIndexed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public Optional<Config.DocumentMetadata> isIndexed(Path path){
                Path absolutePath = Resources.absolutePath(configPath().getParent(), path);
                if(config.metadata().isPresent()){
                    for(Config.DocumentMetadata metadata : config.metadata().get()){
                        if(metadata.sourcePath().equals(absolutePath)){

        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

        Trailing spaces
        Open

        5. All tests are passing and Code coverage has not dropped below current master level (>= 95%): 

        MD009 - Trailing spaces

        Tags: whitespace

        Aliases: no-trailing-spaces

        Parameters: br_spaces (number; default: 0)

        This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

        The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

        Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

        Inline HTML
        Open

          <dt>Definition list</dt>

        MD033 - Inline HTML

        Tags: html

        Aliases: no-inline-html

        This rule is triggered whenever raw HTML is used in a markdown document:

        Inline HTML header

        To fix this, use 'pure' markdown instead of including raw HTML:

        # Markdown header

        Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

        Horizontal rule style
        Open

        ***

        MD035 - Horizontal rule style

        Tags: hr

        Aliases: hr-style

        Parameters: style ("consistent", "---", "***", or other string specifying the horizontal rule; default "consistent")

        This rule is triggered when inconsistent styles of horizontal rules are used in the document:

        ---
        
        - - -
        
        ***
        
        * * *
        
        ****

        To fix this, ensure any horizontal rules used in the document are consistent, or match the given style if the rule is so configured:

        ---
        
        ---

        Note: by default, this rule is configured to just require that all horizontal rules in the document are the same, and will trigger if any of the horizontal rules are different than the first one encountered in the document. If you want to configure the rule to match a specific style, the parameter given to the 'style' option is a string containing the exact horizontal rule text that is allowed.

        Fenced code blocks should be surrounded by blank lines
        Open

        ```

        MD031 - Fenced code blocks should be surrounded by blank lines

        Tags: code, blank_lines

        Aliases: blanks-around-fences

        This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:

        Some text
        ```
        Code block
        ```
        
        ```
        Another code block
        ```
        Some more text

        To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):

        Some text
        
        ```
        Code block
        ```
        
        ```
        Another code block
        ```
        
        Some more text

        Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

        Multiple consecutive blank lines
        Open

        
        
        Severity: Info
        Found in .github/ISSUE_TEMPLATE.md by markdownlint

        MD012 - Multiple consecutive blank lines

        Tags: whitespace, blank_lines

        Aliases: no-multiple-blanks

        This rule is triggered when there are multiple consecutive blank lines in the document:

        Some text here
        
        
        Some more text here

        To fix this, delete the offending lines:

        Some text here
        
        Some more text here

        Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

        Lists should be surrounded by blank lines
        Open

        1. Give a descriptive title to your PR.

        MD032 - Lists should be surrounded by blank lines

        Tags: bullet, ul, ol, blank_lines

        Aliases: blanks-around-lists

        This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

        Some text
        * Some
        * List
        
        1. Some
        2. List
        Some text

        To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

        Some text
        
        * Some
        * List
        
        1. Some
        2. List
        
        Some text

        Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

        Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

        * This is
        not okay
        
        * This is
          okay

        Line length
        Open

        [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"

        MD013 - Line length

        Tags: line_length

        Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

        This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

        This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

        You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

        Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

        Trailing spaces
        Open

        sync them as part of your project's build process. 
        Severity: Info
        Found in README.md by markdownlint

        MD009 - Trailing spaces

        Tags: whitespace

        Aliases: no-trailing-spaces

        Parameters: br_spaces (number; default: 0)

        This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

        The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

        Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

        Severity
        Category
        Status
        Source
        Language