Showing 143 of 1,085 total issues
Function onClick
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
onClick: function(event) {
var annotation_id, annotation_url, parents, parents_ids, target;
event.preventDefault();
event.stopPropagation();
if (App.LegislationAnnotatable.isMobile()) {
Function customShow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
customShow: function(position) {
var annotation_url;
$(this.element).html("");
// Clean comments section and open it
$("#comments-box").html("");
Method import_ml_proposals_tags
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import_ml_proposals_tags
ids = {}
json_file = data_folder.join(MachineLearning.proposals_tags_filename)
json_data = JSON.parse(File.read(json_file)).each(&:deep_symbolize_keys!)
json_data.each do |attributes|
- 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
begin
export_proposals_to_json
export_budget_investments_to_json
export_comments_to_json
- 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
if !@process.allegations_phase.open? || @draft_version.final_version?
render(json: {}, status: :not_found) && return
end
- 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 check_image
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_image
return unless image.attached?
unless image.analyzed?
attachment_changes["image"].upload
- 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 import_ml_investments_tags
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import_ml_investments_tags
ids = {}
json_file = data_folder.join(MachineLearning.investments_tags_filename)
json_data = JSON.parse(File.read(json_file)).each(&:deep_symbolize_keys!)
json_data.each do |attributes|
- 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 update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
self.resource = resource_class.find_by(confirmation_token: params[:confirmation_token])
if resource.encrypted_password.blank?
resource.assign_attributes(resource_params)
- 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 admin_links
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def admin_links
[
(admin_link if user.administrator?),
(moderation_link if user.administrator? || user.moderator?),
(valuation_link if feature?(:budgets) && (user.administrator? || user.valuator?)),
- 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 init_autocomplete
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
init_autocomplete: function() {
$(".tag-autocomplete").autocomplete({
source: function(request, response) {
$.ajax({
url: $(".tag-autocomplete").data("js-url"),
Method allowed_params
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def allowed_params
[
:start_date,
:end_date,
:debate_start_date,
Function scrollToAnchor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollToAnchor: function() {
return {
annotationsLoaded: function() {
var anchor, ann_id, checkExist;
anchor = $(location).attr("hash");
Method update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.update(contents, enabled_translations = Setting.enabled_locales)
contents.each do |content|
values = content[:values].slice(*translation_params(enabled_translations))
unless values.empty?
- 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 disabled_commentables
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def disabled_commentables
[
("Debate" unless feature?(:debates)),
("Budget::Investment" unless feature?(:budgets)),
(["Legislation::Question",
- 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 validate_image_dimensions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_image_dimensions
if accepted_content_types.include?(attachment_content_type)
return true if imageable_class == Widget::Card
unless attachment.analyzed?
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
if user # logged-in users
merge Abilities::Valuator.new(user) if user.valuator?
if user.administrator?
- 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 list_items
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list_items
present_links.map do |text, url, current_or_options = false, options = {}|
if current_or_options.is_a?(Hash)
current = false
link_options = current_or_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 advanced_filters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.advanced_filters(params, results)
results = results.without_admin if params[:advanced_filters].include?("without_admin")
results = results.without_valuator if params[:advanced_filters].include?("without_valuator")
results = results.under_valuation if params[:advanced_filters].include?("under_valuation")
results = results.valuation_finished if params[:advanced_filters].include?("valuation_finished")
- 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 initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function() {
var anchor, elem, ul;
elem = $("[data-tree-navigator]");
if (elem.length === 0) {
return;
Method included
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
base.extend(ClassMethods)
class_eval do
def hide
return false if hidden?