kigster/laser-cutter

View on GitHub

Showing 19 of 25 total issues

Method parse has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.parse(args)
          banner_text = <<-EOF
#{('Laser-Cutter v'+ Laser::Cutter::VERSION).bold}

Usage: laser-cutter [options] -o filename.pdf
Severity: Major
Found in lib/laser-cutter/cli/opt_parser.rb - About 3 hrs to fix

    Method render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def render pdf = nil
        banner = <<-EOF
    
        Made with Laser Cutter Ruby Gem (v#{Laser::Cutter::VERSION})
        Credits to Prawn for ruby PDF generation,
    Severity: Major
    Found in lib/laser-cutter/renderer/meta_renderer.rb - About 2 hrs to fix

      Method validate! has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def validate!
              missing = []
              REQUIRED.each { |k| missing << k if self[k].nil? }
              raise MissingOption.new("#{missing.join(', ')} #{missing.size > 1 ? 'are' : 'is'} required, but missing.") unless missing.empty?
      
      
      Severity: Minor
      Found in lib/laser-cutter/configuration.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 generate_notches has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def generate_notches
              position_faces!
              corner_face = pick_corners_face
              self.notches = []
              faces.each_with_index do |face, face_index|
      Severity: Minor
      Found in lib/laser-cutter/box.rb - About 1 hr to fix

        Method render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def render
                  renderer = self
                  renderers = []
        
                  box_renderer = BoxRenderer.new(config)
        Severity: Minor
        Found in lib/laser-cutter/renderer/layout_renderer.rb - About 1 hr to fix

          Method define_shifts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def define_shifts
                    along_iter = create_iterator_along
                    across_iter = create_iterator_across
          
                    shifts = []
          Severity: Minor
          Found in lib/laser-cutter/notching/path_generator.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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.parse(args)
                    banner_text = <<-EOF
          #{('Laser-Cutter v'+ Laser::Cutter::VERSION).bold}
          
          Usage: laser-cutter [options] -o filename.pdf
          Severity: Minor
          Found in lib/laser-cutter/cli/opt_parser.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 serialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                  def serialize
                    output = if options.write_file.eql?('-')
                               $stdout
                             elsif options.write_file
                               File.open(options.write_file, 'w')
          Severity: Minor
          Found in lib/laser-cutter/cli/serializer.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 change_units has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def change_units(new_units)
                  return if new_units.to_sym == units.to_sym
          
                  return if (units.to_sym.eql?(new_units) || !UNIT_SPECIFIC_DEFAULTS.keys.include?(new_units.to_sym))
          
          
          Severity: Minor
          Found in lib/laser-cutter/configuration.rb - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

                  def corner_box_sides
                    boxes = []
                    extra_lines = []
                    sides = []
          
          
          Severity: Minor
          Found in lib/laser-cutter/notching/path_generator.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 deserialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def deserialize
                    string = if options.read_file.eql?('-')
                               $stdin.read
                             elsif File.exist?(options.read_file)
                               File.read(options.read_file)
          Severity: Minor
          Found in lib/laser-cutter/cli/serializer.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 value_from_units has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def value_from_units value, from_units = nil
              multiplier = if from_units.nil?
                             if units.eql?('in')
                               1.0 / 72.0 # PDF units per inch
                             else
          Severity: Minor
          Found in lib/laser-cutter/page_manager.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 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def initialize(options = {})
                  ::Hashie::Extensions::SymbolizeKeys.symbolize_keys!(options)
          
                  options.delete_if { |k, v| v.nil? }
                  if options[:units] && !UNIT_SPECIFIC_DEFAULTS.keys.include?(options[:units].to_sym)
          Severity: Minor
          Found in lib/laser-cutter/configuration.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 enclosure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def enclosure
                  generate_notches if self.notches.empty?
                  p1 = notches.first.p1.to_a
                  p2 = notches.first.p2.to_a
          
          
          Severity: Minor
          Found in lib/laser-cutter/box.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 generate_notches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def generate_notches
                  position_faces!
                  corner_face = pick_corners_face
                  self.notches = []
                  faces.each_with_index do |face, face_index|
          Severity: Minor
          Found in lib/laser-cutter/box.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def render
                    renderer = self
                    renderers = []
          
                    box_renderer = BoxRenderer.new(config)
          Severity: Minor
          Found in lib/laser-cutter/renderer/layout_renderer.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 deoverlap! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def deoverlap!
                  lines_to_delete = []
                  lines_to_add = []
                  count = lines.size
                  for i in 0..(count - 1) do
          Severity: Minor
          Found in lib/laser-cutter/aggregator.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def initialize(*args)
                    x = args.first
                    coordinates = if x.is_a?(String)
                      parse_string(x)
                    elsif x.is_a?(Hash)
          Severity: Minor
          Found in lib/laser-cutter/geometry/tuple.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 dedup! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def dedup!
                  lines_to_delete = []
                  count = lines.size
                  for i in 0..(count - 1) do
                    for j in (i + 1)..(count - 1) do
          Severity: Minor
          Found in lib/laser-cutter/aggregator.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