Showing 309 of 2,044 total issues
Function edgeRender
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
edgeRender: function(adj, canvas) {
// get nodes cartesian coordinates
const pos = adj.nodeFrom.pos.getc(true)
const posChild = adj.nodeTo.pos.getc(true)
- Create a ticketCreate a ticket
File cloudcarousel-secret.js
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
//////////////////////////////////////////////////////////////////////////////////
// CloudCarousel V1.0.5
// (c) 2011 by R Cecco. <http://www.professorcloud.com>
// MIT License
//
- Create a ticketCreate a ticket
Method has too many lines. [23/10] Open
def synapses_csv(output_format = 'array')
output = []
synapses.each do |synapse|
if synapse.category == 'from-to'
if synapse.topic1_id == id
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Function init
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function() {
var synapseBloodhound = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
- Create a ticketCreate a ticket
Function exports
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(io, stunservers, state) {
io.on('connection', function(socket) {
socket.resources = {
screen: false,
video: true,
- Create a ticketCreate a ticket
Assignment Branch Condition size for autocomplete_topic is too high. [28.23/16] Open
def autocomplete_topic
term = params[:term]
if term.present?
topics = policy_scope(Topic)
.where('LOWER("name") like ?', term.downcase + '%')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Class RestfulController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class RestfulController < ActionController::Base
include Pundit
include PunditExtra
snorlax_used_rest!
- Create a ticketCreate a ticket
Perceived complexity for topics is too high. [18/7] Open
def topics
term = params[:term]
user = params[:user] ? params[:user] : false
if term.present? && term.downcase[0..3] != 'map:' &&
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method has too many lines. [21/10] Open
def user_metacodes
@m = current_user.settings.metacodes
set = metacodeset
@metacodes = if set && set == 'Most'
Metacode.where(id: current_user.most_used_metacodes).to_a
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for mappers is too high. [27.15/16] Open
def mappers
term = params[:term]
if term.present? && term.downcase[0..3] != 'map:' &&
term.downcase[0..5] != 'topic:' && !term.casecmp('mapper:').zero?
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [21/10] Open
def create
@user = current_user
@metacode_set = MetacodeSet.new(metacode_set_params)
@metacode_set.user_id = @user.id
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [21/10] Open
def update
@metacode_set = MetacodeSet.find(params[:id])
respond_to do |format|
if @metacode_set.update_attributes(metacode_set_params)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Function init
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
init: function(serverData) {
var self = DataModel
// workaround circular import problem
if (!self.MapCollection.model) self.MapCollection.model = Map
- Read upRead up
- Create a ticketCreate a ticket
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 21 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = User.find(current_user.id)
if user_params[:password] == '' && user_params[:password_confirmation] == ''
# not trying to change the password
- Read upRead up
- Create a ticketCreate a ticket
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 summarize_data
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def self.summarize_data(map, user, until_moment = DateTime.current)
results = {
stats: {}
}
- Read upRead up
- Create a ticketCreate a ticket
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 getMapCanvasForScreenshots
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
getMapCanvasForScreenshots: () => {
var canvas = {}
canvas.canvas = document.createElement('canvas')
canvas.canvas.width = 1880 // 960
- Create a ticketCreate a ticket
Method has too many lines. [20/10] Open
def autocomplete_array_json(topics)
topics.map do |t|
is_map = t.is_a?(Map)
metamap_metacode = Metacode.find_by(name: 'Metamap')
{
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [20/10] Open
def mail_for_notification(notification)
case notification.notification_code
when MAP_ACCESS_REQUEST
request = notification.notified_object
MapMailer.access_request(request)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Function zoomExtents
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
zoomExtents: function(event, canvas, denySelected) {
JIT.centerMap(canvas)
let height = canvas.getSize().height
let width = canvas.getSize().width
let maxX
- Create a ticketCreate a ticket
Method has too many lines. [19/10] Open
def synapses
term = params[:term]
topic1id = params[:topic1id]
topic2id = params[:topic2id]
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.