guerilla-di/tracksperanto

View on GitHub

Showing 44 of 44 total issues

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

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

  def initialize_importer_with_path_and_options(from_input_file_path, options)
    
    d = Tracksperanto::FormatDetector.new(from_input_file_path)
    
    if options[:importer]
Severity: Minor
Found in lib/pipeline/base.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 each has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def each
    io = Tracksperanto::ExtIO.new(@io)
    extract_width_height_and_aspect(io.gets_non_empty)
    
    while line = io.gets_and_strip
Severity: Minor
Found in lib/import/maya_live.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(options)
      @trackers = []
      point_channels.each do | point_name |
        next unless options[point_name]
        point_channel = options[point_name]
Severity: Minor
Found in lib/import/nuke_script.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

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

  def undisto_interpolated(r)
    left , right = nil, nil
    @lut.each_with_index do | xf, i |
      if xf.m > r
        right = xf
Severity: Minor
Found in lib/tools/lens_disto.rb and 1 other location - About 40 mins to fix
lib/tools/lens_disto.rb on lines 92..98

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 disto_interpolated(r)
    left , right = nil, nil
    @lut.each_with_index do | rf, i |
      if rf.r > r
        right = rf
Severity: Minor
Found in lib/tools/lens_disto.rb and 1 other location - About 40 mins to fix
lib/tools/lens_disto.rb on lines 103..109

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 collect_tracker has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def collect_tracker(name, x_curve, y_curve, corr_curve, *discard)
Severity: Minor
Found in lib/import/shake_script.rb - About 35 mins to fix

    Method lerp has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def lerp(x, left_x, right_x, left_y, right_y)
    Severity: Minor
    Found in lib/tools/lens_disto.rb - About 35 mins to fix

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

          def extract_width_and_height_from_stream(io)
            w, h = nil, nil
            
            w_matcher = /FrameWidth (\d+)/
            h_matcher = /FrameHeight (\d+)/
      Severity: Minor
      Found in lib/import/flame_stabilizer.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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def each(&blk)
          until @io.eof?
            line = @io.gets
            next if (!line || line =~ /^#/)
            
      Severity: Minor
      Found in lib/import/pftrack.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 tag_start has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def tag_start(element_name, attrs)
            @path << element_name.downcase
            
            if element_name.downcase == 'shot'
              @parser.width = attrs["w"]
      Severity: Minor
      Found in lib/import/match_mover_rzml.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 gets_non_empty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def gets_non_empty
          until eof?
            line = gets
            return nil if line.nil?
            s = line.strip
      Severity: Minor
      Found in lib/tracksperanto/ext_io.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 export_point has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def export_point(frame, float_x, float_y, float_residual)
          return super if @y_factor == DEFAULT_FACTOR && @x_factor == DEFAULT_FACTOR
          
          super(frame,
            x_factor < 0 ? (@w + (float_x * x_factor)) : (float_x * x_factor),
      Severity: Minor
      Found in lib/tools/scaler.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 raise_if_format_unsupported has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.raise_if_format_unsupported(judging_from_file_path)
          extension = File.extname(judging_from_file_path).downcase
          formats_and_extensions.each_pair do | matcher, message |
            raise Tracksperanto::UnsupportedFormatError, message if matcher.is_a?(String) && extension == matcher
            raise Tracksperanto::UnsupportedFormatError, message if matcher.is_a?(Regexp) && extension =~ matcher
      Severity: Minor
      Found in lib/tracksperanto/blacklist.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 parse_trackers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_trackers(name, io, &blk)
            first_tracker_line = io.gets.chomp
            
            # We will be reading one line too many possibly, so we need to know
            # where to return to in case we do
      Severity: Minor
      Found in lib/import/pftrack.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 scavenge_trackers_from_channels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def scavenge_trackers_from_channels(channel_map, names)
            # Use Hash#keys.sort because we want a consistent export order
            # irregardless of the Ruby version in use
            # (hash keys are ordered on 1.9 and not ordered on 1.8)
            channel_map.keys.sort.each do |c|
      Severity: Minor
      Found in lib/import/flame_stabilizer.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 deep_include? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def deep_include?(array_or_element, atom_name)
            return false unless array_or_element.is_a?(Array)
            return true if array_or_element[0] == atom_name
            
            array_or_element.each do | elem |
      Severity: Minor
      Found in lib/import/shake_script.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

        def cast_to_int(*attributes)
          attributes.each do | an_attr |
            define_method(an_attr) { instance_variable_get("@#{an_attr}").to_i }
            define_method("#{an_attr}=") { |to| instance_variable_set("@#{an_attr}", to.to_i) }
      Severity: Minor
      Found in lib/tracksperanto/casts.rb and 2 other locations - About 20 mins to fix
      lib/tracksperanto/casts.rb on lines 9..12
      lib/tracksperanto/casts.rb on lines 25..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 28.

      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

        def cast_to_float(*attributes)
          attributes.each do | an_attr |
            define_method(an_attr) { instance_variable_get("@#{an_attr}").to_f }
            define_method("#{an_attr}=") { |to| instance_variable_set("@#{an_attr}", to.to_f) }
      Severity: Minor
      Found in lib/tracksperanto/casts.rb and 2 other locations - About 20 mins to fix
      lib/tracksperanto/casts.rb on lines 17..20
      lib/tracksperanto/casts.rb on lines 25..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 28.

      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

        def cast_to_string(*attributes)
          attributes.each do | an_attr |
            define_method(an_attr) { instance_variable_get("@#{an_attr}").to_s }
            define_method("#{an_attr}=") { |to| instance_variable_set("@#{an_attr}", to.to_s) }
      Severity: Minor
      Found in lib/tracksperanto/casts.rb and 2 other locations - About 20 mins to fix
      lib/tracksperanto/casts.rb on lines 9..12
      lib/tracksperanto/casts.rb on lines 17..20

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

      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