guerilla-di/tracksperanto

View on GitHub

Showing 44 of 44 total issues

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

  class Sorter
    include Tracksperanto::SimpleExport # so that it calls OUR methods
    
    def initialize(exporter)
      @exp = exporter
Severity: Major
Found in lib/export/flame_stabilizer_2014_cornerpin.rb and 1 other location - About 3 hrs to fix
lib/export/flame_stabilizer_cornerpin.rb on lines 23..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 129.

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

  class Sorter
    include Tracksperanto::SimpleExport # so that it calls OUR methods
    
    def initialize(exporter)
      @exp = exporter
Severity: Major
Found in lib/export/flame_stabilizer_cornerpin.rb and 1 other location - About 3 hrs to fix
lib/export/flame_stabilizer_2014_cornerpin.rb on lines 23..69

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

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

    def parse
      
      if @buf.length > MAX_BUFFER_SIZE # Wrong format and the buffer is filled up, bail
        raise WrongInputError, "Atom buffer overflow at #{MAX_BUFFER_SIZE} bytes, this is definitely not a Shake script"
      end
Severity: Minor
Found in lib/import/shake_grammar/lexer.rb - About 3 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 stabilize has 17 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def stabilize(imageIn, applyTransform, inverseTransform, trackType,
      track1X, track1Y,
      stabilizeX, stabilizeY,
      track2X, track2Y,
      matchScale,
Severity: Major
Found in lib/import/shake_script.rb - About 2 hrs to fix

    Method matchmove has 17 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def matchmove(bgImage, fgImage, applyTransform,
          trackType,
          track1X,
          track1Y,
          matchX,
    Severity: Major
    Found in lib/import/shake_script.rb - About 2 hrs to fix

      Method tracker has 17 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def tracker(input, trackRange, subPixelRes, matchSpace,
              referenceTolerance, referenceBehavior, failureTolerance, failureBehavior, limitProcessing, referencFrame, 
              s1, s2, s3, s4, s5, s6, *trackers)
      Severity: Major
      Found in lib/import/shake_script.rb - About 2 hrs to fix

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

          def write_deltax_and_deltay_channels
            # This is used for deltax and deltay (offset tracking).
            # We set it to zero and lock
            %w( ref/dx ref/dy).map(&method(:prefix)).each do | chan, v |
              @writer.channel(chan) do | c |
        Severity: Major
        Found in lib/export/flame_stabilizer.rb and 1 other location - About 1 hr to fix
        lib/export/flame_stabilizer_2014.rb on lines 221..244

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

        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 write_deltax_and_deltay_channels
            # This is used for deltax and deltay (offset tracking).
            # We set it to zero and lock
            %w( ref/dx ref/dy).map(&method(:prefix)).each do | chan, v |
              @writer.channel(chan) do | c |
        Severity: Major
        Found in lib/export/flame_stabilizer_2014.rb and 1 other location - About 1 hr to fix
        lib/export/flame_stabilizer.rb on lines 212..235

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

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

            def parse
              
              if @buf.length > MAX_BUFFER_SIZE # Wrong format and the buffer is filled up, bail
                raise WrongInputError, "Atom buffer overflow at #{MAX_BUFFER_SIZE} bytes, this is definitely not a Shake script"
              end
        Severity: Minor
        Found in lib/import/shake_grammar/lexer.rb - About 1 hr to fix

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

            def write_header_with_number_of_trackers(number_of_trackers)
              @writer.stabilizer_file_version "5.0"
              @writer.creation_date(Time.now.strftime(DATETIME_FORMAT))
              @writer.linebreak!(2)
              
          Severity: Major
          Found in lib/export/flame_stabilizer.rb and 1 other location - About 1 hr to fix
          lib/export/flame_stabilizer_2014.rb on lines 130..151

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

          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 write_header_with_number_of_trackers(number_of_trackers)
              @writer.stabilizer_file_version "6.0"
              @writer.creation_date(Time.now.strftime(DATETIME_FORMAT))
              @writer.linebreak!(2)
              
          Severity: Major
          Found in lib/export/flame_stabilizer_2014.rb and 1 other location - About 1 hr to fix
          lib/export/flame_stabilizer.rb on lines 121..142

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

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

            def run_export(tracker_data_io, importer, exporter)
              points, keyframes, percent_complete = 0, 0, 0.0
              last_reported_percentage = 0.0
              
              report_progress(percent_complete, "Starting the parser")
          Severity: Minor
          Found in lib/pipeline/base.rb - About 1 hr to fix

            Method each has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def each
                @io.each do | line |
                  if line =~ /TrackName (.+)/
                    yield(@last_tracker) if @last_tracker && @last_tracker.any?
                    @last_tracker = Tracksperanto::Tracker.new(:name => $1)
            Severity: Minor
            Found in lib/import/shake_text.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

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

              def write_ref_channels(ref_x, ref_y)
                %w( ref/x ref/y).map(&method(:prefix)).zip([ref_x, ref_y]).each do | cname, default |
                  @writer.channel(cname) do | c |
                    c.extrapolation("constant")
                    c.value(default)
            Severity: Major
            Found in lib/export/flame_stabilizer.rb and 1 other location - About 1 hr to fix
            lib/export/flame_stabilizer_2014.rb on lines 202..215

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

            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 write_ref_channels(ref_x, ref_y)
                %w( ref/x ref/y).map(&method(:prefix)).zip([ref_x, ref_y]).each do | cname, default |
                  @writer.channel(cname) do | c |
                    c.extrapolation("constant")
                    c.value(default)
            Severity: Major
            Found in lib/export/flame_stabilizer_2014.rb and 1 other location - About 1 hr to fix
            lib/export/flame_stabilizer.rb on lines 193..206

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

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

              def each
                wrapped_io = Tracksperanto::ExtIO.new(@io)
                detect_columns(wrapped_io)
                trackers = {}
                filtering_trackers_from(wrapped_io) do | name, frame, x, y |
            Severity: Minor
            Found in lib/import/boujou.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 extract_trackers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def extract_trackers(io)
                  while line = io.gets do
                    if line =~ /^(\w+)/ # Tracker name
                      yield(@last_tracker) if @last_tracker && @last_tracker.any?
                      @last_tracker = Tracksperanto::Tracker.new(:name => line.strip)
            Severity: Minor
            Found in lib/import/equalizer3.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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def each
                @io.each_line do | line |
                  name, frame, x, y, frame_status = line.split
                  
                  # Do we already have this tracker?
            Severity: Minor
            Found in lib/import/syntheyes.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 detect_format has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def detect_format(io)
                report_progress("Detecting width and height")
                lines = (0..2).map{ io.gets }
                last_line = lines[-1]
                int_groups = last_line.scan(/(\d+)/).flatten.map{|e| e.to_i }
            Severity: Minor
            Found in lib/import/match_mover.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

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

              def write_track_channels
                ctr_x, ctr_y = @width / 2, @height / 2
                
                # track determines where the tracking box is, and should be in the center
                # of the image for Flame to compute all other shifts properly
            Severity: Minor
            Found in lib/export/flame_stabilizer_2014.rb and 1 other location - About 50 mins to fix
            lib/export/flame_stabilizer.rb on lines 153..162

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

            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