razor-x/palimpsest

View on GitHub

Showing 9 of 9 total issues

Method validate_config has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_config
      message = 'bad path in config'

      # Checks the option in the asset key.
      def validate_asset_options(opts)
Severity: Minor
Found in lib/palimpsest/environment.rb - About 1 day 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 assets has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def assets
      return @assets if @assets

      @assets = []

Severity: Minor
Found in lib/palimpsest/environment.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 populate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def populate(from: :auto)
      return if populated
      fail "Cannot populate without 'site'" if site.nil?

      case from
Severity: Minor
Found in lib/palimpsest/environment.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 validate_config has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def validate_config
      message = 'bad path in config'

      # Checks the option in the asset key.
      def validate_asset_options(opts)
Severity: Minor
Found in lib/palimpsest/environment.rb - About 2 hrs to fix

    Method externals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def externals
          return @externals if @externals
          return [] if config[:externals].nil?
          return [] if config[:externals][:repositories].nil?
    
    
    Severity: Minor
    Found in lib/palimpsest/environment.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 write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def write(target, gzip: options[:gzip], hash: options[:hash])
          asset = assets[target]
    
          return if asset.nil?
    
    
    Severity: Minor
    Found in lib/palimpsest/assets.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 config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def config(settings = {})
          settings = ActiveSupport::HashWithIndifferentAccess.new settings
    
          if @config.nil?
            populate unless populated
    Severity: Minor
    Found in lib/palimpsest/environment.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 sources_with_assets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def sources_with_assets
          return [] if config[:assets].nil?
          return [] if config[:assets][:sources].nil?
    
          @sources_with_assets = []
    Severity: Minor
    Found in lib/palimpsest/environment.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 update_source! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_source!(source)
          # e.g. /\[%\s+javascript\s+((\S+)\s?(\S+))\s+%\]/
          regex = /
            #{Regexp.escape options[:src_pre]}
            \s+#{type.to_s.singularize}
    Severity: Minor
    Found in lib/palimpsest/assets.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

    Severity
    Category
    Status
    Source
    Language