metamaps/metamaps

View on GitHub

Showing 183 of 2,044 total issues

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

module.exports = function(io, store) {
  io.on('connection', function(socket) {
    socket.on(CHECK_FOR_CALL, function(data) {
      var callInProgress = Object.keys(io.nsps['/'].adapter.rooms[data.room] || {}).length
      if (callInProgress) socket.emit(CALL_IN_PROGRESS)
Severity: Minor
Found in realtime/junto.js - About 1 hr to fix

Function add_direction_form has a Cognitive Complexity of 10 (exceeds 5 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 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 showImagePreview has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  showImagePreview: function() {
    var file = $('#user_image')[0].files[0]

    var reader = new window.FileReader()

Severity: Minor
Found in frontend/src/Metamaps/Account.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 createTopicLocally has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createTopicLocally: function() {
    var self = Topic

    if (Create.newTopic.name === '') {
      GlobalUI.notifyUser('Please enter a topic title...')
Severity: Minor
Found in frontend/src/Metamaps/Topic.js - About 1 hr to fix

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

  render () {
    const { currentUser, onInviteClick } = this.props
    return <div>
      <img className="sidebarAccountImage" src={currentUser.get('image')} width="48" height="48" />
      <h3 className="accountHeader">{currentUser.get('name')}</h3>
Severity: Minor
Found in frontend/src/components/AccountMenu.js - About 1 hr to fix

Function Reflection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Reflection(img, reflHeight, opacity) {                
        
        var    reflection, cntx, imageWidth = img.width, imageHeight = img.width, gradient, parent;
    
        parent = $(img.parentNode);
Severity: Minor
Found in app/assets/javascripts/cloudcarousel-secret.js - About 1 hr to fix

Function removeSelectedNodes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  removeSelectedNodes: function() { // refers to removing topics permanently from a map
    if (Active.Topic) {
      // hideNode will handle synapses as well
      var nodeids = _.map(Selected.Nodes, function(node) {
        return node.id
Severity: Minor
Found in frontend/src/Metamaps/Control.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

      if (e.touches || (e.button === 0 && !e.altKey && !e.ctrlKey && (e.buttons === 0 || e.buttons === 1 || e.buttons === undefined))) {
        const width = Visualize.mGraph.canvas.getSize().width
        const height = Visualize.mGraph.canvas.getSize().height
        const xPix = Util.coordsToPixels(Visualize.mGraph, pos).x
        const yPix = Util.coordsToPixels(Visualize.mGraph, pos).y
Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 1 hr to fix

Function onMouseMoveHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  onMouseMoveHandler: function(_node, eventInfo, e) {
    const self = JIT

    if (Visualize.mGraph.busy) return

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

  render () {
    const { topic, map, filterData, allForFiltering, visibleForFiltering, toggleMetacode,
            toggleMapper, toggleSynapse, filterAllMetacodes,
            filterAllMappers, filterAllSynapses } = this.props
    const style = {
Severity: Minor
Found in frontend/src/components/FilterBox.js - About 55 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 updateTopicPositions has a Cognitive Complexity of 9 (exceeds 5 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 55 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 synapseAdded has a Cognitive Complexity of 9 (exceeds 5 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 55 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 comparator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  comparator: function(a, b) {
    a = a.get(this.sortBy)
    b = b.get(this.sortBy)
    var temp
    if (this.sortBy === 'name') {
Severity: Minor
Found in frontend/src/Metamaps/DataModel/MapCollection.js - About 55 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 deleteEdge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  deleteEdge: function(edge) {
    if (!Active.Map) return

    var authorized = Active.Map.authorizeToEdit(Active.Mapper)

Severity: Minor
Found in frontend/src/Metamaps/Control.js - About 55 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

Method follow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def follow(entity, user, reason)
      return unless user

      return if (reason == 'created' || reason == 'contributed') && !should_auto_follow(entity, user, reason)

Severity: Minor
Found in app/services/follow_service.rb - About 55 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

Method user_metacodes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
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 - About 55 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 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

Severity
Category
Status
Source
Language