education/classroom

View on GitHub

Showing 37 of 77 total issues

File setup.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
  var POLL_INTERVAL = 1000;
  var PROGRESS_HALF_LIFE = 1000;
  var progress_asymptotically,
    create_flash_container,
Severity: Minor
Found in app/assets/javascripts/setup.js - About 3 hrs to fix

    Class OrganizationsController has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class OrganizationsController < Orgs::Controller
      before_action :ensure_team_management_flipper_is_enabled, only: [:show_groupings]
    
      before_action :authorize_organization_addition,     only: [:create]
      before_action :set_users_github_organizations,      only: %i[index new create]
    Severity: Minor
    Found in app/controllers/organizations_controller.rb - About 3 hrs to fix

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

      class GroupAssignmentInvitationsController < ApplicationController
        class InvalidStatusForRouteError < StandardError; end
      
        include InvitationsControllerMethods
      
      
      Severity: Minor
      Found in app/controllers/group_assignment_invitations_controller.rb - About 3 hrs to fix

        Class GitHubRepository has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class GitHubRepository < GitHubResource
          depends_on :import
        
          DEFAULT_LABEL_COLOR = "ffffff"
          TEMPLATE_REPOS_API_PREVIEW = "application/vnd.github.baptiste-preview"
        Severity: Minor
        Found in app/models/github_repository.rb - About 3 hrs to fix

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

            class RostersController < Orgs::Controller
              before_action :ensure_current_roster, except: %i[
                new
                create
                import_from_google_classroom
          Severity: Minor
          Found in app/controllers/orgs/rosters_controller.rb - About 2 hrs to fix

            Function initializeSelectMenu has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function initializeSelectMenu() {
              var select_menu              = $(".select-menu");
              var select_menu_modal        = $(".select-menu-modal-holder");
              var select_menu_list         = $(".select-menu-list");
              var select_menu_list_items   = $(".select-menu-item");
            Severity: Major
            Found in app/assets/javascripts/select_menu.js - About 2 hrs to fix

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

              class GitHubOrganization < GitHubResource
                def accept_membership(user_github_login)
                  return if organization_member?(user_github_login)
              
                  GitHub::Errors.with_error_handling do
              Severity: Minor
              Found in app/models/github_organization.rb - About 2 hrs to fix

                Method initialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  def initialize(client, id_attributes, **options)
                    resource = options.delete(:classroom_resource)
                
                    attributes = {}.tap do |attr|
                      attr[:client]        = client
                Severity: Minor
                Found in app/models/github_model.rb - About 1 hr 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 perform has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def perform
                    org_webhook_count = (@all_organizations ? OrganizationWebhook : OrganizationWebhook.where(github_id: nil)).count
                
                    progress_bar = ProgressBar.create(
                      title: "Iterating over OrganizationWebhooks",
                Severity: Minor
                Found in app/services/organization_webhook_health_service.rb - About 1 hr 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 to_csv has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.to_csv(user_to_group_map = {})
                    CSV.generate(headers: true, col_sep: ",", force_quotes: true) do |csv|
                      columns = %i[identifier github_username github_id name]
                      columns << :group_name unless user_to_group_map.empty?
                      csv << columns
                Severity: Minor
                Found in app/models/roster_entry.rb - About 1 hr 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 initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def initialize(client, id_attributes, **options)
                    resource = options.delete(:classroom_resource)
                
                    attributes = {}.tap do |attr|
                      attr[:client]        = client
                Severity: Minor
                Found in app/models/github_model.rb - About 1 hr to fix

                  Method perform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def perform
                      org_webhook_count = (@all_organizations ? OrganizationWebhook : OrganizationWebhook.where(github_id: nil)).count
                  
                      progress_bar = ProgressBar.create(
                        title: "Iterating over OrganizationWebhooks",
                  Severity: Minor
                  Found in app/services/organization_webhook_health_service.rb - About 1 hr to fix

                    Method perform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def perform
                        start = Time.zone.now
                        invite_status.creating_repo!
                        Broadcaster.call(exercise, :create_repo, :text)
                    
                    
                    Severity: Minor
                    Found in app/services/create_github_repo_service.rb - About 1 hr to fix

                      Method report has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def report(exception, context_hash)
                                failbot_context = {}.tap do |ctx|
                                  job = context_hash[:job]
                      
                                  ctx[:queue] = job["queue"]
                      Severity: Minor
                      Found in lib/sidekiq/failbot/error_handler.rb - About 1 hr 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 message_valid? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def message_valid?(lti_message)
                              # check for duplicate nonce
                              return false if nonce_exists?(lti_message.oauth_nonce)
                      
                              # check if nonce too old
                      Severity: Minor
                      Found in lib/github_classroom/lti/message_store.rb - About 1 hr 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 report has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def report(exception, context_hash)
                                failbot_context = {}.tap do |ctx|
                                  job = context_hash[:job]
                      
                                  ctx[:queue] = job["queue"]
                      Severity: Minor
                      Found in lib/sidekiq/failbot/error_handler.rb - About 1 hr to fix

                        Method create_entries has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.create_entries(identifiers:, roster:, lms_user_ids: [])
                            created_entries = []
                            RosterEntry.transaction do
                              identifiers = add_suffix_to_duplicates(
                                identifiers: identifiers,
                        Severity: Minor
                        Found in app/models/roster_entry.rb - About 55 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 help has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def help
                            file_name = params[:article_name] ? params[:article_name] : "help"
                            return not_found unless HELP_DOCUMENTS.include? file_name
                        
                            @file = File.read(Rails.root.join("docs", "#{file_name}.md"))
                        Severity: Minor
                        Found in app/controllers/pages_controller.rb - About 55 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 perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def perform
                              recreate_deadline(@options[:deadline]) if deadline_updated_and_valid?
                        
                              @assignment.update_attributes(@options.except(:deadline))
                              raise Result::Error, @assignment.errors.full_messages.join("\n") unless @assignment.valid?
                        Severity: Minor
                        Found in app/models/assignment/editor.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

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

                              def build_error_message(error)
                                return "An error has occurred" if error.errors.blank?
                        
                                error.errors.map do |err|
                                  error_message = []
                        Severity: Minor
                        Found in lib/github/errors.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

                        Severity
                        Category
                        Status
                        Source
                        Language