moebooru/moebooru

View on GitHub

Showing 8,248 of 8,248 total issues

File prototype.js has 4971 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*  Prototype JavaScript framework, version 1.7
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
Severity: Major
Found in lib/assets/javascripts/prototype/prototype.js - About 2 wks to fix

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

    class PostController < ApplicationController
      layout "default"
      helper :avatar
    
      before_action :member_only, :only => [:create, :destroy, :delete, :flag, :revert_tags, :activate, :update_batch, :vote]
    Severity: Minor
    Found in app/controllers/post_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.

    Assignment Branch Condition size for generate_sql is too high. [285.5/15]
    Open

        def generate_sql(q, options = {})
          if q.is_a?(Hash)
            original_query = options[:original_query]
          else
            original_query = q
    Severity: Minor
    Found in app/models/post/sql_methods.rb by rubocop

    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

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

        def generate_sql(q, options = {})
          if q.is_a?(Hash)
            original_query = options[:original_query]
          else
            original_query = q
    Severity: Minor
    Found in app/models/post/sql_methods.rb by rubocop

    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.

    Assignment Branch Condition size for parse_query is too high. [245.5/15]
    Open

        def parse_query(query, options = {})
          q = Hash.new { |h, k| h[k] = [] }
    
          scan_query(query).each do |token|
            if token =~ /^([qse])$/
    Severity: Minor
    Found in app/models/tag/parse_methods.rb by rubocop

    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

    Assignment Branch Condition size for similar is too high. [239.2/15]
    Open

      def similar
        @params = params
        unless params[:file].is_a?(ActionDispatch::Http::UploadedFile) then params.delete(:file) end
        if params[:url].blank? then params.delete(:url) end
        if params[:id].blank? then params.delete(:id) end
    Severity: Minor
    Found in app/controllers/post_controller.rb by rubocop

    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

    Assignment Branch Condition size for format_change is too high. [234.2/15]
    Open

      def format_change(_history, change, options, table_options)
        html = ""
    
        classes = []
        if !table_options[:never_obsolete][change.column_name.to_sym] && change.is_obsolete?
    Severity: Minor
    Found in app/helpers/history_helper.rb by rubocop

    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

    Module has too many lines. [395/100]
    Open

    module Post::FileMethods
      def self.included(m)
        m.before_validation :download_source, :on => :create
        m.before_validation :ensure_tempfile_exists, :on => :create
        m.before_validation :determine_content_type, :on => :create
    Severity: Minor
    Found in app/models/post/file_methods.rb by rubocop

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

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

    class PoolController < ApplicationController
      layout "default"
      before_action :member_only, :only => [:destroy, :update, :add_post, :remove_post, :import, :zip]
      before_action :post_member_only, :only => [:create]
      before_action :contributor_only, :only => [:copy, :transfer_metadata]
    Severity: Minor
    Found in app/controllers/pool_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.

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

      def similar
        @params = params
        unless params[:file].is_a?(ActionDispatch::Http::UploadedFile) then params.delete(:file) end
        if params[:url].blank? then params.delete(:url) end
        if params[:id].blank? then params.delete(:id) end
    Severity: Minor
    Found in app/controllers/post_controller.rb by rubocop

    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.

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

      def format_change(_history, change, options, table_options)
        html = ""
    
        classes = []
        if !table_options[:never_obsolete][change.column_name.to_sym] && change.is_obsolete?
    Severity: Minor
    Found in app/helpers/history_helper.rb by rubocop

    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.

    Module has too many lines. [319/100]
    Open

    module HistoryHelper
      include PostHelper
      # :all: By default, some changes are not displayed.  When displaying details
      # for a single change, set :all=>true to display all changes.
      #
    Severity: Minor
    Found in app/helpers/history_helper.rb by rubocop

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

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

    class UserController < ApplicationController
      layout "default"
      before_action :blocked_only, :only => [:authenticate, :update, :edit, :modify_blacklist]
      before_action :janitor_only, :only => [:invites]
      before_action :mod_only, :only => [:block, :unblock, :show_blocked_users]
    Severity: Minor
    Found in app/controllers/user_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.

    Method format_change has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring.
    Open

      def format_change(_history, change, options, table_options)
        html = ""
    
        classes = []
        if !table_options[:never_obsolete][change.column_name.to_sym] && change.is_obsolete?
    Severity: Minor
    Found in app/helpers/history_helper.rb - About 2 days 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 effects.js has 1014 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // script.aculo.us effects.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
    
    // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    // Contributors:
    //  Justin Palmer (http://encytemedia.com/)
    Severity: Major
    Found in lib/assets/javascripts/prototype/effects.js - About 2 days to fix

      Module has too many lines. [300/100]
      Open

        module ClassMethods
          def find_by_tag_join(tag, options = {})
            joins(:_tags).where(:tags => { :name => tag.downcase.tr(" ", "_") })
              .limit(options[:limit])
              .offset(options[:offset])
      Severity: Minor
      Found in app/models/post/sql_methods.rb by rubocop

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

      Assignment Branch Condition size for similar_images is too high. [169.3/15]
      Open

        def similar_images(options = {})
          errors = {}
      
          local_service = CONFIG["local_image_service"]
      
      
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      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

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

        def similar_images(options = {})
          errors = {}
      
          local_service = CONFIG["local_image_service"]
      
      
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      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. [233/100]
      Open

      class InlineImage < ApplicationRecord
        belongs_to :inline
        before_validation :download_source, :on => :create
        before_validation :determine_content_type, :on => :create
        before_validation :set_image_dimensions, :on => :create
      Severity: Minor
      Found in app/models/inline_image.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.

      Module has too many lines. [233/100]
      Open

      module SimilarImages
        def get_services(services)
          services = services
          services ||= "local"
          if services == "all"
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

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

      Severity
      Category
      Status
      Source
      Language