alain-andre/alain-andre-fr

View on GitHub

Showing 67 of 109 total issues

Method pygments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def pygments(code, lang)
    if defined?(PYGMENTS_CACHE_DIR)
      path = File.join(PYGMENTS_CACHE_DIR, "#{lang}-#{Digest::MD5.hexdigest(code)}.html")
      if File.exist?(path)
        highlighted_code = File.read(path)
Severity: Minor
Found in plugins/pygments_code.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

Avoid deeply nested control flow statements.
Open

            elsif t == '"'
              # Special case: single-character " token
              if prev_token_last_char =~ /\S/
                t = "”"
              else
Severity: Major
Found in plugins/rubypants.rb - About 45 mins to fix

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

        def initialize(config, page, all_posts, index_dir, pagination_dir, num_pages = nil)
    Severity: Minor
    Found in plugins/pagination.rb - About 45 mins to fix

      Method render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def render(context)
            file_dir = (context.registers[:site].source || 'source')
            file_path = Pathname.new(file_dir).expand_path
            file = file_path + @file
      
      
      Severity: Minor
      Found in plugins/render_partial.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(title, url, date, categories, body)
      Severity: Minor
      Found in plugins/octopress_lunr_theme.rb - About 35 mins to fix

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

            def initialize(title, url, date, categories, body)
        Severity: Minor
        Found in .themes/octopress-lunr-theme/plugins/octopress_lunr_theme.rb - About 35 mins to fix

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

              def initialize(tag_name, markup, tokens)
                @title = nil
                @caption = nil
                @filetype = nil
                @highlight = true
          Severity: Minor
          Found in plugins/code_block.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