Showing 27 of 201 total issues
Method paginate
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales)
# By default paginate on all posts in the site
using_posts = all_posts
should_union = config['combine'] == 'union'
- Read upRead up
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 paginate
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales)
# By default paginate on all posts in the site
using_posts = all_posts
should_union = config['combine'] == 'union'
Method generate
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def generate(site)
#begin
# Generate the AutoPages first
PaginateV2::AutoPages.create_autopages(site)
- Read upRead up
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 index_posts_by
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.index_posts_by(all_posts, index_key)
return nil if all_posts.nil?
return all_posts if index_key.nil?
index = {}
all_posts.each do |post|
- Read upRead up
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 ap_index_posts_by
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.ap_index_posts_by(all_posts, index_key)
return nil if all_posts.nil?
return all_posts if index_key.nil?
index = {}
all_posts.each do |post|
- Read upRead up
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 22 (exceeds 5 allowed). Consider refactoring. Open
def initialize(config_per_page, first_index_page_url, paginated_page_url, posts, cur_page_nr, num_pages, default_indexpage, default_ext)
@page = cur_page_nr
@per_page = config_per_page.to_i
@total_pages = num_pages
- Read upRead up
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 generate
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate(site)
#begin
# Generate the AutoPages first
PaginateV2::AutoPages.create_autopages(site)
Method _debug_print_config_info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _debug_print_config_info(config, page_path)
r = 20
f = "Pagination: ".rjust(20)
# Debug print the config
if @debug
- Read upRead up
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 autopages_log
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.autopages_log(config, *config_keys)
enabled, disabled = [], []
config_keys.each do |key|
key_config = config[key] # config for key
next if config.nil? || key_config['silent']
- Read upRead up
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 11 (exceeds 5 allowed). Consider refactoring. Open
def run(default_config, site_pages, site_title)
# By default if pagination is enabled we attempt to find all index.html pages in the site
templates = self.discover_paginate_templates(site_pages)
if( templates.size.to_i <= 0 )
@logging_lambda.call "Is enabled, but I couldn't find any pagination page. Skipping pagination. "+
- Read upRead up
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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(site, base, autopage_config, pagination_config, layout_name, set_autopage_data_lambda, get_autopage_permalink_lambda, get_autopage_title_lambda, display_name)
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(config_per_page, first_index_page_url, paginated_page_url, posts, cur_page_nr, num_pages, default_indexpage, default_ext)
@page = cur_page_nr
@per_page = config_per_page.to_i
@total_pages = num_pages
Method read_config_value_and_filter_posts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.read_config_value_and_filter_posts(config, config_key, posts, source_posts, should_union = false)
return nil if posts.nil?
return nil if source_posts.nil? # If the source is empty then simply don't do anything
return posts if config.nil?
return posts if !config.has_key?(config_key)
- Read upRead up
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 _debug_print_config_info
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _debug_print_config_info(config, page_path)
r = 20
f = "Pagination: ".rjust(20)
# Debug print the config
if @debug
Method initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(site, base, autopage_config, pagination_config, layout_name, set_autopage_data_lambda, get_autopage_permalink_lambda, get_autopage_title_lambda, display_name)
@site = site
@base = base
@name = 'index.html'
Method run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(default_config, site_pages, site_title)
# By default if pagination is enabled we attempt to find all index.html pages in the site
templates = self.discover_paginate_templates(site_pages)
if( templates.size.to_i <= 0 )
@logging_lambda.call "Is enabled, but I couldn't find any pagination page. Skipping pagination. "+
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(config_per_page, first_index_page_url, paginated_page_url, posts, cur_page_nr, num_pages, default_indexpage, default_ext)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(site, base, autopage_config, pagination_config, layout_name, tag, tag_name)
Method paginate
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(site, base, autopage_config, pagination_config, layout_name, collection, collection_name)