ozfortress/citadel

View on GitHub

Showing 34 of 34 total issues

Class Match has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Match < ApplicationRecord
    include MarkdownRenderCaching

    belongs_to :home_team, class_name: 'Roster'
    belongs_to :away_team, class_name: 'Roster', optional: true
Severity: Minor
Found in app/models/league/match.rb - About 3 hrs to fix

    Class MatchesController has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class MatchesController < ApplicationController
        include MatchesCommon
    
        before_action only: [:index, :new, :create, :generate, :create_round] do
          @league = League.find(params[:league_id])
    Severity: Minor
    Found in app/controllers/leagues/matches_controller.rb - About 3 hrs to fix

      Class RostersController has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class RostersController < ApplicationController
          include RosterPermissions
          include TeamPermissions
      
          before_action only: [:index, :new, :create] do
      Severity: Minor
      Found in app/controllers/leagues/rosters_controller.rb - About 2 hrs to fix

        Class TransferRequest has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class TransferRequest < ApplicationRecord
              belongs_to :roster
              belongs_to :leaving_roster, class_name: 'Roster', optional: true
        
              belongs_to :user
        Severity: Minor
        Found in app/models/league/roster/transfer_request.rb - About 2 hrs to fix

          Class UsersController has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class UsersController < ApplicationController
            include UsersPermissions
          
            before_action only: [:show, :edit, :update, :request_name_change] do
              @user = User.find(params[:id])
          Severity: Minor
          Found in app/controllers/users_controller.rb - About 2 hrs to fix

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

                class CommentPresenter < BasePresenter
                  presents :comment
            
                  def created_at
                    comment.created_at.strftime('%c')
            Severity: Major
            Found in app/presenters/league/roster/comment_presenter.rb and 1 other location - About 1 hr to fix
            app/presenters/user/comment_presenter.rb on lines 2..31

            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 63.

            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

              class CommentPresenter < BasePresenter
                presents :comment
            
                def created_at
                  comment.created_at.strftime('%c')
            Severity: Major
            Found in app/presenters/user/comment_presenter.rb and 1 other location - About 1 hr to fix
            app/presenters/league/roster/comment_presenter.rb on lines 3..32

            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 63.

            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

            Method update_rosters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def update_rosters(league, rosters, roster_results, opponents_map)
                    points_map = Hash.new { |h, k| h[k] = [] }
            
                    # Update scores from gathered stats
                    rosters.each do |roster|
            Severity: Minor
            Found in app/services/leagues/rosters/score_updating_service.rb - About 1 hr to fix

              Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function render(containerj, canvas) {
                      // Use twice the scale for better resolution on high dpi displays
                      var container = containerj[0];
                      var width = container.scrollWidth;
                      var height = container.scrollHeight;
              Severity: Minor
              Found in app/assets/javascripts/brackets.js - About 1 hr to fix

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

                  module Invites
                    module DeclanationService
                      include BaseService
                
                      def call(invite)
                Severity: Major
                Found in app/services/teams/invites/declanation_service.rb and 1 other location - About 1 hr to fix
                app/services/teams/invites/acceptance_service.rb on lines 2..20

                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 49.

                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

                  module Invites
                    module AcceptanceService
                      include BaseService
                
                      def call(invite)
                Severity: Major
                Found in app/services/teams/invites/acceptance_service.rb and 1 other location - About 1 hr to fix
                app/services/teams/invites/declanation_service.rb on lines 2..20

                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 49.

                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

                Method on_roster_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def on_roster_check
                        return unless user.present? && roster.present?
                
                        if roster.on_roster?(user)
                          errors.add(:user_id, 'Is already on the roster') if is_joining?
                Severity: Minor
                Found in app/models/league/roster/transfer_request.rb - About 45 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

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

                  module Transfers
                    module ApprovalService
                      include BaseService
                      extend CompletionMessageServicer
                
                
                Severity: Minor
                Found in app/services/leagues/transfers/approval_service.rb and 1 other location - About 40 mins to fix
                app/services/leagues/transfers/denial_service.rb on lines 2..21

                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 38.

                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

                  module Transfers
                    module DenialService
                      include BaseService
                      extend CompletionMessageServicer
                
                
                Severity: Minor
                Found in app/services/leagues/transfers/denial_service.rb and 1 other location - About 40 mins to fix
                app/services/leagues/transfers/approval_service.rb on lines 2..21

                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 38.

                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

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

                      def call(user, thread, params, post, post_params)
                Severity: Minor
                Found in app/services/forums/threads/editing_service.rb - About 35 mins to fix

                  Method require_permission has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def require_permission
                      if subject?
                        redirect_back unless user_can_edit_permissions?
                      else
                        redirect_back unless current_user.can?(:edit, :permissions) || current_user.can?(@action, admin_subject)
                  Severity: Minor
                  Found in app/controllers/permissions_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 transform_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def transform_data(data)
                          data.select! { |key, _| %w[type availability].include?(key.to_s) }
                  
                          return unless data['type'] == 'weekly'
                  
                  
                  Severity: Minor
                  Found in app/models/league/schedulers/weekly.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

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

                      paths do
                        def show
                          user_path(user_id, anchor: dom_id)
                        end
                  
                  
                  Severity: Minor
                  Found in app/models/user/comment.rb and 1 other location - About 30 mins to fix
                  app/models/league/roster/comment.rb on lines 23..43

                  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 33.

                  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

                        paths do
                          def show
                            edit_roster_path(roster_id, anchor: dom_id)
                          end
                  
                  
                  Severity: Minor
                  Found in app/models/league/roster/comment.rb and 1 other location - About 30 mins to fix
                  app/models/user/comment.rb on lines 22..42

                  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 33.

                  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

                        def validates_prohibition_to(action, subject, options = {})
                          table_name = Util.ban_name(actor_name, action, subject)
                  
                          ban = create_model(Auth::Ban, table_name: table_name, actor: self, action: action,
                                                        subject: subject, subject_options: options)
                  Severity: Minor
                  Found in lib/auth/model.rb and 1 other location - About 30 mins to fix
                  lib/auth/model.rb on lines 117..123

                  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 32.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language