metamaps/metamaps

View on GitHub

Showing 309 of 2,044 total issues

Function renderMidArrow has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  renderMidArrow: function(from, to, dim, swap, canvas, placement, newSynapse) {
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 50 mins to fix

Avoid deeply nested control flow statements.
Open

        if (n.id === 1) {
          lowX = n.getPos().x
          lowY = n.getPos().y
          highX = n.getPos().x
          highY = n.getPos().y
Severity: Major
Found in frontend/src/Metamaps/Organize.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if (n.getPos().y > highY) highY = n.getPos().y
Severity: Major
Found in frontend/src/Metamaps/Organize.js - About 45 mins to fix

Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    if (this.props.authorizedToEdit) {
      return (
        <span className="title">
          <RIETextArea value={this.props.name}
Severity: Minor
Found in frontend/src/components/TopicCard/Title.js - About 45 mins 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 startTypeahead has a Cognitive Complexity of 8 (exceeds 5 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: Minor
Found in frontend/src/Metamaps/GlobalUI/Search.js - About 45 mins 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

Avoid deeply nested control flow statements.
Open

              if (!node.selected) {
                Util.openLink(DataModel.Topics.get(node.id).attributes.link)
              }
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 45 mins to fix

Function add_perms_form has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  add_perms_form: function(synapse) {
    // permissions - if owner, also allow permission editing
    $('#editSynLowerBar').append('<div class="mapPerm ' + synapse.get('permission').substring(0, 2) + '"></div>')

    // ability to change permission
Severity: Minor
Found in frontend/src/Metamaps/SynapseCard.js - About 45 mins 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 selectNeighbors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  selectNeighbors: function() {
    if (Selected.Nodes.length > 0) {
      //For each selected node, select all connected node and the synapses too
      Selected.Nodes.forEach((item) => {
        if (Visualize.mGraph.graph.getNode(item.id).adjacencies) {
Severity: Minor
Found in frontend/src/Metamaps/Control.js - About 45 mins 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 canvasClickHandler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  canvasClickHandler: function(canvasLoc, e) {
    // grab the location and timestamp of the click
    const storedTime = Mouse.lastCanvasClick
    const now = Date.now() // not compatible with IE8 FYI
    Mouse.lastCanvasClick = now
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 45 mins 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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  load: function() {
    var self = InfoBox

    var map = Active.Map

Severity: Minor
Found in frontend/src/Metamaps/Map/InfoBox.js - About 45 mins 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

Avoid deeply nested control flow statements.
Open

        if (n.getPos().x > highX) highX = n.getPos().x
Severity: Major
Found in frontend/src/Metamaps/Organize.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (l > 0) {
            for (let i = l - 1; i >= 0; i -= 1) {
              const n = Selected.Nodes[i]
              Mouse.synapseStartCoordinates.push({
                x: n.pos.getc().x,
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 45 mins to fix

Function zoomExtents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  zoomExtents: function(event, canvas, denySelected) {
    JIT.centerMap(canvas)
    let height = canvas.getSize().height
    let width = canvas.getSize().width
    let maxX
Severity: Minor
Found in frontend/src/Metamaps/JIT.js - About 45 mins 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

Avoid deeply nested control flow statements.
Open

              for (let i = 0; i < len; i += 1) {
                let n = Selected.Nodes[i]
                let result = Util.openLink(DataModel.Topics.get(n.id).attributes.link)

                if (!result) { // if link failed to open
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if (n.getPos().x < lowX) lowX = n.getPos().x
Severity: Major
Found in frontend/src/Metamaps/Organize.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if (n.getPos().y < lowY) lowY = n.getPos().y
Severity: Major
Found in frontend/src/Metamaps/Organize.js - About 45 mins to fix

Function updateSelectedPermissions has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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

Consider simplifying this complex logical expression.
Open

      if (testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX) {
        selectTest = true
      }
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

      if (testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY) {
        selectTest = true
      }
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

      if (testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY) {
        selectTest = true
      }
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 40 mins to fix
Severity
Category
Status
Source
Language