rs-pro/rails_admin_settings

View on GitHub

Showing 25 of 25 total issues

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

      def add_yaml_validator(base)
        base.validate if: :yaml_kind? do
          require_safe_yaml do
            unless raw.blank?
              begin
Severity: Minor
Found in lib/rails_admin_settings/validation.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 apply_defaults! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_defaults!(file, verbose = false)
      if File.file?(file)
        puts "[settings] Loading from #{file}" if verbose
        if defined?(Psych) && Psych.respond_to?(:safe_load)
          yaml = Psych.safe_load(File.read(file))
Severity: Minor
Found in lib/rails_admin_settings.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 ns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def ns(name, options = {})
      options.symbolize_keys!
      if name.nil? || name == @@ns_default
        name = @@ns_default.to_s
      else
Severity: Minor
Found in lib/rails_admin_settings/settings.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 change has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def change
    create_table :rails_admin_settings do |t|
      t.boolean :enabled, default: true
      t.string :kind, null: false, default: 'string'
      t.string :ns, default: 'main'
Severity: Minor
Found in lib/generators/rails_admin_settings/templates/migration.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 add_json_validator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_json_validator(base)
        base.validate if: :json_kind? do
          unless raw.blank?
            begin
              JSON.load(raw)
Severity: Minor
Found in lib/rails_admin_settings/validation.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