Showing 33 of 69 total issues
Consider simplifying this complex logical expression. Open
window.addEventListener("click",function(t){if("click->menu#open"!=t.target.getAttribute("data-action")){const e=document.querySelector("#cart_col.quickview"),c=document.querySelector("#filters_col.quickview"),mm=document.querySelector("#menu_col.quickview");null==mm||mm.contains(t.target)||mm.classList.remove("is-active"),null==e||e.contains(t.target)||e.classList.remove("is-active"),null==c||c.contains(t.target)||c.classList.remove("is-active")}t.stopPropagation()});
Function send
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
send(message, level = 'success', force = false, timeout = 2000, toast = true) {
var options;
options = {
toast: level === 'error' ? false : toast,
icon: level,
- 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 users
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def users
@filters = filter_params
selected = {}
selected[:city] = @filters[:city] if @filters[:city].present?
selected[:postazione] = @filters[:postazione] if @filters[:postazione].present?
- 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 send
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
send(message, level = 'success', force = false, timeout = 2000, toast = true) {
var options;
options = {
toast: level === 'error' ? false : toast,
icon: level,
- 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 send
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
send(message, level = 'success', force = false, timeout = 2000, toast = true) {
var options;
options = {
toast: level === 'error' ? false : toast,
icon: level,
- 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
Avoid deeply nested control flow statements. Open
if (option.indexOf("||") >= 0) {
option_splitted = option.split("||");
opt.value = option_splitted[0];
opt.text = option_splitted[1];
} else {
Avoid deeply nested control flow statements. Open
if (icon) {
icon.classList.add('fa-circle-plus');
icon.classList.remove('fa-circle-minus');
}
Method perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform(*)
url = Rails.application.credentials.api[:url] || Settings.api.url.to_s
json_parsed = JSON.parse(URI.open(
URI.parse(url),
- 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
Avoid deeply nested control flow statements. Open
if (icon) {
icon.classList.add('fa-circle-minus');
icon.classList.remove('fa-circle-plus');
}
Avoid deeply nested control flow statements. Open
if (target.dataset.fieldValue === "") {
opt.selected = true;
}
Avoid deeply nested control flow statements. Open
if (option === target.dataset.fieldValue) {
opt.selected = true;
}
Method reserve
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reserve
@template = params[:template].presence || 'user'
@event.user = @user
old_status = @event.status(@user)
@result = @event.update_status! if current_user.secretary? || (current_user == @user && @event.status(@user) == 'proposed')
- 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 users
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def users
@text = ['label ilike ?', "%#{filter_params[:text]}%"] if filter_params[:text].present?
search = {}
search[:city] = filter_params[:city] if filter_params[:city].present?
search[:categories] = { id: filter_params[:category] } if filter_params[:category].present?
- 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"