af83/edwig-admin

View on GitHub

Showing 4 of 4 total issues

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

  def pageheader pageicon, pagetitle, desc = nil, meta = nil, mainaction = nil, &block

    firstRow = content_tag :div, '', class: 'row' do
      # Left part with pageicon & pagetitle & desc
      left = content_tag :div, '', class: 'col-lg-9 col-md-8 col-sm-7 col-xs-7' do
Severity: Minor
Found in app/helpers/application_helper.rb - About 1 hr to fix

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

        def execute
          if body && !body.try(:acts_like_string?)
            self.body = body.to_json
          end
    
    
    Severity: Minor
    Found in lib/edwig/request.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 pageheader has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def pageheader pageicon, pagetitle, desc = nil, meta = nil, mainaction = nil, &block
    Severity: Minor
    Found in app/helpers/application_helper.rb - About 45 mins to fix

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

          def valid?
            errors[:slug] = ["only accept alphanumeric characters"] unless slug.blank? || slug =~ /\A[a-zA-Z_0-9-]+\Z/
            errors[:model_reload_at] = ["must use HH:MM format"] unless model_reload_at =~ /\A[0-9]{2}:[0-9]{2}\Z/
            errors[:token_list] = ["can't be empty (via edwig admin)"] if token_list.blank?
            super
      Severity: Minor
      Found in lib/edwig/referential.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