ddfreyne/nanoc

View on GitHub

Showing 91 of 91 total issues

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

    def rouge(code, language, params = {})
      require 'rouge'

      if Rouge.version < '2' || params.fetch(:legacy, false)
        # Rouge 1.x or Rouge 2.x legacy options
Severity: Minor
Found in lib/nanoc/filters/colorize_syntax.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 __nanoc_symbolize_keys_recursively has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def __nanoc_symbolize_keys_recursively
    hash = {}
    each_pair do |key, value|
      new_key   = key.respond_to?(:to_sym) ? key.to_sym : key
      new_value = value.respond_to?(:__nanoc_symbolize_keys_recursively) ? value.__nanoc_symbolize_keys_recursively : value
Severity: Minor
Found in lib/nanoc/base/core_ext/hash.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 compiled_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def compiled_content(snapshot: nil)
      snapshot_contents = @context.compilation_context.compiled_content_cache[unwrap]

      snapshot_name = snapshot || (snapshot_contents[:pre] ? :pre : :last)

Severity: Minor
Found in lib/nanoc/base/views/post_compile_item_rep_view.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 value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def value
      if @value.key?(:raw)
        value = @value.delete(:raw)
        @value[:final] = value.respond_to?(:call) ? value.call : value
        @value.__nanoc_freeze_recursively if frozen?
Severity: Minor
Found in lib/nanoc/base/entities/lazy_value.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      validate_options_and_arguments
      load_site(preprocess: true)

      runner = Nanoc::Checking::Runner.new(site)
Severity: Minor
Found in lib/nanoc/cli/commands/check.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 filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def filter(filter_name, filter_args = {})
        filter = filter_for_filtering(@rep, filter_name)

        begin
          Nanoc::Int::NotificationCenter.post(:filtering_started, @rep, filter_name)
Severity: Minor
Found in lib/nanoc/base/services/executor.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 outdated_due_to_dependencies? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def outdated_due_to_dependencies?(obj, processed = Hamster::Set.new)
      # Convert from rep to item if necessary
      obj = obj.item if obj.is_a?(Nanoc::Int::ItemRep)

      # Get from cache
Severity: Minor
Found in lib/nanoc/base/services/outdatedness_checker.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      # Check arguments
      if arguments.any?
        raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
      end
Severity: Minor
Found in lib/nanoc/cli/commands/show-plugins.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 load_dsl_if_available has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load_dsl_if_available
      @dsl_loaded ||= false
      unless @dsl_loaded
        @dsl =
          if dsl_present?
Severity: Minor
Found in lib/nanoc/checking/runner.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 simon_highlight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def simon_highlight(code, language, params = {})
      check_availability('highlight', '--version')

      cmd = ['highlight', '--syntax', language, '--fragment']
      params.each do |key, _value|
Severity: Minor
Found in lib/nanoc/filters/colorize_syntax.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load
      return unless File.file?(filename)

      begin
        pstore.transaction do
Severity: Minor
Found in lib/nanoc/base/repos/store.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