sugarcrm/sugar_utils

View on GitHub

Showing 5 of 7 total issues

Method read has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def self.read(filename, options = {}) # rubocop:disable MethodLength, AbcSize, CyclomaticComplexity, PerceivedComplexity
      options[:value_on_missing] ||= ''
      options[:raise_on_missing] = true if options[:raise_on_missing].nil?

      result =
Severity: Minor
Found in lib/sugar_utils/file.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 read has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.read(filename, options = {}) # rubocop:disable MethodLength, AbcSize, CyclomaticComplexity, PerceivedComplexity
      options[:value_on_missing] ||= ''
      options[:raise_on_missing] = true if options[:raise_on_missing].nil?

      result =
Severity: Minor
Found in lib/sugar_utils/file.rb - About 1 hr to fix

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

        def self.write(filename, data, options = {}) # rubocop:disable MethodLength, AbcSize, CyclomaticComplexity
          flush = options[:flush] || false
          owner = options[:owner]
          group = options[:group]
          # NOTE: We are using the variable name 'perm' because that is the name of
    Severity: Minor
    Found in lib/sugar_utils/file.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 append has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.append(filename, data, options = {}) # rubocop:disable MethodLength, AbcSize, CyclomaticComplexity
          flush = options[:flush] || false
          owner = options[:owner]
          group = options[:group]
          # NOTE: We are using the variable name 'perm' because that is the name of
    Severity: Minor
    Found in lib/sugar_utils/file.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 deprecate_option has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.deprecate_option(_method, option_name, option_repl, year, month) # rubocop:disable MethodLength
    Severity: Minor
    Found in lib/sugar_utils/file.rb - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language