metamaps/metamaps

View on GitHub

Showing 309 of 2,044 total issues

File JIT.js has 1330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $, Image */

import _ from 'lodash'
import clipboard from 'clipboard-js'

Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 3 days to fix

Assignment Branch Condition size for summarize_data is too high. [127/16]
Open

  def self.summarize_data(map, user, until_moment = DateTime.current)
    results = {
      stats: {}
    }

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 has too many lines. [171/100]
Open

class MapsController < ApplicationController
  before_action :require_user, only: %i[create update destroy events follow unfollow]
  before_action :set_map, only: %i[show conversation update destroy
                                   contains events export
                                   follow unfollow unfollow_from_email]
Severity: Minor
Found in app/controllers/maps_controller.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [164/100]
Open

    class RestfulController < ActionController::Base
      include Pundit
      include PunditExtra

      snorlax_used_rest!

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [159/100]
Open

class TopicsController < ApplicationController
  include TopicsHelper

  before_action :require_user, only: %i[create update destroy follow unfollow]
  before_action :set_topic, only: %i[show update relative_numbers

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [142/100]
Open

class Topic < ApplicationRecord
  ATTRS_TO_WATCH = %w[name desc link metacode_id permission defer_to_map_id].freeze
  include TopicsHelper
  include Attachable

Severity: Minor
Found in app/models/topic.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [137/100]
Open

class User < ApplicationRecord
  acts_as_messageable # mailboxer notifications

  has_many :topics
  has_many :synapses
Severity: Minor
Found in app/models/user.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [82/10]
Open

  def self.summarize_data(map, user, until_moment = DateTime.current)
    results = {
      stats: {}
    }

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.

Class has too many lines. [129/100]
Open

class Map < ApplicationRecord
  ATTRS_TO_WATCH = %w[name desc permission].freeze

  belongs_to :user
  belongs_to :source, class_name: :Map
Severity: Minor
Found in app/models/map.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [125/100]
Open

class SearchController < ApplicationController
  include TopicsHelper
  include MapsHelper
  include UsersHelper
  include SynapsesHelper

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Function onDragMoveTopicHandler has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  onDragMoveTopicHandler: function(node, eventInfo, e) {
    var self = JIT

    var authorized = Active.Map && Active.Map.authorizeToEdit(Active.Mapper)

Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 day to fix

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 Controller has 199 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Controller = function(container, images, options)
    {                        
        var    items = [], funcSin = Math.sin, funcCos = Math.cos, ctx=this;
        this.controlTimer = 0;
        this.stopped = false;
Severity: Major
Found in app/assets/javascripts/cloudcarousel-secret.js - About 7 hrs to fix

Assignment Branch Condition size for topics is too high. [67.39/16]
Open

  def topics
    term = params[:term]
    user = params[:user] ? params[:user] : false

    if term.present? && term.downcase[0..3] != 'map:' &&

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

Assignment Branch Condition size for embed_dat is too high. [64.66/16]
Open

      def self.embed_dat
        embeddable.each_pair do |key, opts|
          is_plural = key.to_s.pluralize == key.to_s
          id_key = key.to_s.singularize + (is_plural ? '_ids' : '_id')
          serializer = opts.delete(:serializer) || "Api::V2::#{key.to_s.singularize.camelize}Serializer".constantize

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

Assignment Branch Condition size for update is too high. [63.7/16]
Open

  def update
    @user = User.find(current_user.id)

    if user_params[:password] == '' && user_params[:password_confirmation] == ''
      # not trying to change the password
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

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

Assignment Branch Condition size for relatives is too high. [59.92/16]
Open

  def relatives
    topics_already_has = params[:network] ? params[:network].split(',').map(&:to_i) : []

    alltopics = policy_scope(Topic.relatives(@topic.id, current_user)).to_a
    if params[:metacode].present?

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. [51/10]
Open

  def topics
    term = params[:term]
    user = params[:user] ? params[:user] : false

    if term.present? && term.downcase[0..3] != 'map:' &&

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 onDragMoveTopicHandler has 153 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  onDragMoveTopicHandler: function(node, eventInfo, e) {
    var self = JIT

    var authorized = Active.Map && Active.Map.authorizeToEdit(Active.Mapper)

Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 6 hrs to fix

Assignment Branch Condition size for synapses_csv is too high. [52.62/16]
Open

  def synapses_csv(output_format = 'array')
    output = []
    synapses.each do |synapse|
      if synapse.category == 'from-to'
        if synapse.topic1_id == id
Severity: Minor
Found in app/models/topic.rb by rubocop

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

File index.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $ */

import SimpleWebRTC from 'simplewebrtc'
import SocketIoConnection from 'simplewebrtc/socketioconnection'

Severity: Minor
Found in frontend/src/Metamaps/Realtime/index.js - About 5 hrs to fix
Severity
Category
Status
Source
Language