metamaps/metamaps

View on GitHub

Showing 183 of 2,044 total issues

Function computePositions has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  computePositions: function() {
    const self = Visualize

    if (self.type === 'RGraph') {
      let i
Severity: Minor
Found in frontend/src/Metamaps/Visualize.js - About 1 hr to fix

Function handle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  handle: function(text, coords = {}) {
    var self = PasteInput

    if (text.match(URL_REGEX)) {
      Import.handleURL(text, coords)
Severity: Minor
Found in frontend/src/Metamaps/PasteInput.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

Method synapses_csv has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
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 - 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 47 lines of code (exceeds 25 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

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

Room.prototype.init = function() {
  var self = this

  $(document).on(VideoView.events.audioControlClick, function(event, videoView) {
    if (!videoView.audioStatus) self.webrtc.mute()
Severity: Minor
Found in frontend/src/Metamaps/Views/Room.js - About 1 hr to fix

Function renderEdgeArrows has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderEdgeArrows: function(edgeHelper, adj, synapse, canvas) {
    const self = JIT

    const directionCat = synapse.get('category')
    const direction = synapse.getDirection()
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function synapseAdded has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  synapseAdded: event => {
    // we receive contentless models from the server
    // containing only the information we need to determine whether the active mapper
    // can view this synapse and the two topics it connects,
    // then if we determine it can, we make a call for the full model
Severity: Minor
Found in frontend/src/Metamaps/Cable.js - About 1 hr to fix

Method maps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

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

    if term.present? && term.downcase[0..5] != 'topic:' &&
Severity: Minor
Found in app/controllers/search_controller.rb - 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 launch has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  launch: function(id) {
    const self = Map
    var dataIsReadySetupMap = function() {
      Map.setAccessRequest()
      Visualize.type = 'ForceDirected'
Severity: Minor
Found in frontend/src/Metamaps/Map/index.js - About 1 hr to fix

Function renderSynapse has 42 lines of code (exceeds 25 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 1 hr to fix

Method decorate has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def decorate(notification, receipt)
      result = {
        id: notification.id,
        type: notification.notification_code,
        subject: notification.subject,
Severity: Minor
Found in app/decorators/notification_decorator.rb - About 1 hr to fix

Function convertModelsToJIT has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  convertModelsToJIT: function(topics, synapses) {
    const jitReady = []

    const synapsesToRemove = []
    let mapping
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function positionVideos has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  positionVideos: function() {
    var self = Realtime
    var videoIds = Object.keys(self.room.videos)
    // var numOfVideos = videoIds.length
    // var numOfVideosToPosition = _.filter(videoIds, function(id) {
Severity: Minor
Found in frontend/src/Metamaps/Realtime/index.js - About 1 hr to fix

Function render has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        'render': function(node, canvas) {
          const pos = node.pos.getc(true)
          const dim = node.getData('dim')
          const topic = node.getData('topic')
          const metacode = topic ? topic.getMetacode() : false
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function addTypeahead has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addTypeahead: function() {
    var self = InfoBox

    if (!Active.Map) return

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

Function topicAdded has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  topicAdded: event => {
    const m = Active.Mapper
    // we receive a contentless model from the server
    // containing only the information we need to determine whether the active mapper
    // can view this topic, then if we determine it can, we make a call for the full model
Severity: Minor
Found in frontend/src/Metamaps/Cable.js - About 1 hr to fix

Function handleUpdate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  handleUpdate: function(location) {
    const self = ReactApp
    const pathname = this.state.location.pathname
    switch (pathname.split('/')[1]) {
      case '':
Severity: Minor
Found in frontend/src/Metamaps/GlobalUI/ReactApp.js - About 1 hr to fix

Function onClick has a Cognitive Complexity of 13 (exceeds 5 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

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 topicDragged has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const topicDragged = self => positions => {
  var topic
  var node

  if (Active.Map) {
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

Method embed_dat has a Cognitive Complexity of 13 (exceeds 5 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

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

Severity
Category
Status
Source
Language