rSmart/rsmart_toolbox

View on GitHub

Showing 8 of 30 total issues

Method valid_value has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def self.valid_value(subject, valid_values, opt={})
    raise ArgumentError, "valid_values must not be nil!" if valid_values.nil?
    if valid_values.kind_of? Regexp
      return true if subject =~ valid_values
    end
Severity: Minor
Found in lib/kuali_toolbox/etl.rb - About 2 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 parse_csv_command_line_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.parse_csv_command_line_options(
      executable, args, opt={ csv_options: { headers: :first_row,
                                             header_converters: :symbol,
                                             skip_blanks: true,
                                             col_sep: ",",
Severity: Minor
Found in lib/kuali_toolbox/etl.rb - About 1 hr to fix

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

      def self.validate_hr_xml(xml_filename)
        ret_val = false
        # validate the resulting XML file against the official XSD schema
        uri = URI 'https://raw.githubusercontent.com/KualiCo/ce-tech-docs/master/v2_0/hrmanifest.xsd'
        Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
    Severity: Minor
    Found in lib/kuali_toolbox/etl/grm.rb - About 1 hr to fix

      Method parse_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.parse_string(str, opt={ strict: true, required: false })
          opt[:strict] = true if opt[:strict].nil?
          retval = encode str.to_s.strip
          if opt[:required] && retval.empty?
            raise KualiCo::ETL::error TextParseError.new "Required data element '#{opt[:name]}' not found: '#{str}'"
      Severity: Minor
      Found in lib/kuali_toolbox/etl.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 parse_csv_command_line_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.parse_csv_command_line_options(
            executable, args, opt={ csv_options: { headers: :first_row,
                                                   header_converters: :symbol,
                                                   skip_blanks: true,
                                                   col_sep: ",",
      Severity: Minor
      Found in lib/kuali_toolbox/etl.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 parse_boolean has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.parse_boolean(str, opt={})
          return true  if str == true
          return false if str == false
          b = parse_string str, opt
          return true  if b =~ /^(active|a|true|t|yes|y|1)$/i
      Severity: Minor
      Found in lib/kuali_toolbox/etl.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 opt[:default]
      Severity: Major
      Found in lib/kuali_toolbox/etl.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return nil
        Severity: Major
        Found in lib/kuali_toolbox/etl.rb - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language