vasyl-purchel/alpaca

View on GitHub

Showing 12 of 12 total issues

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

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
Severity: Major
Found in test_data/sln1/TestSolution/Properties/AssemblyInfo.cs and 4 other locations - About 1 hr to fix
test_data/sln2/ProjectName/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName2/Properties/AssemblyInfo.cs on lines 1..38
test_data/sln2/Unit.Tests/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln3/TestSolution/Properties/AssemblyInfo.cs on lines 1..37

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 133.

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 5 locations. Consider refactoring.
Open

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
Severity: Major
Found in test_data/sln2/ProjectName2/Properties/AssemblyInfo.cs and 4 other locations - About 1 hr to fix
test_data/sln1/TestSolution/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/Unit.Tests/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln3/TestSolution/Properties/AssemblyInfo.cs on lines 1..37

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 133.

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 5 locations. Consider refactoring.
Open

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
Severity: Major
Found in test_data/sln3/TestSolution/Properties/AssemblyInfo.cs and 4 other locations - About 1 hr to fix
test_data/sln1/TestSolution/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName2/Properties/AssemblyInfo.cs on lines 1..38
test_data/sln2/Unit.Tests/Properties/AssemblyInfo.cs on lines 1..37

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 133.

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 5 locations. Consider refactoring.
Open

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
Severity: Major
Found in test_data/sln2/ProjectName/Properties/AssemblyInfo.cs and 4 other locations - About 1 hr to fix
test_data/sln1/TestSolution/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName2/Properties/AssemblyInfo.cs on lines 1..38
test_data/sln2/Unit.Tests/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln3/TestSolution/Properties/AssemblyInfo.cs on lines 1..37

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 133.

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 5 locations. Consider refactoring.
Open

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
Severity: Major
Found in test_data/sln2/Unit.Tests/Properties/AssemblyInfo.cs and 4 other locations - About 1 hr to fix
test_data/sln1/TestSolution/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName/Properties/AssemblyInfo.cs on lines 1..37
test_data/sln2/ProjectName2/Properties/AssemblyInfo.cs on lines 1..38
test_data/sln3/TestSolution/Properties/AssemblyInfo.cs on lines 1..37

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 133.

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

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

    def load_extended_characters(file)
      until file.eof?
        i = file.gets.strip.split(/ /).first
        if i && i.empty?
          next
Severity: Minor
Found in lib/alpacabuildtool/log/font.rb - 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 validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def validate
      fail FileNotFound unless File.exist?(@file)
      fail MajorVersionNotInt unless @major.is_a?(Integer)
      fail MinorVersionNotInt unless @minor.is_a?(Integer)
      fail PatchVersionNotInt unless @patch.is_a?(Integer)
Severity: Minor
Found in lib/alpacabuildtool/versioning/version.rb - 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 each_solution has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def each_solution(pattern)
      Dir.glob(pattern).each do |file|
        next unless File.file?(file) && file.end_with?('.sln')
        solution = Solution.new(file)
        log.puts solution
Severity: Minor
Found in lib/alpacabuildtool/application.rb - 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 install has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def install(package,
                outputdir = nil,
                prerelease = false,
                exclude_version = false,
                source = nil)
Severity: Minor
Found in lib/alpacabuildtool/tools/nuget.rb - About 35 mins to fix

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

        def initialize(configuration)
          @configuration = configuration.dup
          @exe = @configuration['exe'] || ''
          @exe = find_executable @exe unless File.executable? @exe
          @exe = yield unless @exe || !block_given?
    Severity: Minor
    Found in lib/alpacabuildtool/tools/tool.rb - 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 create_package has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_package(config, version, options)
          config = generate_config(config, version)
          project = @solution.project(config['project'])
          changes, changelog = package_changes(config, project.dir)
          log.info "#{config['id']} unchanged..." unless changes
    Severity: Minor
    Found in lib/alpacabuildtool/managers/package_manager.rb - 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(name, content = nil, &block)
          @name = name
          return @content = content unless content.nil?
          return unless block_given?
          @arity = block.arity
    Severity: Minor
    Found in lib/alpacabuildtool/entities/xml_node.rb - 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