dilcom/gnuplotrb

View on GitHub

Showing 9 of 13 total issues

Method plot has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def plot(term = nil, multiplot_part: false, **options)
      fail ArgumentError, 'Empty plots are not supported!' if @datasets.empty?
      inner_opts = if multiplot_part
                     @options.merge(options).reject { |key, _| [:term, :output].include?(key) }
                   else
Severity: Minor
Found in lib/gnuplotrb/plot.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 plot has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def plot(term = nil, multiplot_part: false, **options)
      plot_options = mix_options(options) do |plot_opts, mp_opts|
        plot_opts.merge(multiplot: mp_opts.to_h)
      end
      terminal = term || (plot_options[:output] ? Terminal.new : own_terminal)
Severity: Minor
Found in lib/gnuplotrb/multiplot.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 provide_with_datetime_format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def provide_with_datetime_format(data, using)
      return unless defined?(Daru)
      return unless data.is_a?(Daru::DataFrame) || data.is_a?(Daru::Vector)
      return unless data.index.first.is_a?(DateTime)
      return if using[0..1] != '1:'
Severity: Minor
Found in lib/gnuplotrb/plot.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 gnuplot_fit has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def gnuplot_fit(function, data, options, initials, term_options)
Severity: Minor
Found in lib/gnuplotrb/fit.rb - About 35 mins to fix

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

        def handle_stderr(stream)
          @err_array = []
          # synchronize access to @err_array
          @semaphore = Mutex.new
          Thread.new do
    Severity: Minor
    Found in lib/gnuplotrb/mixins/error_handling.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 to_gnuplot_points has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_gnuplot_points
            result = ''
            each_with_index do |value, index|
              quoted = (index.is_a?(String) || index.is_a?(Symbol)) && index.length > 0
              result += quoted ? "\"#{index}\" " : "#{index} "
    Severity: Minor
    Found in lib/gnuplotrb/external_classes/daru.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(data = nil, **options)
          if data && @type == :datablock
            new_datablock = @data.update(data)
            if new_datablock == @data
              update_options(options)
    Severity: Minor
    Found in lib/gnuplotrb/staff/dataset.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 dataset_from_any has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def dataset_from_any(source)
          ds = case source
               # when initialized with dataframe (it passes here several vectors)
               when (defined?(Daru) ? Daru::Vector : nil)
                 Dataset.new(source)
    Severity: Minor
    Found in lib/gnuplotrb/plot.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 to_gnuplot_points has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_gnuplot_points
            result = ''
            each_row_with_index do |row, index|
              quoted = (index.is_a?(String) || index.is_a?(Symbol)) && index.length > 0
              result += quoted ? "\"#{index}\" " : "#{index} "
    Severity: Minor
    Found in lib/gnuplotrb/external_classes/daru.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