publiclab/plots2

View on GitHub

Showing 686 of 688 total issues

File comment.rb has 438 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Comment < ApplicationRecord
  include CommentsShared
  extend RawStats

  belongs_to :node, foreign_key: 'nid', touch: true, counter_cache: true
Severity: Minor
Found in app/models/comment.rb - About 6 hrs to fix

File notes_controller.rb has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class NotesController < ApplicationController
  respond_to :html
  before_action :require_user, only: %i(create edit update delete rsvp publish_draft)
  before_action :set_node, only: %i(show)

Severity: Minor
Found in app/controllers/notes_controller.rb - About 6 hrs to fix

Method show has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    @node = if params[:lang]
              Node.find_wiki(params[:lang] + '/' + params[:id])
            else
              Node.find_wiki(params[:id])
Severity: Minor
Found in app/controllers/wiki_controller.rb - About 6 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 show has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    get_wiki

    @node = @wiki # expose the wiki node in the @node variable so we get open graph meta tags in the layout

Severity: Minor
Found in app/controllers/tag_controller.rb - About 6 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

Block has too many lines. [325/257]
Open

    resource :srch do
      # Request URL should be /api/srch/all?query=QRY
      desc 'Perform a search of all available resources', hidden: false,
                                                          is_array: false,
                                                          nickname: 'search_all'
Severity: Minor
Found in app/api/srch/search.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Class Tag has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

class Tag < ApplicationRecord
  extend RawStats
  self.table_name = 'term_data'
  self.primary_key = 'tid'

Severity: Minor
Found in app/models/tag.rb - About 5 hrs to fix

Method handle_social_login_flow has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_social_login_flow(auth)
    # Find an identity here
    @identity = UserTag.find_with_omniauth(auth)
    return_to = request.env['omniauth.origin'] || root_url
    return_to += '?_=' + Time.now.to_i.to_s
Severity: Minor
Found in app/controllers/user_sessions_controller.rb - About 5 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 tag.rb has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Tag < ApplicationRecord
  extend RawStats
  self.table_name = 'term_data'
  self.primary_key = 'tid'

Severity: Minor
Found in app/models/tag.rb - About 5 hrs to fix

Function addGrid has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function addGrid(map)
 {
   // A function to return the style of a cell
   function create_cell_style(fill) {
   return {
Severity: Major
Found in app/assets/javascripts/locationForm.js - About 5 hrs to fix

Method update has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @node = Node.find(params[:id])
    if current_user.uid == @node.uid || current_user.admin? || @node.has_tag("with:#{current_user.username}")
      @revision = @node.latest
      @revision.title = params[:title]
Severity: Minor
Found in app/controllers/notes_controller.rb - About 5 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 create has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @output = {
      errors: [],
      saved: []
    }
Severity: Minor
Found in app/controllers/user_tags_controller.rb - About 4 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 tagNearbyPeople has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def tagNearbyPeople(coordinates, tag, field, period = nil, sort_by = nil, order_direction = nil, limit = 10)
    raise("Must contain all four coordinates") if coordinates["nwlat"].nil?
    raise("Must contain all four coordinates") if coordinates["nwlng"].nil?
    raise("Must contain all four coordinates") if coordinates["selat"].nil?
    raise("Must contain all four coordinates") if coordinates["selng"].nil?
Severity: Minor
Found in app/services/search_service.rb - About 4 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 admin_controller.rb has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class AdminController < ApplicationController
  before_action :require_user, only: %i(spam spam_revisions mark_comment_spam publish_comment spam_comments)

  # intended to provide integration tests for assets
  def assets; end
Severity: Minor
Found in app/controllers/admin_controller.rb - About 4 hrs to fix

Method create has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    return show_banned_flash unless current_user.status == User::Status::NORMAL

    saved, @node, @revision = new_note

Severity: Minor
Found in app/controllers/notes_controller.rb - About 4 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 search.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'grape'
require 'grape-entity'

module Srch
  class Search < Grape::API
Severity: Minor
Found in app/api/srch/search.rb - About 4 hrs to fix

File node_shared.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module NodeShared
  extend ActiveSupport::Concern

  def likes
    cached_likes
Severity: Minor
Found in app/models/concerns/node_shared.rb - About 4 hrs to fix

Method index has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def index
    begin
      permitted_params = params.permit(
        'authenticity_token', 'back_to',
        'commit',
Severity: Major
Found in app/controllers/openid_controller.rb - About 4 hrs to fix

Method create has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    params[:name] ||= ''
    tagnames = params[:name].split(',')
    @output = {
      errors: [],
Severity: Minor
Found in app/controllers/tag_controller.rb - About 4 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

Class NotesController has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

class NotesController < ApplicationController
  respond_to :html
  before_action :require_user, only: %i(create edit update delete rsvp publish_draft)
  before_action :set_node, only: %i(show)

Severity: Minor
Found in app/controllers/notes_controller.rb - About 4 hrs to fix

Method subscribe_multiple_tag has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def subscribe_multiple_tag(tag_list)
    if !tag_list || tag_list == ''
      flash[:notice] = "Please enter tags for subscription in the url."
    else
      if tag_list.is_a? String
Severity: Minor
Found in app/controllers/users_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

Severity
Category
Status
Source
Language