openworm / org.geppetto.frontend

Geppetto Java frontend bundle
http://www.geppetto.org/
Other
29 stars 25 forks source link

some linting errors #873

Closed rodriguez-facundo closed 5 years ago

rodriguez-facundo commented 5 years ago

partial collection of linting issues


File: MessageHandler.js Lline: 187 Error: payload not defined Code:

messageHandler[messageTypes.NO_FEATURE] = function () {
      // Updates the simulation controls visibility
      GEPPETTO.ModalFactory.infoDialog(GEPPETTO.Resources.NO_FEATURE, payload.message);
    };

File: SceneController.js Lline: 287 Error: ithrehold not defined Code:

setLinesThreshold: function (threshold) {
        for (var i = 0; i < this.canvasComponents.length; i++) {
          this.canvasComponents[i].setLinesThreshold(ithreshold);
        }
      },

File: PythonControlledCapability.js Lline: 358 Error: ComponentDidUpdate is defined twice Code:

componentDidUpdate (prevProps, prevState) {
          if (!this.compareArrays(this.state.value, prevState.value)) {
            if ($.isArray(this.state.value)) {
              for (var v in this.state.value) {
                if (this.state.pythonData.indexOf(this.state.value[v]) < 0) {
                  var newValue = [this.state.value[v]];
                  this.setState({ pythonData: this.state.pythonData.concat(newValue) });
                }
              }
            }
          }
        }

componentDidUpdate (prevProps, prevState) {
           if (this.state.value != prevState.value && this.props.onChange) {
             this.props.onChange(null, null, this.state.value);
          }
        }

File: ThreeDEngine.js Lline: 598 Error: geometry not defined Comment: is this ment to be global or var declaration is missing? Code:

if (this.aboveLinesThreshold && this.linesUserInput) {
        geometry = this.linesUserPreference ? 'lines' : 'cylinders';
      } else {
        geometry = this.aboveLinesThreshold ? 'lines' : 'cylinders';
      }

      return geometry;

File: ThreeDEngine.js Lline: 1401 Error: aabbMin not defined... same for bb Code:

addMeshToZoomParameters: function (mesh, zoomParameters) {
      mesh.geometry.computeBoundingBox();
      aabbMin = mesh.geometry.boundingBox.min;
      aabbMax = mesh.geometry.boundingBox.max;

      bb = mesh.geometry.boundingBox;
      bb.translate(mesh.localToWorld(new THREE.Vector3()));

      // If min and max vectors are null, first values become default min and max
      if (zoomParameters.aabbMin == undefined && zoomParameters.aabbMax == undefined) {
        zoomParameters.aabbMin = bb.min;
        zoomParameters.aabbMax = bb.max;
      } else {
        // Compare other meshes, particles BB's to find min and max
        zoomParameters.aabbMin.x = Math.min(zoomParameters.aabbMin.x, bb.min.x);
        zoomParameters.aabbMin.y = Math.min(zoomParameters.aabbMin.y, bb.min.y);
        zoomParameters.aabbMin.z = Math.min(zoomParameters.aabbMin.z, bb.min.z);
        zoomParameters.aabbMax.x = Math.max(zoomParameters.aabbMax.x, bb.max.x);
        zoomParameters.aabbMax.y = Math.max(zoomParameters.aabbMax.y, bb.max.y);
        zoomParameters.aabbMax.z = Math.max(zoomParameters.aabbMax.z, bb.max.z);
      }

      return zoomParameters;
    },

File: ThreeDEngine.js Lline: 1771 Error: duplicated function Code:

/**
     * Make unselected instances transparent or not
     *
     * @param {boolean}
     *            apply - Turn on or off the transparency
     */
    unselectedTransparent: function (apply) {    <--------------
      GEPPETTO.SceneController.unselectedTransparent(this.meshes, apply);
      GEPPETTO.SceneController.unselectedTransparent(this.splitMeshes, apply);
    },

    /**
     * Make unselected instances transparent or not
     *
     * @param {Array}
     *            meshes - Array of meshes to apply the transparency to
     * @param {boolean}
     *            apply - Transparency effect on or off
     */
    unselectedTransparent: function (meshes, apply) { <--------------
      for (var v in meshes) {
        var mesh = meshes[v];
        if (mesh != null && mesh.visible) {
          if (apply && (!mesh.ghosted) && (!mesh.selected)) {
            if (mesh instanceof THREE.Object3D) {
              mesh.ghosted = true;
              mesh.traverse(function (object) {
                if (object.hasOwnProperty("material")) {
                  if (object.visible) {
                    object.ghosted = true;
                    object.material.transparent = true;
                    object.material.opacity = GEPPETTO.Resources.OPACITY.GHOST;
                  }
                }
              });
            } else {
              mesh.ghosted = true;
              mesh.material.transparent = true;
              mesh.material.opacity = GEPPETTO.Resources.OPACITY.GHOST;
            }
          } else if ((!apply) && (mesh.ghosted)) {
            if (mesh instanceof THREE.Object3D) {
              mesh.ghosted = false;
              mesh.traverse(function (object) {
                if (object.hasOwnProperty("material")) {
                  if (object.visible) {
                    object.ghosted = false;
                    object.material.opacity = object.material.defaultOpacity;
                    if (object.material.opacity == 1) {
                      object.material.transparent = false;
                    }
                  }
                }
              });
            } else {
              mesh.ghosted = false;
              mesh.material.opacity = mesh.material.defaultOpacity;
              if (mesh.material.opacity == 1) {
                mesh.material.transparent = false;
              }
            }
          }
        }

      }
    },

File: console.js Lline: 139 Error: mostCommon not defined Code:

if (word1 != word2) {
                      while (word1.charAt(i) == word2.charAt(i)){
                        ++i;
                      }
                      // match up most common part
                      mostCommon = word1.substring(0, i);
                    } else {
                      mostCommon = word1;
                    }

                    if (inpt.val().indexOf(mostCommon) == -1) {
                      inpt.val(mostCommon);// change the input to the first match

                      inpt[0].selectionStart = original.length; // highlight from end of input
                      inpt[0].selectionEnd = mostCommon.length;// highlight to the end
                    }

File: GEPPETTO.JSEditor.js Lline: 88 Error: cm not defined Code:

$("#javascriptFullscreen").click(function () {
          cm = jsEditor;
          GEPPETTO.JSEditor.setFullScreen(cm, !GEPPETTO.JSEditor.isFullScreen(cm));
        });

File: query.js Lline: 227 Error: imgElement not defined Code:

buildImage: function (thumbImage, imageContainerId) {
      var action = this.getImageClickAction(thumbImage.reference);
      imgElement = <div id={imageContainerId} className="query-results-image collapse in">
        <a href='' onClick={action}>
          <img className="query-results-image invert" src={thumbImage.data} />
        </a>
      </div>
      return imgElement;

File: simulationButton/helpbutton.js Lline: 4 Error: missing var for a couple requires? Code:

var React = require('react'),                     < ----   ,
    ReactDOM = require('react-dom'),     
    GEPPETTO = require('geppetto');        < ----  ;
  $ = require('jquery'),
  HelpModal = require('../HelpModal');

File: chords.js Lline: 296 Error: π, τ, halfπ, dr defined globally Code:

layout_chord: function () {
      π = Math.PI;
      τ = 2 * π;
      halfπ = π / 2;
      dr = 15;

File: hives.js Lline: all Error: all variables are global << starts to declare var with , but then uses ; and the var is not longer considered. Code:

innerRadius = 20,
      outerRadius = 180;

      var angle = d3.scalePoint().domain(d3.range(context.dataset.nodeTypes.length + 1)).range([0, 2 * Math.PI]),
        quali_angle = d3.scaleBand().domain(context.dataset.nodeTypes).range([0, 2 * Math.PI]);
      radius = d3.scaleLinear().range([innerRadius, outerRadius]),
      linkTypeScale = d3.scaleOrdinal(d3.schemeCategory10).domain(context.dataset.linkTypes);
      nodeTypeScale = context.nodeColormap.range ? context.nodeColormap : d3.scaleOrdinal(d3.schemeCategory20);

File: TreeVisualizerDat.js Lline: 208 Error: label not defined Code:

prepareTree: function (parent, data, step) {
      if ('labelName' in this.options) {
        // We need to verify if this is working
        label = data.getWrappedObj().get(this.options.labelName);
      } else {
        label = data.getName();
      }

File: TreeVisualizerDat.js Lline: 278 Error: dataset not defined Code:

// Execute set value if it is a parameter specification
          if (data.getMetaType() == GEPPETTO.Resources.PARAMETER_TYPE) {
            $(dataset.valueDict[data.getPath()]["controller"].__li).find('div > div > input[type="text"]').change(function (){
              GEPPETTO.CommandController.execute(data.getPath() + ".setValue(" + $(this).val().split(" ")[0] + ")");
            });
          }

File: addWidgetController.js Lline: 25 Error: registeredEvents not defined Code:

constructor: function () {
        // Call the original constructor
        Backbone.View.apply(this, arguments);
        registeredEvents = [];
      },

File: widget.js Lline: 443, and 721 Error: duplicated keys showTitleBar and restore Code:


File: WidgetCapability.js Lline: 570 Error: duplicated key restore Code:


File: widgetFactoryjs Lline: 24 Error: _widgetsControllers is not defined Commment: missing this? Code:

update: function (event, parameters) {
        for (var i = 0; i < _widgetsControllers.length; i++) {
          this._widgetsControllers[i].update(event, parameters);
        }
      }
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.