metamaps/metamaps

View on GitHub

Showing 183 of 2,044 total issues

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

    init: function() {
      $('#topic_name').keyup(function(e) {
        const ESC = 27

        if (e.keyCode === ESC) {
Severity: Major
Found in frontend/src/Metamaps/Create.js - About 2 hrs to fix

ChatView has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

const ChatView = {
  isOpen: false,
  unreadMessages: 0,
  messages: new Backbone.Collection(),
  conversationLive: false,
Severity: Minor
Found in frontend/src/Metamaps/Views/ChatView.js - About 2 hrs to fix

Function onDragEndTopicHandler has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  onDragEndTopicHandler: function(node, eventInfo, e) {
    const self = JIT
    const midpoint = {}
    let pixelPos
    let mapping
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 2 hrs 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 edgeRender has a Cognitive Complexity of 18 (exceeds 5 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)

Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 2 hrs 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 reducer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const reducer = (state = { connectedPeople: {}, liveMaps: {} }, action) => {
  const { type, payload } = action
  const { connectedPeople, liveMaps } = state
  const map = payload && liveMaps[payload.mapid]
  const mapWillEmpty = map && Object.keys(map).length === 1
Severity: Minor
Found in realtime/reducer.js - About 2 hrs 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 onDragEndTopicHandler has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  onDragEndTopicHandler: function(node, eventInfo, e) {
    const self = JIT
    const midpoint = {}
    let pixelPos
    let mapping
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 2 hrs to fix

Function updateMetacodeSet has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateMetacodeSet: function(set, index, custom) {
    if (custom && Create.newSelectedMetacodes.length === 0) {
      window.alert('Please select at least one metacode to use!')
      return false
    }
Severity: Major
Found in frontend/src/Metamaps/Create.js - About 2 hrs to fix

Control has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

const Control = {
  selectNode: function(node, e) {
    var filtered = node.getData('alpha') === 0

    if (filtered || Selected.Nodes.indexOf(node) !== -1) return
Severity: Minor
Found in frontend/src/Metamaps/Control.js - About 2 hrs to fix

Function makeRoutes has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function makeRoutes (currentUser) {
  const homeComponent = currentUser && currentUser.id ? Maps : nullComponent
  return <Route path="/" component={App} >
    <IndexRoute component={homeComponent} />
    <Route path="explore">
Severity: Major
Found in frontend/src/routes/makeRoutes.js - About 2 hrs to fix

Function updateAll has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        this.updateAll = function()
        {                                            
            var    minScale = options.minScale;    // This is the smallest scale applied to the furthest item.
            var smallRange = (1-minScale) * 0.5;
            var    w,h,x,y,scale,item,sinVal;
Severity: Major
Found in app/assets/javascripts/cloudcarousel-secret.js - About 2 hrs to fix

Class MapPolicy has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class MapPolicy < ApplicationPolicy
  class Scope < Scope
    def resolve
      visible = %w[public commons]
      return scope.where(permission: visible) unless user
Severity: Minor
Found in app/policies/map_policy.rb - About 2 hrs to fix

Function attachEventListeners has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  attachEventListeners: function() {
    var self = InfoBox
    $('.mapInfoBox').click(function(event) {
      event.stopPropagation()
    })
Severity: Major
Found in frontend/src/Metamaps/Map/InfoBox.js - About 2 hrs to fix

Function fetchSiblings has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  fetchSiblings: function(nodes, metacodeId) {
    var self = this

    var node = Array.isArray(nodes) ? nodes[0] : nodes

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

File ReactApp.js has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $ */

import React from 'react'
import ReactDOM from 'react-dom'
import { Router, browserHistory } from 'react-router'
Severity: Minor
Found in frontend/src/Metamaps/GlobalUI/ReactApp.js - About 2 hrs to fix

Function renderSynapse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  renderSynapse: function(mapping, synapse, node1, node2, createNewInDB) {
    var edgeOnViz

    var newedge = synapse.createEdge(mapping)

Severity: Minor
Found in frontend/src/Metamaps/Synapse.js - About 2 hrs 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 selectNodeOnClickHandler has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  selectNodeOnClickHandler: function(node, e) {
    if (Visualize.mGraph.busy) return

    const self = JIT

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

Function updateFilters has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateFilters: function(collection, propertyToCheck, correlatedModel, filtersToUse, listToModify) {
    var self = Filter
    var newList = []
    var removed = []
    var added = []
Severity: Major
Found in frontend/src/Metamaps/Filter.js - About 2 hrs to fix

Method topics has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    if term.present? && term.downcase[0..3] != 'map:' &&
Severity: Major
Found in app/controllers/search_controller.rb - About 2 hrs to fix

Function add_direction_form has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  add_direction_form: function(synapse) {
    // directionality checkboxes
    $('#editSynLowerBar').append('<div id="edit_synapse_left"></div>')
    $('#editSynLowerBar').append('<div id="edit_synapse_right"></div>')

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

Function exports has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(io, store) {
  io.on('connection', function(socket) {
    // this will ping everyone on a map that there's a person just joined the map
    socket.on(JOIN_MAP, function(data) {
      socket.mapid = data.mapid
Severity: Minor
Found in realtime/map.js - About 1 hr to fix
Severity
Category
Status
Source
Language