mtwilliams/ryb

View on GitHub

Showing 19 of 19 total issues

Method merge_configuration_settings has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

      def merge_configuration_settings(base, overlay)
        merged = Ryb::Configuration.new

        merged.name = base.name
        merged.prefix = base.prefix if (base and base.prefix)
Severity: Minor
Found in lib/rybfile/walker.rb - About 6 hrs 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 on_product_triplet has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def on_product_triplet(project, product, tripletised)
        tripletised = tripletised.()

        config = tripletised.configuration.name.to_sym
        platform = tripletised.platform.name.to_sym
Severity: Major
Found in lib/ryb/ninja.rb - About 3 hrs to fix

    File ninja.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Ryb
      module Ninja
        class Generator
          def initialize(rybfile, opts)
            @rybfile = rybfile
    Severity: Minor
    Found in lib/ryb/ninja.rb - About 2 hrs to fix

      Method merge_configuration_settings has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def merge_configuration_settings(base, overlay)
              merged = Ryb::Configuration.new
      
              merged.name = base.name
              merged.prefix = base.prefix if (base and base.prefix)
      Severity: Minor
      Found in lib/rybfile/walker.rb - About 1 hr to fix

        Method environment has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def environment
                  variables = [
                    'ALLUSERSPROFILE',
                    'APPDATA',
                    'CommonProgramFiles',
        Severity: Minor
        Found in lib/ryb/ninja.rb - About 1 hr to fix

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

                def platform(name, opts={}, &block)
                  # TODO(mtwilliams): Refactor this.
                  @spec.platforms ||= []
          
                  existing_platform = find_by_canonical_name(@spec.platforms, name)
          Severity: Major
          Found in lib/ryb/dsl.rb and 1 other location - About 1 hr to fix
          lib/ryb/dsl.rb on lines 31..42

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

          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 architecture(name, opts={}, &block)
                  # TODO(mtwilliams): Refactor this.
                  @spec.architectures ||= []
          
                  existing_arch = find_by_canonical_name(@spec.architectures, name)
          Severity: Major
          Found in lib/ryb/dsl.rb and 1 other location - About 1 hr to fix
          lib/ryb/dsl.rb on lines 17..28

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

          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 overlay
                    merged.treat_warnings_as_errors = overlay.treat_warnings_as_errors unless overlay.treat_warnings_as_errors().nil?
                    merged.generate_debug_symbols = overlay.generate_debug_symbols unless overlay.generate_debug_symbols().nil?
                    merged.link_time_code_generation = overlay.link_time_code_generation unless overlay.link_time_code_generation().nil?
                    merged.optimize = overlay.optimize unless overlay.optimize().nil?
          Severity: Minor
          Found in lib/rybfile/walker.rb and 1 other location - About 35 mins to fix
          lib/rybfile/walker.rb on lines 171..175

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

          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 library(name, opts={}, &block)
                  # TODO(mtwilliams): Verify uniqueness.
                  lib = Ryb::Library.new
                  lib.name = Ryb::Name.new(name, :pretty => opts[:pretty])
                  DomainSpecificLanguage.for(lib).instance_eval(&block)
          Severity: Minor
          Found in lib/ryb/dsl.rb and 1 other location - About 35 mins to fix
          lib/ryb/dsl.rb on lines 256..262

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

          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 base
                    merged.treat_warnings_as_errors = base.treat_warnings_as_errors unless base.treat_warnings_as_errors().nil?
                    merged.generate_debug_symbols = base.generate_debug_symbols unless base.generate_debug_symbols().nil?
                    merged.link_time_code_generation = base.link_time_code_generation unless base.link_time_code_generation().nil?
                    merged.optimize = base.optimize unless base.optimize().nil?
          Severity: Minor
          Found in lib/rybfile/walker.rb and 1 other location - About 35 mins to fix
          lib/rybfile/walker.rb on lines 178..182

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

          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 application(name, opts={}, &block)
                  # TODO(mtwilliams): Verify uniqueness.
                  app = Ryb::Application.new
                  app.name = Ryb::Name.new(name, :pretty => opts[:pretty])
                  DomainSpecificLanguage.for(app).instance_eval(&block)
          Severity: Minor
          Found in lib/ryb/dsl.rb and 1 other location - About 35 mins to fix
          lib/ryb/dsl.rb on lines 265..271

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

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

                def architecture(name, opts={}, &block)
                  # TODO(mtwilliams): Refactor this.
                  @spec.architectures ||= []
          
                  existing_arch = find_by_canonical_name(@spec.architectures, name)
          Severity: Minor
          Found in lib/ryb/dsl.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 configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def configuration(name, opts={}, &block)
                  @spec.configurations ||= []
          
                  existing_config = find_by_canonical_name(@spec.configurations, name)
                  config = existing_config || Ryb::Configuration.new
          Severity: Minor
          Found in lib/ryb/dsl.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 platform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def platform(name, opts={}, &block)
                  # TODO(mtwilliams): Refactor this.
                  @spec.platforms ||= []
          
                  existing_platform = find_by_canonical_name(@spec.platforms, name)
          Severity: Minor
          Found in lib/ryb/dsl.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 3 locations. Consider refactoring.
          Open

                gen.command :visual_studio do |vs|
                  # BUG(mtwilliams): Descriptions aren't being made available.
                  vs.desc 'Generate Visual Studio project files'
                  vs.long_desc 'Generates Visual Studio projects files, based on a Rybfile.'
                  vs.action do |global_opts, opts, args|
          Severity: Minor
          Found in lib/ryb/cli.rb and 2 other locations - About 15 mins to fix
          lib/ryb/cli.rb on lines 48..54
          lib/ryb/cli.rb on lines 58..64

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

                gen.command :xcode do |xcode|
                  # BUG(mtwilliams): Descriptions aren't being made available.
                  xcode.desc 'Generate XCode project files'
                  xcode.long_desc 'Generates XCode projects files, based on a Rybfile.'
                  xcode.action do |global_opts, opts, args|
          Severity: Minor
          Found in lib/ryb/cli.rb and 2 other locations - About 15 mins to fix
          lib/ryb/cli.rb on lines 38..44
          lib/ryb/cli.rb on lines 58..64

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

                gen.command :gmake do |gmake|
                  # BUG(mtwilliams): Descriptions aren't being made available.
                  gmake.desc 'Generate GNU Makefiles'
                  gmake.long_desc 'Generates GNU Makefiles, based on a Rybfile.'
                  gmake.action do |global_opts, opts, args|
          Severity: Minor
          Found in lib/ryb/cli.rb and 2 other locations - About 15 mins to fix
          lib/ryb/cli.rb on lines 38..44
          lib/ryb/cli.rb on lines 48..54

          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 cflags_for_platform(platform)
                    flags = []
                    # TODO(mtwilliams): @toolchains.for(target)
                    flags += VisualStudio::Compiler.include_paths_to_flags(platform.paths.includes) if platform.paths
                    flags += VisualStudio::Compiler.defines_to_flags(platform.defines)
          Severity: Minor
          Found in lib/ryb/ninja.rb and 1 other location - About 15 mins to fix
          lib/ryb/ninja.rb on lines 286..291

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

          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 ldflags_for_configuration(config)
                    flags = []
                    # TODO(mtwilliams): @toolchains.for(target)
                    flags += VisualStudio::Linker.library_paths_to_flags(config.paths.libraries) if config.paths
                    flags += VisualStudio::Linker.generate_debug_symbols_to_flag(config.generate_debug_symbols)
          Severity: Minor
          Found in lib/ryb/ninja.rb and 1 other location - About 15 mins to fix
          lib/ryb/ninja.rb on lines 269..274

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

          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