Showing 95 of 134 total issues
Function CatarseAnalytics
has a Cognitive Complexity of 159 (exceeds 5 allowed). Consider refactoring. Open
window.CatarseAnalytics = window.CatarseAnalytics || (function(){
/*!
* cookie-monster - a simple cookie library
* v0.3.0
* https://github.com/jgallen23/cookie-monster
- 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 common_wrapper.rb
has 709 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CommonWrapper
attr_accessor :api_key
def services_endpoint
@services_endpoint ||= {
Function CatarseAnalytics
has 284 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.CatarseAnalytics = window.CatarseAnalytics || (function(){
/*!
* cookie-monster - a simple cookie library
* v0.3.0
* https://github.com/jgallen23/cookie-monster
File project.rb
has 556 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
include I18n::Alchemy
PUBLISHED_STATES = %w[online waiting_funds successful failed].freeze
HEADLINE_MAXLENGTH = 100
NAME_MAXLENGTH = 50
Class Project
has 63 methods (exceeds 20 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
include I18n::Alchemy
PUBLISHED_STATES = %w[online waiting_funds successful failed].freeze
HEADLINE_MAXLENGTH = 100
NAME_MAXLENGTH = 50
Class User
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
include I18n::Alchemy
acts_as_token_authenticatable
include User::OmniauthHandler
include Shared::CommonWrapper
File user.rb
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
include I18n::Alchemy
acts_as_token_authenticatable
include User::OmniauthHandler
include Shared::CommonWrapper
Class ProjectsController
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class ProjectsController < ApplicationController
after_filter :verify_authorized, except: %i[show index video video_embed embed embed_panel about_mobile]
after_filter :redirect_user_back_after_login, only: %i[index show]
before_action :authorize_and_build_resources, only: %i[edit]
Class CommonWrapper
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class CommonWrapper
attr_accessor :api_key
def services_endpoint
@services_endpoint ||= {
Class Contribution
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Contribution < ActiveRecord::Base
has_notifications
include I18n::Alchemy
include PgSearch
File analytics.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
//evitamos criar duas vezes...
//tem q ser não dependente de outros codigos
window.CatarseAnalytics = window.CatarseAnalytics || (function(){
/*!
* cookie-monster - a simple cookie library
Method index_contribution
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def index_contribution(resource)
return unless resource.id.present?
unless resource.project.common_id.present?
resource.project.index_on_common
resource.project.reload
- 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 UsersController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class UsersController < ApplicationController
after_filter :verify_authorized, except: %i[reactivate]
after_filter :redirect_user_back_after_login, only: %i[show]
inherit_resources
defaults finder: :find_active!
Function _event
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _event(eventObj, fn, ignoreGA) {
if (eventObj) {
try {
var project = eventObj.project||_getProject(),
user = eventObj.user||_getUser();
File projects_controller.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
class InvalidProject < StandardError; end
class SuccessfulProject < StandardError; end
class ProjectsController < ApplicationController
after_filter :verify_authorized, except: %i[show index video video_embed embed embed_panel about_mobile]
after_filter :redirect_user_back_after_login, only: %i[index show]
Method to_csv
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.to_csv
attributes = [
'Nome completo',
'Nome público',
'CPF',
Class ApplicationController
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
include Concerns::ExceptionHandler
include Concerns::SocialHelpersHandler
include Concerns::AnalyticsHelpersHandler
Method update
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def update
authorize resource
# need to check this before setting new attributes
should_validate = should_use_validate
- 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 setup_machine
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.setup_machine
state :draft, initial: true
state :rejected
state :online
state :successful
Function video
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
RedactorPlugins.video = function()
{
return {
reUrlYoutube: /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig,
reUrlVimeo: /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,