damphyr/gaudi

View on GitHub

Showing 11 of 11 total issues

Method options has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.options(arguments)
      options = OpenStruct.new
      options.project_root = Dir.pwd
      options.verbose = false
      options.scaffold = false
Severity: Major
Found in gem/lib/gaudi/scaffolding.rb - About 2 hrs to fix

    Method core has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def core(url, version, lib_items)
          Dir.mktmpdir do |tmp|
            raise GemError, "Cloning the Gaudi repo failed. Check that git is on the PATH and that #{REPO} is accessible" unless pull_from_repo(url, tmp)
    
            lib_items.each do |items|
    Severity: Minor
    Found in gem/lib/gaudi/scaffolding.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 load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.load(configuration_files)
            cfg = nil
            configuration_files.each do |cfg_file|
              if cfg
                cfg.merge(cfg_file)
    Severity: Minor
    Found in lib/gaudi-c/helpers/configuration.rb - 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 parse_content has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_content(lines, cfg_dir, list_keys, path_keys)
            cfg = {}
            lines.each do |l|
              l.gsub!("\t", "")
              l.chomp!
    Severity: Minor
    Found in lib/gaudi/helpers/configuration.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 handle_key has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def handle_key(key, value, cfg_dir, list_keys, path_keys, cfg)
    Severity: Minor
    Found in lib/gaudi/helpers/configuration.rb - About 45 mins to fix

      Method handle_key_append has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def handle_key_append(key, value, cfg_dir, list_keys, path_keys, cfg)
      Severity: Minor
      Found in lib/gaudi/helpers/configuration.rb - About 45 mins to fix

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

              def executable_rule(system_config, platform)
                platform_config = system_config.platform_config(platform)
                _, _, exe = platform_config.extensions
                # we configure them with dots which messes the regexp up
                ext = exe.gsub(".", "")
        Severity: Minor
        Found in lib/gaudi-c/helpers/generators.rb and 1 other location - About 40 mins to fix
        lib/gaudi-c/helpers/generators.rb on lines 153..160

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

        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

              def object_rule(system_config, platform)
                platform_config = system_config.platform_config(platform)
                obj, _, _ = platform_config.extensions
                # we configure them with dots which messes the regexp up
                ext = obj.gsub(".", "")
        Severity: Minor
        Found in lib/gaudi-c/helpers/generators.rb and 1 other location - About 40 mins to fix
        lib/gaudi-c/helpers/generators.rb on lines 141..148

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

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

            def interpret_library_tokens(tokens, config, base_dir)
              tokens.map do |o|
                raise GaudiConfigurationError, "Library token #{o} not found in the external libraries configuration" unless config[o]
                lib_path = File.expand_path(File.join(base_dir, config[o]))
                File.exist?(lib_path) ? lib_path : config[o]
        Severity: Minor
        Found in lib/gaudi-c/helpers/operations.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

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

            def library(component, system_config)
              _, ext_lib, ext_exe = *system_config.extensions(component.platform)
              File.join(system_config.out, component.platform, component.name, "#{component.name}#{ext_lib}")
        Severity: Minor
        Found in lib/gaudi-c/helpers/paths.rb and 1 other location - About 15 mins to fix
        lib/gaudi-c/helpers/paths.rb on lines 44..46

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

        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

            def executable(component, system_config)
              _, _, ext_exe = *system_config.extensions(component.platform)
              File.join(system_config.out, component.platform, component.name, "#{component.name}#{ext_exe}")
        Severity: Minor
        Found in lib/gaudi-c/helpers/paths.rb and 1 other location - About 15 mins to fix
        lib/gaudi-c/helpers/paths.rb on lines 50..52

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

        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

        Severity
        Category
        Status
        Source
        Language