metamaps/metamaps

View on GitHub

Showing 2,002 of 2,002 total issues

File JIT.js has 1330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global $, Image */

import _ from 'lodash'
import clipboard from 'clipboard-js'

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

Assignment Branch Condition size for summarize_data is too high. [127/16]
Open

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

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Class has too many lines. [171/100]
Open

class MapsController < ApplicationController
  before_action :require_user, only: %i[create update destroy events follow unfollow]
  before_action :set_map, only: %i[show conversation update destroy
                                   contains events export
                                   follow unfollow unfollow_from_email]
Severity: Minor
Found in app/controllers/maps_controller.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [164/100]
Open

    class RestfulController < ActionController::Base
      include Pundit
      include PunditExtra

      snorlax_used_rest!

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [159/100]
Open

class TopicsController < ApplicationController
  include TopicsHelper

  before_action :require_user, only: %i[create update destroy follow unfollow]
  before_action :set_topic, only: %i[show update relative_numbers

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [142/100]
Open

class Topic < ApplicationRecord
  ATTRS_TO_WATCH = %w[name desc link metacode_id permission defer_to_map_id].freeze
  include TopicsHelper
  include Attachable

Severity: Minor
Found in app/models/topic.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [137/100]
Open

class User < ApplicationRecord
  acts_as_messageable # mailboxer notifications

  has_many :topics
  has_many :synapses
Severity: Minor
Found in app/models/user.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [82/10]
Open

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

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [129/100]
Open

class Map < ApplicationRecord
  ATTRS_TO_WATCH = %w[name desc permission].freeze

  belongs_to :user
  belongs_to :source, class_name: :Map
Severity: Minor
Found in app/models/map.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [125/100]
Open

class SearchController < ApplicationController
  include TopicsHelper
  include MapsHelper
  include UsersHelper
  include SynapsesHelper

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        case STATES.SYNAPSES:
          if (noblanks.length === 0) {
            state = STATES.UNKNOWN
          } else if (noblanks.length === 1 && line[0].toLowerCase() === 'topics') {
            state = STATES.TOPICS_NEED_HEADERS
Severity: Major
Found in frontend/src/Metamaps/Import.js and 1 other location - About 1 day to fix
frontend/src/Metamaps/Import.js on lines 158..177

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 263.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        case STATES.TOPICS:
          if (noblanks.length === 0) {
            state = STATES.UNKNOWN
          } else if (noblanks.length === 1 && line[0].toLowerCase() === 'topics') {
            state = STATES.TOPICS_NEED_HEADERS
Severity: Major
Found in frontend/src/Metamaps/Import.js and 1 other location - About 1 day to fix
frontend/src/Metamaps/Import.js on lines 179..198

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 263.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function onDragMoveTopicHandler has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  onDragMoveTopicHandler: function(node, eventInfo, e) {
    var self = JIT

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

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

HTTP Response Splitting vulnerability in puma
Open

    puma (3.10.0)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-5247

Criticality: Medium

URL: https://github.com/puma/puma/security/advisories/GHSA-84j7-475p-hp8v

Solution: upgrade to ~> 3.12.4, >= 4.3.3

RuboCop: insecure use of /tmp
Open

    rubocop (0.48.1)
Severity: Info
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2017-8418

Criticality: Low

URL: https://github.com/bbatsov/rubocop/issues/4336

Solution: upgrade to >= 0.49.0

Code Injection vulnerability in CarrierWave::RMagick
Open

    carrierwave (1.1.0)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2021-21305

Criticality: High

URL: https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-cf3w-g86h-35x4

Solution: upgrade to ~> 1.3.2, >= 2.1.1

Directory traversal in Rack::Directory app bundled with Rack
Open

    rack (2.0.3)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-8161

URL: https://groups.google.com/forum/#!topic/ruby-security-ann/T4ZIsfRf2eA

Solution: upgrade to ~> 2.1.3, >= 2.2.0

Possible DoS Vulnerability in Active Record PostgreSQL adapter
Open

    activerecord (5.0.5)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2021-22880

Criticality: Medium

URL: https://groups.google.com/g/rubyonrails-security/c/ZzUqCh9vyhI

Solution: upgrade to >= 5.2.4.5, ~> 5.2.4, ~> 6.0.3.5, >= 6.1.2.1

Nokogiri::XML::Schema trusts input by default, exposing risk of an XXE vulnerability
Open

    nokogiri (1.8.1)
Severity: Info
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-26247

Criticality: Low

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m

Solution: upgrade to >= 1.11.0.rc4

CSRF Vulnerability in rails-ujs
Open

    actionview (5.0.5)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-8167

URL: https://groups.google.com/forum/#!topic/rubyonrails-security/x9DixQDG9a0

Solution: upgrade to >= 5.2.4.3, ~> 5.2.4, >= 6.0.3.1

Severity
Category
Status
Source
Language