Showing 29 of 33 total issues
Method html_template
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.html_template(until_period, organization_name)
name = organization_name.presence || "our platform"
"
<!DOCTYPE html>
File index.js
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
module.exports = { // eslint-disable-line
"env": {
"browser": true,
"es6": true
},
Class BackupService
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class BackupService
def initialize(options)
@options = default_options.merge(options)
@local_files = []
end
Method update_each_column
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_each_column(record, columns)
columns.each do |column|
current_content = current_content_for(record, column)
next if current_content.blank?
- 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 backup_database
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def backup_database
if can_connect_to_db?
file_path = generate_backup_file_path("db", "dump")
cmd = "pg_dump -Fc"
- 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 execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def execute
directory = service.directories.get(@options[:s3_bucket], prefix: subfolder)
file_list.each do |filename|
md5 = Digest::MD5.file(filename)
- 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
Function overrideSassRule
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const overrideSassRule = (modifyConfig) => {
const sassRule = modifyConfig.module.rules.find(
(rule) => rule.test.toString() === "/\\.(scss|sass)(\\.erb)?$/i"
);
if (!sassRule) {
Method get_redirection_target
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.get_redirection_target(host, limit = 3)
return nil if limit.zero? # Avoid infinite loops
return nil unless host.is_a?(URI) || host.is_a?(String)
url = URI(host)
- 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 organization_settings
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def organization_settings
{
apiVersion: "apps.libre.sh/v1alpha1",
kind: "Decidim",
metadata: {
Method execute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
directory = service.directories.get(@options[:s3_bucket], prefix: subfolder)
file_list.each do |filename|
md5 = Digest::MD5.file(filename)
Method replace_urls
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def replace_urls(doc, tag)
attribute = tag == "img" ? "src" : "href"
doc.css(tag).each do |source|
next unless source[attribute].include?(@deprecated_endpoint)
- 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 apply_configuration
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.apply_configuration
Rack::Attack.throttled_response_retry_after_header = true
Rack::Attack.throttled_responder = lambda do |request|
rack_logger = Logger.new(Rails.root.join("log/rack_attack.log"))
Function overrideSassRule
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const overrideSassRule = (modifyConfig) => {
const sassRule = modifyConfig.module.rules.find(
(rule) => rule.test.toString() === "/\\.(scss|sass)(\\.erb)?$/i"
);
if (!sassRule) {
- 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute
create_backup_dir
if has_enough_disk_space?
create_backup_export
- 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 repair
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def repair(content = @content)
if content.is_a?(Hash)
content.transform_values { |value| repair(value) }
elsif content.is_a?(Array)
content.map { |value| repair(value) }
- 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 apply_configuration
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.apply_configuration
Decidim::Initiatives.configure do |c|
c.creation_enabled = creation_enabled? unless Rails.application.secrets.dig(:decidim, :initiatives, :creation_enabled) == "auto"
c.similarity_threshold = similarity_threshold
c.similarity_limit = similarity_limit
- 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 files_digest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def files_digest(patterns)
patterns.map { |pattern| Dir.glob(pattern) }
.flatten
.sort
.each_with_object({}) do |file, result|
- 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 resource_icon
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resource_icon(resource, options = {})
if resource.instance_of?(Decidim::Initiative)
icon "initiatives", options
elsif resource.instance_of?(Decidim::Comments::Comment)
icon "comment-square", options
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def run
# Find all models that have a column of type string jsonb or text
# For each model, find all records that have a column of type string jsonb or text
# For each record, replace all urls contained in content with the new url
# Save the record
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(resource, field_name, text, target_locale, source_locale)