education/classroom

View on GitHub

Showing 77 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

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

                set_progress_red = function(step_indicator) {
                  var progress = step_indicator.find(".progress");
                  if (progress.hasClass("bg-green")) {
                    progress.removeClass("bg-green");
                  }
              Severity: Major
              Found in app/assets/javascripts/setup.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/setup.js on lines 70..78

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

              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

                set_progress_green = function(step_indicator) {
                  var progress = step_indicator.find(".progress");
                  if (progress.hasClass("bg-red")) {
                    progress.removeClass("bg-red");
                  }
              Severity: Major
              Found in app/assets/javascripts/setup.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/setup.js on lines 80..88

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

              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

              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

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

                  $('.assignments').ready(function() {
                    return $('#assignment_title').on('change paste keyup click', function() {
                      return $('#assignment_slug').val(generate_slug($('#assignment_title').val()));
                    });
                  });
                Severity: Major
                Found in app/assets/javascripts/assignments-slug.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/assignments-slug.js on lines 22..26

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

                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

                  $('.group_assignments').ready(function() {
                    return $('#group_assignment_title').on('change paste keyup click', function() {
                      return $('#group_assignment_slug').val(generate_slug($('#group_assignment_title').val()));
                    });
                  });
                Severity: Major
                Found in app/assets/javascripts/assignments-slug.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/assignments-slug.js on lines 16..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 71.

                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 AssignmentReposController < API::ApplicationController
                    include ActionController::Serialization
                    include OrganizationAuthorization
                
                    before_action :set_assignment
                Severity: Major
                Found in app/controllers/api/assignment_repos_controller.rb and 1 other location - About 1 hr to fix
                app/controllers/api/group_assignment_repos_controller.rb on lines 4..35

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

                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 GroupAssignmentReposController < API::ApplicationController
                    include ActionController::Serialization
                    include OrganizationAuthorization
                
                    before_action :set_assignment
                Severity: Major
                Found in app/controllers/api/group_assignment_repos_controller.rb and 1 other location - About 1 hr to fix
                app/controllers/api/assignment_repos_controller.rb on lines 4..29

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

                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

                function displayDownloadMessage() {
                  var launchMessage = $("#js-modal-launching")[0];
                  var downloadReposMessage = $("#js-modal-download-repos")[0];
                  launchMessage.style.display = "none";
                  downloadReposMessage.style.display = "block";
                Severity: Major
                Found in app/assets/javascripts/desktop-protocol-handler.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/desktop-protocol-handler.js on lines 36..41

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

                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

                function displayLaunchingMessage() {
                  var launchMessage = $("#js-modal-launching")[0];
                  var downloadReposMessage = $("#js-modal-download-repos")[0];
                  launchMessage.style.display = "block";
                  downloadReposMessage.style.display = "none";
                Severity: Major
                Found in app/assets/javascripts/desktop-protocol-handler.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/desktop-protocol-handler.js on lines 43..48

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

                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 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 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 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 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
                      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
                    Severity
                    Category
                    Status
                    Source
                    Language