pupilfirst/pupilfirst

View on GitHub

Showing 226 of 226 total issues

Method rank_change_icon has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def rank_change_icon(delta)
      if delta >= 10
        view.image_tag(
          "courses/leaderboard/rank-change-up-double.svg",
          alt:
Severity: Minor
Found in app/presenters/courses/leaderboard_presenter.rb - About 1 hr to fix

    Method execute has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def execute
          submission =
            TimelineEvent.transaction do
              timeline_event_params =
                (
    Severity: Minor
    Found in app/services/timeline_events/create_service.rb - About 1 hr to fix

      Function wrap has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            (i.prototype.wrap = function (r, e, o) {
              try {
                var n;
                if (
                  ((n =
      Severity: Minor
      Found in app/frontend/shared/utils/rollbar.js - About 1 hr to fix

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

            def auth_callback
              begin
                crypt = EncryptorService.new
        
                data =
        Severity: Minor
        Found in app/controllers/users/sessions_controller.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

        Function loadFull has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            (i.prototype.loadFull = function (r, e, o, n, t) {
              var l = !1,
                i = e.createElement("script"),
                s = e.getElementsByTagName("script")[0],
                d = s.parentNode;
        Severity: Minor
        Found in app/frontend/shared/utils/rollbar.js - About 1 hr to fix

          Method delete_content has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def delete_content
                quiz_questions =
                  QuizQuestion.joins(quiz: { assignment: :course }).where(
                    courses: {
                      id: @course.id
          Severity: Minor
          Found in app/services/courses/delete_service.rb - About 1 hr to fix

            Function Home has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Home() {
              const context = useDocusaurusContext();
              const { siteConfig = {} } = context;
              return (
                <Layout description="Description will go into a meta tag in <head />">
            Severity: Minor
            Found in docs/src/pages/index.js - About 1 hr to fix

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

                  def perform(event_type, course, actor, resource)
                    webhook_endpoint = course.webhook_endpoint
              
                    unless event_type.in?(webhook_endpoint.events)
                      raise "#{event_type} was not one of the requested events in WebhookEndpoint##{webhook_endpoint.id}"
              Severity: Minor
              Found in app/jobs/webhook_deliveries/deliver_job.rb - About 1 hr to fix

                Method add_updates_for_coach has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def add_updates_for_coach(user)
                    coach = user.faculty
                
                    return [] if coach.blank?
                
                
                Severity: Minor
                Found in app/services/daily_digest_service.rb - About 1 hr to fix

                  Method student_rows has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def student_rows
                        rows =
                          students.map do |student|
                            user = student.user
                  
                  
                  Severity: Minor
                  Found in app/services/course_exports/prepare_students_export_service.rb - About 1 hr to fix

                    Method targets has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def targets
                          attributes = %w[id title target_group_id sort_index]
                    
                          scope =
                            @course
                    Severity: Minor
                    Found in app/presenters/courses/curriculum_presenter.rb - About 1 hr to fix

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

                        function startRecording() {
                          if (
                            navigator.mediaDevices &&
                            navigator.mediaDevices.getUserMedia &&
                            !state.recording

                        Method update_email has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def update_email
                            user =
                              Users::ValidateUpdateEmailTokenService.new(
                                params[:token],
                                current_school
                        Severity: Minor
                        Found in app/controllers/users_controller.rb - About 1 hr to fix

                          Function setupShim has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                setupShim: function (r, e) {
                                  if (r) {
                                    var o = e.globalAlias || "Rollbar";
                                    if ("object" == typeof r[o]) return r[o];
                                    (r._rollbarShims = {}), (r._rollbarWrappedError = null);
                          Severity: Minor
                          Found in app/frontend/shared/utils/rollbar.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if (r) {
                                      "function" == typeof r._rollbarURH &&
                                        r._rollbarURH.belongsToShim &&
                                        r.removeEventListener("unhandledrejection", r._rollbarURH);
                                      var n = function (r) {
                            Severity: Critical
                            Found in app/frontend/shared/utils/rollbar.js - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                        if (
                                          !r._rollbar_wrapped &&
                                          ((r._rollbar_wrapped = function () {
                                            o && "function" == typeof o && o.apply(this, arguments);
                                            try {
                              Severity: Critical
                              Found in app/frontend/shared/utils/rollbar.js - About 1 hr to fix

                                Method generate_url has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def generate_url
                                      signer =
                                        Aws::CloudFront::UrlSigner.new(
                                          key_pair_id: Rails.application.secrets.cloudfront[:key_pair_id],
                                          private_key:
                                Severity: Minor
                                Found in app/services/cloudfront/generate_signed_url_service.rb - About 1 hr to fix

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

                                        red: {
                                          50: 'rgb(var(--color-red-50) / <alpha-value>)',
                                          100: 'rgb(var(--color-red-100) / <alpha-value>)',
                                          200: 'rgb(var(--color-red-200) / <alpha-value>)',
                                          300: 'rgb(var(--color-red-300) / <alpha-value>)',
                                  Severity: Major
                                  Found in tailwind.config.js and 7 other locations - About 1 hr to fix
                                  tailwind.config.js on lines 31..43
                                  tailwind.config.js on lines 44..56
                                  tailwind.config.js on lines 57..69
                                  tailwind.config.js on lines 70..82
                                  tailwind.config.js on lines 83..95
                                  tailwind.config.js on lines 96..108
                                  tailwind.config.js on lines 109..121

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

                                  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 8 locations. Consider refactoring.
                                  Open

                                        primary: {
                                          50: 'rgb(var(--color-primary-50) / <alpha-value>)',
                                          100: 'rgb(var(--color-primary-100) / <alpha-value>)',
                                          200: 'rgb(var(--color-primary-200) / <alpha-value>)',
                                          300: 'rgb(var(--color-primary-300) / <alpha-value>)',
                                  Severity: Major
                                  Found in tailwind.config.js and 7 other locations - About 1 hr to fix
                                  tailwind.config.js on lines 18..30
                                  tailwind.config.js on lines 31..43
                                  tailwind.config.js on lines 44..56
                                  tailwind.config.js on lines 57..69
                                  tailwind.config.js on lines 70..82
                                  tailwind.config.js on lines 96..108
                                  tailwind.config.js on lines 109..121

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

                                  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 8 locations. Consider refactoring.
                                  Open

                                        gray: {
                                          50: 'rgb(var(--color-gray-50) / <alpha-value>)',
                                          100: 'rgb(var(--color-gray-100) / <alpha-value>)',
                                          200: 'rgb(var(--color-gray-200) / <alpha-value>)',
                                          300: 'rgb(var(--color-gray-300) / <alpha-value>)',
                                  Severity: Major
                                  Found in tailwind.config.js and 7 other locations - About 1 hr to fix
                                  tailwind.config.js on lines 18..30
                                  tailwind.config.js on lines 31..43
                                  tailwind.config.js on lines 44..56
                                  tailwind.config.js on lines 57..69
                                  tailwind.config.js on lines 70..82
                                  tailwind.config.js on lines 83..95
                                  tailwind.config.js on lines 109..121

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

                                  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