Showing 106 of 4,066 total issues
File budget_investments_spec.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
feature 'Tags' do
let(:author) { create(:user, :level_two, username: 'Isabel') }
File proposal_notifications_spec.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
feature 'Proposal Notifications' do
xscenario "Send a notification" do
File proposal_notifications_spec.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
feature 'Proposal Notifications' do
xscenario "Send a notification" do
Class ProposalsController
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ProposalsController < ApplicationController
include FeatureFlags
include CommentableActions
include FlagActions
File activity_spec.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
feature 'Admin activity' do
background do
Class Debate
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Debate < ActiveRecord::Base
include Rails.application.routes.url_helpers
include Flaggable
include Taggable
include Conflictable
Function editorConfig
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
CKEDITOR.editorConfig = function( config )
{
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
- 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
File draft_versions_spec.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
feature 'Legislation Draft Versions' do
let(:user) { create(:user) }
let(:administrator) do
Method initialize
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
merge Abilities::Common.new(user)
can [:search, :index], ::User
Method initialize
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
merge Abilities::Common.new(user)
can :read, Organization
can(:verify, Organization){ |o| !o.verified? }
Function initialize_modules
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initialize_modules = function() {
App.Comments.initialize();
App.Users.initialize();
App.Votes.initialize();
App.AllowParticipation.initialize();
Method import
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import(sp)
budget = Budget.last || Budget.create!(name: Date.current.year.to_s, currency_symbol: "€")
group = nil
heading = nil
Method calculate_user_status
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def calculate_user_status(authorable = nil)
user_status = "user"
if user_signed_in?
user_status += ":signed"
- 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 register_vote
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def register_vote(user, vote_value)
if votable_by?(user)
previous_vote_value = ::CastToBoolean.call(user.voted_as_when_voted_for(self))
current_vote_value = ::CastToBoolean.call(vote_value)
if previous_vote_value == current_vote_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 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 has_orders
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def has_orders(valid_orders, *args)
before_action(*args) do |c|
@valid_orders = valid_orders.respond_to?(:call) ? valid_orders.call(c) : valid_orders.dup
@valid_orders.delete('relevance') if params[:search].blank?
@current_order = @valid_orders.include?(params[:order]) ? params[:order] : @valid_orders.first
- 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 scoped_filter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.scoped_filter(params, current_filter)
budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
results = Investment.by_budget(budget)
results = results.where("cached_votes_up + physical_votes >= ?",
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def update
content_params.each do |content|
values = content[:values].slice(*translation_params)
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 sign_in_with
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sign_in_with(feature, provider)
raise ActionController::RoutingError.new('Not Found') unless Setting["feature.#{feature}"]
auth = env["omniauth.auth"]
- 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"