metamaps/metamaps

View on GitHub

Showing 183 of 2,044 total issues

Function mapperLeftCall has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const mapperLeftCall = self => id => {
  var mapper = self.mappersOnMap[id]
  if (mapper) {
    if (self.inConversation) {
      var username = mapper.name
Severity: Minor
Found in frontend/src/Metamaps/Realtime/receivable.js - About 1 hr 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 arrange has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  arrange: function(layout, centerNode) {
    // first option for layout to implement is 'grid', will do an evenly spaced grid with its center at the 0,0 origin
    if (layout === 'grid') {
      const numNodes = _.size(Visualize.mGraph.graph.nodes) // this will always be an integer, the # of nodes on your graph visualization
      const numColumns = Math.floor(Math.sqrt(numNodes)) // the number of columns to make an even grid
Severity: Minor
Found in frontend/src/Metamaps/Organize.js - About 1 hr 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 handleURL has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  handleURL: function(url, opts = {}) {
    let coords = opts.coords
    if (!coords || coords.x === undefined || coords.y === undefined) {
      coords = AutoLayout.getNextCoord({ mappings: DataModel.Mappings })
    }
Severity: Minor
Found in frontend/src/Metamaps/Import.js - About 1 hr 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 updateFromPath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  updateFromPath: function(path) {
    const self = ExploreMaps
    const [_unused, generalSection, specificSection, id] = path.split('/')

    if (generalSection === 'explore') {
Severity: Minor
Found in frontend/src/Metamaps/Views/ExploreMaps.js - About 1 hr 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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(io, stunservers, state) {
  io.on('connection', function(socket) {
    socket.resources = {
      screen: false,
      video: true,
Severity: Minor
Found in realtime/signal.js - About 1 hr 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 add_drop_down has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  add_drop_down: function(edge, synapse) {
    var list, i, synapses, l, desc

    synapses = edge.getData('synapses')
    l = synapses.length
Severity: Minor
Found in frontend/src/Metamaps/SynapseCard.js - About 1 hr to fix

Function initSearchOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initSearchOptions: function() {
    var self = Search

    function toggleResultSet(set) {
      var s = $('.tt-dataset-' + set + ' .tt-suggestion, .tt-dataset-' + set + ' .resultnoresult')
Severity: Minor
Found in frontend/src/Metamaps/GlobalUI/Search.js - About 1 hr to fix

Function handleCSV has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  handleCSV: function(text, parserOpts = {}) {
    const self = Import

    const topicsRegex = /("?Topics"?[, \t"]*)([\s\S]*)/mi
    const synapsesRegex = /("?Synapses"?[, \t"]*)([\s\S]*)/mi
Severity: Minor
Found in frontend/src/Metamaps/Import.js - About 1 hr to fix

Method embed_dat has 31 lines of code (exceeds 25 allowed). Consider refactoring.
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
Severity: Minor
Found in app/serializers/api/v2/application_serializer.rb - About 1 hr to fix

Function updateSelectedPermissions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateSelectedPermissions: function(permission) {
    var edge, synapse, node, topic

    GlobalUI.notifyUser('Working...')

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

Function renderMidArrow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderMidArrow: function(from, to, dim, swap, canvas, placement, newSynapse) {
    const ctx = canvas.getCtx()
    // invert edge direction
    if (swap) {
      const tmp = from
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function onClick has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        onClick: function(node, eventInfo, e) {
          // remove the rightclickmenu
          ContextMenu.reset(ReactApp.render)

          if (Mouse.boxStartCoordinates) {
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function importSynapses has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  importSynapses: function(parsedSynapses) {
    var self = Import

    parsedSynapses.forEach(function(synapse) {
      // only createSynapseWithParameters once both topics are persisted
Severity: Minor
Found in frontend/src/Metamaps/Import.js - About 1 hr to fix

Function selectEdgeOnClickHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  selectEdgeOnClickHandler: function(adj, e) {
    if (Visualize.mGraph.busy) return

    const self = JIT
    var synapseText = adj.data.$synapses[0].attributes.desc
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function zoomToBox has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  zoomToBox: function(event) {
    const sX = Mouse.boxStartCoordinates.x
    const sY = Mouse.boxStartCoordinates.y
    const eX = Mouse.boxEndCoordinates.x
    const eY = Mouse.boxEndCoordinates.y
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function VideoView has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var VideoView = function(video, $parent, id, isMyself, config) {
  var self = this

  this.$parent = $parent // mapView

Severity: Minor
Found in frontend/src/Metamaps/Views/VideoView.js - About 1 hr to fix

Function launch has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  launch: function(id) {
    var dataIsReadySetupTopic = function() {
      Visualize.type = 'RGraph'
      JIT.prepareVizData()
      Selected.reset()
Severity: Minor
Found in frontend/src/Metamaps/Topic.js - About 1 hr to fix

Function createTopicWithParameters has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

  createTopicWithParameters: function(name, metacodeName, permission, desc,
    link, xloc, yloc, importId, opts = {}) {
Severity: Major
Found in frontend/src/Metamaps/Import.js - About 1 hr to fix

Function updateTopicPositions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateTopicPositions: function(node, pos) {
    const len = Selected.Nodes.length
    // this is used to send nodes that are moving to
    // other realtime collaborators on the same map
    const positionsToSend = {}
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function showCard has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  showCard: function(edge, e) {
    var self = SynapseCard

    // reset so we don't interfere with other edges, but first, save its x and y
    var myX = $('#edit_synapse').css('left')
Severity: Minor
Found in frontend/src/Metamaps/SynapseCard.js - About 1 hr to fix
Severity
Category
Status
Source
Language