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
- Create a ticketCreate a ticket
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)
- Create a ticketCreate a ticket
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])
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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'
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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'
- Create a ticketCreate a ticket
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 {
- Create a ticketCreate a ticket
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]
- Read upRead up
- Create a ticketCreate a ticket
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: []
}
- Read upRead up
- Create a ticketCreate a ticket
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?
- Read upRead up
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
File node_shared.rb
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
module NodeShared
extend ActiveSupport::Concern
def likes
cached_likes
- Create a ticketCreate a ticket
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',
- Create a ticketCreate a ticket
Method create
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def create
params[:name] ||= ''
tagnames = params[:name].split(',')
@output = {
errors: [],
- Read upRead up
- Create a ticketCreate a ticket
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)
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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"