Showing 1,031 of 1,643 total issues
Method products
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
def self.products(consumer, csv)
default_product_category = consumer.environment.product_categories.find_by slug: "software-livre"
detection = CharlockHolmes::EncodingDetector.detect csv
csv = CharlockHolmes::Converter.convert csv, detection[:encoding], "UTF-8"
- 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 matchRecursive
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
XRegExp.matchRecursive = function (str, left, right, flags, options) {
var options = options || {},
escapeChar = options.escapeChar,
vN = options.valueNames,
flags = flags || "",
- 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 socialshareprivacy.js
has 639 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @license
* jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
*
* http://www.heise.de/extras/socialshareprivacy/
Function setOptions
has 258 lines of code (exceeds 25 allowed). Consider refactoring. Open
setOptions: function(options, callback) {
this.startDate = moment().startOf('day');
this.endDate = moment().endOf('day');
this.timeZone = moment().utcOffset();
Method head_ending
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def head_ending
plugin = self
lambda do
variable = plugin.class.controllers.send controller.controller_path rescue nil
variable ||= plugin.class.controllers.send :profile if controller.is_a? ProfileController
- 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 cms_controller.rb
has 568 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CmsController < MyProfileController
protect "edit_profile", :profile, only: [:set_home_page]
include ArticleHelper
include CategoriesHelper
Function ajax
has 240 lines of code (exceeds 25 allowed). Consider refactoring. Open
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
File class.tree.php
has 560 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class _tree_struct {
// Structure table and fields
protected $table = "";
protected $fields = array(
File person.rb
has 557 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Person < Profile
attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone,
:comercial_phone, :jabber_id, :personal_website, :nationality, :schooling,
:schooling_status, :formation, :custom_formation, :area_of_study,
:custom_area_of_study, :professional_activity, :organization_website,
Method article_actions
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def article_actions
actions = [following_button(@page, user)]
if @page.allow_edit?(user) && !remove_content_button(:edit, @page)
content = font_awesome(:edit, label_for_edit_article(@page))
- 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
has 209 lines of code (exceeds 25 allowed). Consider refactoring. Open
__init : function () {
this.data.dnd = {
active : false,
after : false,
inside : false,
Class ProfileController
has 58 methods (exceeds 20 allowed). Consider refactoring. Open
class ProfileController < PublicController
needs_profile
before_action :check_access_to_profile, except: [:join, :join_not_logged, :index, :add]
before_action :store_location, only: [:join, :join_not_logged, :report_abuse, :send_mail]
before_action :login_required, only: [:add, :join, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail, :follow, :unfollow]
Method included
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def self.included(base)
base.class_eval do
before_create do |ra|
if ra.resource.kind_of?(Profile)
profile = ra.resource
- 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 date_field
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def date_field(name, value, datepicker_options = {}, html_options = {})
datepicker_options[:disabled] ||= false
datepicker_options[:alt_field] ||= ""
datepicker_options[:alt_format] ||= ""
datepicker_options[:append_text] ||= ""
- 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 helpers.rb
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "base64"
require "tempfile"
require "recaptcha"
module Api
File profile_controller.rb
has 477 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ProfileController < PublicController
needs_profile
before_action :check_access_to_profile, except: [:join, :join_not_logged, :index, :add]
before_action :store_location, only: [:join, :join_not_logged, :report_abuse, :send_mail]
before_action :login_required, only: [:add, :join, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail, :follow, :unfollow]
Method map_facet_results
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def map_facet_results(facet, facet_params, facets_data, unfiltered_facets_data = {}, options = {})
raise "Use map_facets_for before this method" if facet[:solr_field].nil?
facets_data = {} if facets_data.blank? # could be empty array
solr_facet = to_solr_fields_names[facet[:solr_field]]
- 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
Class User
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord
include Noosfero::Plugin::HotSpot
include MetadataScopes
include Notifiable
Method quantity_price_data
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def quantity_price_data(actor_name)
data = { flags: {} }
statuses = ::OrdersPlugin::Order::Statuses
statuses_data = data[:statuses] = {}
- 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 renderCalendar
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCalendar: function (calendar, selected, minDate, maxDate, side) {
var html = '<div class="calendar-date">';
html += '<table class="table-condensed">';
html += '<thead>';