metamaps/metamaps

View on GitHub

Showing 183 of 2,044 total issues

Function renderTopic has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  renderTopic: function(mapping, topic, createNewInDB, permitCreateSynapseAfter, opts = {}) {
Severity: Minor
Found in frontend/src/Metamaps/Topic.js - About 35 mins to fix

Function createSynapseWithParameters has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  createSynapseWithParameters: function(desc, category, permission,
    topic1, topic2) {
Severity: Minor
Found in frontend/src/Metamaps/Import.js - About 35 mins to fix

Method notify_followers has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.notify_followers(entity, event_type, event, reason_filter = nil, exclude_follows = nil)
Severity: Minor
Found in app/services/notification_service.rb - About 35 mins to fix

Function resize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  resize: function() {
    const self = ReactApp
    const maps = ExploreMaps.collection
    const currentUser = Active.Mapper
    const user = maps && maps.id === 'mapper' ? ExploreMaps.mapper : null
Severity: Minor
Found in frontend/src/Metamaps/GlobalUI/ReactApp.js - About 35 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 setAccessRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  setAccessRequest: function() {
    const self = Map
    if (Active.Mapper) {
      const request = _find(self.requests, r => r.user_id === Active.Mapper.id)
      if (!request) {
Severity: Minor
Found in frontend/src/Metamaps/Map/index.js - About 35 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 createSynapseLocally has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  createSynapseLocally: function() {
    var self = Synapse
    let topic1
    let topic2
    let node1
Severity: Minor
Found in frontend/src/Metamaps/Synapse.js - About 35 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 showCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  showCard: function(edge, e) {
    var self = SynapseCard

    // reset so we don't interfere with other edges, but first, save its x and y
    var myX = $('#edit_synapse').css('left')
Severity: Minor
Found in frontend/src/Metamaps/SynapseCard.js - About 35 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 topicAdded has a Cognitive Complexity of 7 (exceeds 5 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 35 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 init_metacodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def init_metacodes
    %w[Action Aim Idea Question Note Wildcard Subject].map do |m|
      begin
        metacode = Metacode.find_by(name: m)
        metacode.id.to_s if metacode
Severity: Minor
Found in app/models/user_preference.rb - About 35 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 pagination has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def pagination(collection)
        return @pagination_data unless @pagination_data.nil?

        current_page = (params[:page] || 1).to_i
        per = (params[:per] || 25).to_i
Severity: Minor
Found in app/controllers/api/v2/restful_controller.rb - About 35 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @synapse = Synapse.new(synapse_params)
    @synapse.desc = '' if @synapse.desc.nil?
    @synapse.desc.strip! # no trailing/leading whitespace
    @synapse.user = current_user
Severity: Minor
Found in app/controllers/synapses_controller.rb - About 35 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 too many return statements within this method.
Open

        return user.settings.follow_map_on_contributed == '1' if reason == 'contributed'
Severity: Major
Found in app/services/follow_service.rb - About 30 mins to fix

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

  render() {
    const { conversationLive, mapperIsLive, isParticipating, isPending, id, self, image, username, color } = this.props
    return (
      <div className={`participant participant-${id} ${self ? 'is-self' : ''}`}>
        <div className="chat-participant-image">
Severity: Minor
Found in frontend/src/routes/MapView/MapChat/Participant.js - About 25 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 selectNodeOnClickHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  selectNodeOnClickHandler: function(node, e) {
    if (Visualize.mGraph.busy) return

    const self = JIT

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

  getMaps: function(cb) {
    var self = this

    Loading.show()

Severity: Minor
Found in frontend/src/Metamaps/DataModel/MapCollection.js - About 25 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 deleteSelected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  deleteSelected: function() {
    if (!Active.Map) return

    var n = Selected.Nodes.length
    var e = Selected.Edges.length
Severity: Minor
Found in frontend/src/Metamaps/Control.js - About 25 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 handleUpdate has a Cognitive Complexity of 6 (exceeds 5 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 25 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 splitLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  splitLine: function(st, n) {
    var b = ''
    var s = st || ''
    while (s.length > n) {
      var c = s.substring(0, n)
Severity: Minor
Found in frontend/src/Metamaps/Util.js - About 25 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 submit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  submit: function(event) {
    if (event) event.preventDefault()

    var self = CreateMap

Severity: Minor
Found in frontend/src/Metamaps/GlobalUI/CreateMap.js - About 25 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 removeEdge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

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

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