metamaps/metamaps

View on GitHub

Showing 309 of 2,044 total issues

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

    def decorate(notification, receipt)
      result = {
        id: notification.id,
        type: notification.notification_code,
        subject: notification.subject,

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

  startTypeahead: function() {
    var self = Search

    var mapheader = Active.Mapper ? '<div class="searchMapsHeader searchHeader"><h3 class="search-heading">Maps</h3><input type="checkbox" class="limitToMe" id="limitMapsToMe"></input><label for="limitMapsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div></div>' : '<div class="searchMapsHeader searchHeader"><h3 class="search-heading">Maps</h3><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div></div>'
    var topicheader = Active.Mapper ? '<div class="searchTopicsHeader searchHeader"><h3 class="search-heading">Topics</h3><input type="checkbox" class="limitToMe" id="limitTopicsToMe"></input><label for="limitTopicsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div></div>' : '<div class="searchTopicsHeader searchHeader"><h3 class="search-heading">Topics</h3><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div></div>'
Severity: Major
Found in frontend/src/Metamaps/GlobalUI/Search.js - About 5 hrs to fix

File Import.js has 380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $ */

import parse from 'csv-parse'
import _ from 'lodash'

Severity: Minor
Found in frontend/src/Metamaps/Import.js - About 5 hrs to fix

Method has too many lines. [39/10]
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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

File Control.js has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'lodash'
import outdent from 'outdent'

import Active from './Active'
import DataModel from './DataModel'
Severity: Minor
Found in frontend/src/Metamaps/Control.js - About 4 hrs to fix

Assignment Branch Condition size for before_destroyed is too high. [43.21/16]
Open

  def before_destroyed
    if mappable.defer_to_map
      mappable.permission = mappable.defer_to_map.permission
      mappable.defer_to_map_id = nil
      mappable.save
Severity: Minor
Found in app/models/mapping.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

Function init has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  init: function() {
    var self = this
    $(document).on('keydown', function(e) {
      if (!(Active.Map || Active.Topic)) return

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

File Create.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $, Hogan, Bloodhound */

import DataModel from './DataModel'
import Map from './Map'
import Mouse from './Mouse'
Severity: Minor
Found in frontend/src/Metamaps/Create.js - About 4 hrs to fix

Assignment Branch Condition size for user_metacodes is too high. [41.96/16]
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
Severity: Minor
Found in app/helpers/metacodes_helper.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 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $ */

import outdent from 'outdent'
import { find as _find } from 'lodash'
import { browserHistory } from 'react-router'
Severity: Minor
Found in frontend/src/Metamaps/Map/index.js - About 4 hrs to fix

Assignment Branch Condition size for after_created is too high. [40.1/16]
Open

  def after_created
    if mappable_type == 'Topic'
      ActionCable.server.broadcast 'map_' + map.id.to_s, type: 'topicAdded', topic: mappable.filtered, mapping_id: id
      meta = { 'x': xloc, 'y': yloc, 'mapping_id': id }
      Events::TopicAddedToMap.publish!(mappable, map, user, meta)
Severity: Minor
Found in app/models/mapping.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 Topic.js has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $ */

import $jit from '../patched/JIT'

import Active from './Active'
Severity: Minor
Found in frontend/src/Metamaps/Topic.js - About 4 hrs to fix

Function parseTabbedString has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseTabbedString: function(text) {
    var self = Import

    // determine line ending and split lines
    var delim = '\n'
Severity: Major
Found in frontend/src/Metamaps/Import.js - About 4 hrs to fix

Assignment Branch Condition size for maps is too high. [39.92/16]
Open

  def maps
    term = params[:term]
    user = params[:user] ? params[:user] : nil

    if term.present? && term.downcase[0..5] != 'topic:' &&

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

Function selectWithBox has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  selectWithBox: function(e) {
    const self = this
    let sX = Mouse.boxStartCoordinates.x
    let sY = Mouse.boxStartCoordinates.y
    let eX = Mouse.boxEndCoordinates.x
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 4 hrs to fix

Assignment Branch Condition size for pagination_link_headers! is too high. [38.08/16]
Open

      def pagination_link_headers!(data)
        base_url = request.base_url + request.path
        old_query = request.query_parameters
        nxt = old_query.merge(page: data[:next_page]).map { |x| x.join('=') }.join('&')
        prev = old_query.merge(page: data[:prev_page]).map { |x| x.join('=') }.join('&')

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

JIT has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

const JIT = {
  tempInit: false,
  tempNode: null,
  tempNode2: null,
  mouseDownPix: {},
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 4 hrs to fix

Function renderTopic has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderTopic: function(mapping, topic, createNewInDB, permitCreateSynapseAfter, opts = {}) {
    var nodeOnViz, tempPos

    var newnode = topic.createNode()

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

Method has too many lines. [31/10]
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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Consider simplifying this complex logical expression.
Open

      if ((sX < x && x < eX && sY < y && y < eY) ||
        (sX > x && x > eX && sY > y && y > eY) ||
        (sX > x && x > eX && sY < y && y < eY) ||
        (sX < x && x < eX && sY > y && y > eY)) {
        if (e.shiftKey) {
Severity: Critical
Found in frontend/src/Metamaps/JIT.js - About 4 hrs to fix
Severity
Category
Status
Source
Language