bashaus/gbtiles

View on GitHub

Showing 25 of 25 total issues

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

  module GBR
    module TileSet
      module Objects
        class Palettes < GBTiles::GBR::TileSet::Object

Severity: Major
Found in lib/gbtiles/gbr/tile_set/objects/palettes.rb and 1 other location - About 1 hr to fix
lib/gbtiles/gbr/tile_set/objects/tile_pal.rb on lines 2..26

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

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

  module GBR
    module TileSet
      module Objects
        class TilePal < GBTiles::GBR::TileSet::Object

Severity: Major
Found in lib/gbtiles/gbr/tile_set/objects/tile_pal.rb and 1 other location - About 1 hr to fix
lib/gbtiles/gbr/tile_set/objects/palettes.rb on lines 2..26

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

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

        def self.open file
          import = GBTiles::GBM::Import::GBMFile.new

          # Check to see if this is a valid file type
          if (file.read(3) != "GBO") then
Severity: Minor
Found in lib/gbtiles/gbm/import/gbm_file.rb - About 1 hr to fix

    Method open has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.open file
              import = GBTiles::GBR::Import::GBRFile.new
    
              # Check to see if this is a valid file type
              if (file.read(3) != "GBO") then
    Severity: Minor
    Found in lib/gbtiles/gbr/import/gbr_file.rb - About 1 hr to fix

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

        module GBR
          module TileSet
            module Objects
              class Producer < GBTiles::GBR::TileSet::Object
      
      
      Severity: Major
      Found in lib/gbtiles/gbr/tile_set/objects/producer.rb and 1 other location - About 1 hr to fix
      lib/gbtiles/gbm/map/objects/producer.rb on lines 2..22

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

      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

        module GBM
          module Map
            module Objects
              class Producer < GBTiles::GBM::Map::Object
      
      
      Severity: Major
      Found in lib/gbtiles/gbm/map/objects/producer.rb and 1 other location - About 1 hr to fix
      lib/gbtiles/gbr/tile_set/objects/producer.rb on lines 2..22

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

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

              def self.open file
                import = GBTiles::GBT::Import::MODFile.new
      
                import.mod_data.name = GBTiles::DataType.string(file.read(20))
      
      
      Severity: Minor
      Found in lib/gbtiles/gbt/import/mod_file.rb - About 1 hr to fix

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

                  def render_tile tile_index
                    tile = []
        
                    tile_data = @data.slice(
                      tile_index * @width * @height,
        Severity: Minor
        Found in lib/gbtiles/gbr/tile_set/objects/tile_data.rb - About 1 hr to fix

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

                      def convert_note_not_new
                        if is_empty_effect? then
                          return [0]
                        end
          
          
          Severity: Minor
          Found in lib/gbtiles/gbt/export/asm/channels/wav.rb and 1 other location - About 50 mins to fix
          lib/gbtiles/gbt/export/asm/channels/noise.rb on lines 28..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 42.

          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

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

                      def convert_note_not_new
                        if is_empty_effect? then
                          return [0]
                        end
          
          
          Severity: Minor
          Found in lib/gbtiles/gbt/export/asm/channels/noise.rb and 1 other location - About 50 mins to fix
          lib/gbtiles/gbt/export/asm/channels/wav.rb on lines 43..68

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

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                    def write output_stream
                      output_stream.write(render_s)
          
                      if output_stream.is_a? File then
                        header_filename = "#{File.basename(output_stream.path, ".s")}.h"
          Severity: Major
          Found in lib/gbtiles/gbt/export/asm/asm.rb and 2 other locations - About 45 mins to fix
          lib/gbtiles/gbm/export/asm/asm.rb on lines 47..55
          lib/gbtiles/gbr/export/asm/asm.rb on lines 40..48

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                    def write output_stream
                      output_stream.write(render_s)
          
                      if output_stream.is_a? File then
                        header_filename = "#{File.basename(output_stream.path, ".s")}.h"
          Severity: Major
          Found in lib/gbtiles/gbr/export/asm/asm.rb and 2 other locations - About 45 mins to fix
          lib/gbtiles/gbm/export/asm/asm.rb on lines 47..55
          lib/gbtiles/gbt/export/asm/asm.rb on lines 48..56

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

                    def write output_stream
                      output_stream.write(render_s)
          
                      if output_stream.is_a? File then
                        header_filename = "#{File.basename(output_stream.path, ".s")}.h"
          Severity: Major
          Found in lib/gbtiles/gbm/export/asm/asm.rb and 2 other locations - About 45 mins to fix
          lib/gbtiles/gbr/export/asm/asm.rb on lines 40..48
          lib/gbtiles/gbt/export/asm/asm.rb on lines 48..56

          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

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

                    def convert_effect
                      if effect_number == 0x0 then
                        return effect_arpeggio
                      end
          
          
          Severity: Minor
          Found in lib/gbtiles/gbt/export/asm/channel.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 open has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.open file
                    import = GBTiles::GBM::Import::GBMFile.new
          
                    # Check to see if this is a valid file type
                    if (file.read(3) != "GBO") then
          Severity: Minor
          Found in lib/gbtiles/gbm/import/gbm_file.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

          Avoid too many return statements within this method.
          Open

                          return 1
          Severity: Major
          Found in lib/gbtiles/gbt/export/asm/channels/wav.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                          return effect_speed
            Severity: Major
            Found in lib/gbtiles/gbt/export/asm/channel.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                            return effect_pan
              Severity: Major
              Found in lib/gbtiles/gbt/export/asm/channel.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                              return effect_cut_note
                Severity: Major
                Found in lib/gbtiles/gbt/export/asm/channel.rb - About 30 mins to fix

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

                          def self.open file
                            import = GBTiles::GBT::Import::MODFile.new
                  
                            import.mod_data.name = GBTiles::DataType.string(file.read(20))
                  
                  
                  Severity: Minor
                  Found in lib/gbtiles/gbt/import/mod_file.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