ddfreyne/nanoc

View on GitHub

Showing 91 of 91 total issues

Method inspect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def inspect
      ''.tap do |s|
        s << 'Props('
        s << (raw_content? ? 'r' : '_')
        s << (attributes? ? 'a' : '_')
Severity: Minor
Found in lib/nanoc/base/entities/props.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 all_files_in has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def all_files_in(dir_name, extra_files, recursion_limit = 10)
      all_files_and_dirs_in(dir_name, extra_files).map do |fn|
        case File.ftype(fn)
        when 'link'
          if recursion_limit.zero?
Severity: Minor
Found in lib/nanoc/data_sources/filesystem/tools.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 load has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def load(site, action_provider: nil)
      rule_memory_store = Nanoc::Int::RuleMemoryStore.new(site: site)

      dependency_store =
        Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a, site: site)
Severity: Minor
Found in lib/nanoc/base/services/compiler_loader.rb - About 1 hr to fix

    Method run has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run
          unless File.exist?(source_path)
            raise Errors::OutputDirDoesNotExist.new(source_path)
          end
    
    
    Severity: Minor
    Found in lib/nanoc/deploying/deployers/git.rb - About 1 hr to fix

      Method behavior_for has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def behavior_for(obj)
              case obj
              when String, Symbol, Numeric
                RawUpdateBehavior
              when Pathname
      Severity: Minor
      Found in lib/nanoc/base/services/checksummer.rb - About 1 hr to fix

        Method start has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def start
                Nanoc::Int::NotificationCenter.on(:filtering_started) do |rep, filter_name|
                  @times_per_rep[rep] ||= {}
                  @times_per_rep[rep][filter_name] ||= {}
        
        
        Severity: Minor
        Found in lib/nanoc/cli/commands/compile.rb - About 1 hr to fix

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

              def remove_empty_directories(present_dirs)
                present_dirs.reverse_each do |dir|
                  next if Dir.foreach(dir) { |n| break true if n !~ /\A\.\.?\z/ }
                  next if exclude?(dir)
                  delete_dir(dir)
          Severity: Minor
          Found in lib/nanoc/base/services/pruner.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 read has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def read(filename)
                # Read
                begin
                  data = File.read(filename)
                rescue => e
          Severity: Minor
          Found in lib/nanoc/data_sources/filesystem.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 resolution_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def resolution_for(error)
                error = unwrap_error(error)
          
                case error
                when LoadError
          Severity: Minor
          Found in lib/nanoc/cli/error_handler.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 start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                def start
                  Nanoc::Int::NotificationCenter.on(:filtering_started) do |rep, filter_name|
                    @times_per_rep[rep] ||= {}
                    @times_per_rep[rep][filter_name] ||= {}
          
          
          Severity: Minor
          Found in lib/nanoc/cli/commands/compile.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 memoize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def memoize(method_name)
                original_method_name = '__nonmemoized_' + method_name.to_s
                alias_method original_method_name, method_name
          
                define_method(method_name) do |*args|
          Severity: Minor
          Found in lib/nanoc/base/memoization.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 content_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def content_for(*args, &block)
                if block_given? # Set content
                  name = args[0]
                  params =
                    case args.size
          Severity: Minor
          Found in lib/nanoc/helpers/capturing.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 render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def render(identifier, other_assigns = {}, &block)
                # Find layout
                layout_view = @layouts[identifier]
                layout_view ||= @layouts[identifier.__nanoc_cleaned_identifier]
                raise Nanoc::Int::Errors::UnknownLayout.new(identifier) if layout_view.nil?
          Severity: Minor
          Found in lib/nanoc/helpers/rendering.rb - About 1 hr to fix

            Method run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def run(content, params = {})
                  if ::Redcarpet::VERSION > '2'
                    options          = params.fetch(:options,          {})
                    renderer_class   = params.fetch(:renderer,         ::Redcarpet::Render::HTML)
                    renderer_options = params.fetch(:renderer_options, {})
            Severity: Minor
            Found in lib/nanoc/filters/redcarpet.rb - About 1 hr to fix

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

                  def run
                    load_adsf
                    require 'rack'
              
                    load_site
              Severity: Minor
              Found in lib/nanoc/cli/commands/view.rb - About 1 hr to fix

                Method files_and_dirs_in has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def files_and_dirs_in(dir)
                      present_files = []
                      present_dirs = []
                
                      Find.find(dir) do |f|
                Severity: Minor
                Found in lib/nanoc/base/services/pruner.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 routing_rules_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def routing_rules_for(rep)
                      rules = {}
                      @item_routing_rules.each do |rule|
                        next unless rule.applicable_to?(rep.item)
                        next if rule.rep_name != rep.name
                Severity: Minor
                Found in lib/nanoc/rule_dsl/rules_collection.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 run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def run
                      # Extract arguments
                      if arguments.length != 1
                        raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
                      end
                Severity: Minor
                Found in lib/nanoc/cli/commands/create-site.rb - About 1 hr to fix

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

                        def start
                          Nanoc::Int::NotificationCenter.on(:compilation_started, self) do |rep|
                            @start_times[rep] = Time.now
                            @acc_durations[rep] ||= 0.0
                          end
                  Severity: Minor
                  Found in lib/nanoc/cli/commands/compile.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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def render(identifier, other_assigns = {}, &block)
                        # Find layout
                        layout_view = @layouts[identifier]
                        layout_view ||= @layouts[identifier.__nanoc_cleaned_identifier]
                        raise Nanoc::Int::Errors::UnknownLayout.new(identifier) if layout_view.nil?
                  Severity: Minor
                  Found in lib/nanoc/helpers/rendering.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

                  Severity
                  Category
                  Status
                  Source
                  Language