metamaps/metamaps

View on GitHub

Showing 183 of 2,044 total issues

Method topics has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def topics
    term = params[:term]
    user = params[:user] ? params[:user] : false

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

  render() {
    const { unreadNotificationsCount, currentUser, mobileTitle,
            mobileTitleWidth, onTitleClick, serverData } = this.props
    const { open } = this.state
    return <div>
Severity: Major
Found in frontend/src/components/MobileHeader.js - About 3 hrs to fix

Function passFilters has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  passFilters: function() {
    var self = Filter
    var visible = self.visible

    var passesMetacode, passesMapper, passesSynapse
Severity: Major
Found in frontend/src/Metamaps/Filter.js - About 3 hrs to fix

Method autocomplete_array_json has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def autocomplete_array_json(topics)
    topics.map do |t|
      is_map = t.is_a?(Map)
      metamap_metacode = Metacode.find_by(name: 'Metamap')
      {
Severity: Minor
Found in app/helpers/topics_helper.rb - About 3 hrs 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 summarize_data has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.summarize_data(map, user, until_moment = DateTime.current)
    results = {
      stats: {}
    }

Severity: Major
Found in app/services/map_activity_service.rb - About 3 hrs to fix

Function renderTopic has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  renderTopic: function(mapping, topic, createNewInDB, permitCreateSynapseAfter, opts = {}) {
    var nodeOnViz, tempPos

    var newnode = topic.createNode()

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

File cloudcarousel-secret.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//////////////////////////////////////////////////////////////////////////////////
// CloudCarousel V1.0.5
// (c) 2011 by R Cecco. <http://www.professorcloud.com>
// MIT License
//
Severity: Minor
Found in app/assets/javascripts/cloudcarousel-secret.js - About 3 hrs to fix

Function edgeRender has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  edgeRender: function(adj, canvas) {
    // get nodes cartesian coordinates
    const pos = adj.nodeFrom.pos.getc(true)
    const posChild = adj.nodeTo.pos.getc(true)

Severity: Major
Found in frontend/src/Metamaps/JIT.js - About 3 hrs to fix

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

    init: function() {
      var synapseBloodhound = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        remote: {
Severity: Major
Found in frontend/src/Metamaps/Create.js - About 3 hrs to fix

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

module.exports = function(io, stunservers, state) {
  io.on('connection', function(socket) {
    socket.resources = {
      screen: false,
      video: true,
Severity: Major
Found in realtime/signal.js - About 3 hrs to fix

Class RestfulController has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

    class RestfulController < ActionController::Base
      include Pundit
      include PunditExtra

      snorlax_used_rest!
Severity: Minor
Found in app/controllers/api/v2/restful_controller.rb - About 3 hrs to fix

Function init has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  init: function(serverData) {
    var self = DataModel

    // workaround circular import problem
    if (!self.MapCollection.model) self.MapCollection.model = Map
Severity: Minor
Found in frontend/src/Metamaps/DataModel/index.js - About 2 hrs 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 summarize_data has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def self.summarize_data(map, user, until_moment = DateTime.current)
    results = {
      stats: {}
    }

Severity: Minor
Found in app/services/map_activity_service.rb - About 2 hrs 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 update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @user = User.find(current_user.id)

    if user_params[:password] == '' && user_params[:password_confirmation] == ''
      # not trying to change the password
Severity: Minor
Found in app/controllers/users_controller.rb - About 2 hrs 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 getMapCanvasForScreenshots has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getMapCanvasForScreenshots: () => {
    var canvas = {}

    canvas.canvas = document.createElement('canvas')
    canvas.canvas.width = 1880 // 960
Severity: Major
Found in frontend/src/Metamaps/Map/index.js - About 2 hrs to fix

Function zoomExtents has 68 lines of code (exceeds 25 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: Major
Found in frontend/src/Metamaps/JIT.js - About 2 hrs to fix

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

  render: function() {
    const self = Visualize

    if (self.type === 'RGraph') {
      // clear the previous canvas from #infovis
Severity: Major
Found in frontend/src/Metamaps/Visualize.js - About 2 hrs to fix

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

  render () {
    const { topic, map, filterData, allForFiltering, visibleForFiltering, toggleMetacode,
            toggleMapper, toggleSynapse, filterAllMetacodes,
            filterAllMappers, filterAllSynapses } = this.props
    const style = {
Severity: Major
Found in frontend/src/components/FilterBox.js - About 2 hrs to fix

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

  init: function(serverData) {
    var self = Realtime

    self.addJuntoListeners()

Severity: Major
Found in frontend/src/Metamaps/Realtime/index.js - About 2 hrs to fix

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

  render: function() {
    const self = Visualize

    if (self.type === 'RGraph') {
      // clear the previous canvas from #infovis
Severity: Minor
Found in frontend/src/Metamaps/Visualize.js - About 2 hrs 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