Showing 143 of 1,085 total issues
File stats_spec.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe Budget::Stats do
let(:budget) { create(:budget, :finished) }
let(:stats) { Budget::Stats.new(budget) }
Class BudgetInvestmentsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Admin::BudgetInvestmentsController < Admin::BaseController
include FeatureFlags
include CommentableActions
include Translatable
File dashboard_graphs.js
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
//= require d3
//= require c3
//= require c3ext
(function() {
Function editorConfig
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
CKEDITOR.editorConfig = function( config )
{
config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
- 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_modules
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initialize_modules = function() {
"use strict";
App.Options.initialize();
App.Questions.initialize();
File setting_spec.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe Setting do
before do
Setting["official_level_1_name"] = "Stormtrooper"
File budget_investments_spec.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rails_helper"
describe "Tags" do
let(:author) { create(:user, :level_two, username: "Isabel") }
let(:budget) { create(:budget, name: "Big Budget") }
Function initializeDirectUploadInput
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeDirectUploadInput: function(input) {
var inputData;
inputData = this.buildData([], input);
$(input).fileupload({
paramName: "attachment",
Function initializeDirectUploadInput
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeDirectUploadInput: function(input) {
var inputData;
inputData = this.buildData([], input);
$(input).fileupload({
paramName: "attachment",
Method initialize
has 43 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? }
Method run
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
begin
export_proposals_to_json
export_budget_investments_to_json
export_comments_to_json
Function initialize
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function() {
$(".markdown-editor").each(function() {
var editor, md;
md = window.markdownit({
html: true,
Function initialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function() {
var current_user_id;
$("body").on("renderLegislationAnnotation", App.LegislationAnnotatable.renderAnnotationComments);
$("body").on("click", "[data-annotation-id]", App.LegislationAnnotatable.onClick);
$("body").on("click", "[data-cancel-annotation]", function(e) {
Function initialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function() {
if ($(".sdg-related-list-selector").length) {
var amsify_suggestags = new AmsifySuggestags($(".sdg-related-list-selector .input"));
amsify_suggestags.getItem = function(value) {
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 scoped_filter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.scoped_filter(params, current_filter)
budget = Budget.find_by_slug_or_id params[:budget_id]
results = Investment.by_budget(budget)
if params[:min_total_supports].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
Method description_from
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def description_from(script_filename)
description = ""
delimiter = '"""'
break_line = "<br>"
comment_found = false
- 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 show
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def show
# In the default implementation, this already confirms the resource:
# self.resource = self.resource = resource_class.confirm_by_token(params[:confirmation_token])
self.resource = resource_class.find_by!(confirmation_token: params[:confirmation_token])
- 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 settings
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def settings
%w[
official_level_1_name
official_level_2_name
official_level_3_name
Function initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function() {
$("[data-js-suggest-result]").each(function() {
var $this, callback, timer;
$this = $(this);
callback = function() {