Showing 14 of 14 total issues

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

        def indexer(variable)
          # An index accessor to directly access the configuration file. It should be noted that `['source']` and
          # `#source_path` and other similar pairs will have different values. `['source']` is the raw value from the
          # configuration file while the latter is a path on the system, potentially altered by the path from the current
          # working directory to the configuration file and other factors. The accessor functions such as `#source_path`
Severity: Minor
Found in lib/usmu/helpers/indexer.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 metadata has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def metadata(file)
      last_folder = file.rindex('/')
      base_meta = last_folder ? metadata(file[0..(last_folder - 1)]) : {}

      metafile = if File.directory?(File.join(@base, file))
Severity: Minor
Found in lib/usmu/metadata_service.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(configuration, name, metadata, type = nil, content = nil)
        super(configuration, name, metadata, type, content)

        if type.nil?
          type = name.split('.').last
Severity: Minor
Found in lib/usmu/template/layout.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(configuration, name, metadata, type = nil, content = nil)
Severity: Minor
Found in lib/usmu/template/page.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(configuration, name, metadata = {}, type = nil, content = nil)
Severity: Minor
Found in lib/usmu/template/generated_file.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(configuration, name, metadata, type = nil, content = nil)
Severity: Minor
Found in lib/usmu/template/static_file.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(configuration, name, metadata, type = nil, content = nil)
Severity: Minor
Found in lib/usmu/template/layout.rb - About 35 mins to fix

Method search_layout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.search_layout(configuration, name)
        if name === 'none' || name.nil?
          return nil
        elsif name.class.name == 'String'
          layouts_path = configuration.layouts_path
Severity: Minor
Found in lib/usmu/template/layout.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 initialize_logging has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize_logging(args)
        i = 0
        while i < args.length
          case args[i]
            when '-v', '--verbose'
Severity: Minor
Found in lib/usmu/ui/console.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 find_include has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.find_include(configuration, name)
        if name === 'none'
          nil
        elsif name.class.name == 'String'
          Dir["#{configuration.includes_path}/#{name}.*"].each do |f|
Severity: Minor
Found in lib/usmu/template/include.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 date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def date
        date = self['date']
        if date.is_a? Time
          return date
        end
Severity: Minor
Found in lib/usmu/template/page.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def render(variables = {})
        content = render_content(variables)
        has_cr = content.index("\r")
        content += (has_cr ? "\r\n" : "\n") if content[-1] != "\n"

Severity: Minor
Found in lib/usmu/template/layout.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def call(env)
        generator = @configuration.generator

        path = env['PATH_INFO'][1...env['PATH_INFO'].length]
        @log.info "Received a request for: #{path}"
Severity: Minor
Found in lib/usmu/ui/rack_server.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_template_defaults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_template_defaults(overrides, engine)
        case engine
          when 'redcarpet'
            if overrides.delete :pygments
              begin
Severity: Minor
Found in lib/usmu/template/layout.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