ari/jobsworth

View on GitHub

Showing 327 of 327 total issues

Avoid too many return statements within this method.
Open

      return 'tasks.company_id'
Severity: Major
Found in app/models/task_filter.rb - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      if (240 == so && 240 == wo) return 'Asia/Dubai';
    Severity: Major
    Found in app/assets/javascripts/tz.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        if (390 == so && 390 == wo) return 'Asia/Rangoon';
      Severity: Major
      Found in app/assets/javascripts/tz.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          if (600 == so && 600 == wo) return 'Australia/Brisbane';
        Severity: Major
        Found in app/assets/javascripts/tz.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            if (60 == so && 0 == wo) return 'Europe/London';
          Severity: Major
          Found in app/assets/javascripts/tz.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              if (345 == so && 345 == wo) return 'Asia/Katmandu';
            Severity: Major
            Found in app/assets/javascripts/tz.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                if (570 == so && 570 == wo) return 'Australia/Darwin';
              Severity: Major
              Found in app/assets/javascripts/tz.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  if (720 == so && 780 == wo) return 'Pacific/Auckland';
                Severity: Major
                Found in app/assets/javascripts/tz.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return 'tasks.milestone_id'
                  Severity: Major
                  Found in app/models/task_filter.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return "#{ class_type.downcase }_id"
                    Severity: Major
                    Found in app/models/task_filter.rb - About 30 mins to fix

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

                          var users = $('.username span').map(function () {
                            return $(this).text();
                          }).get();
                      Severity: Minor
                      Found in app/assets/javascripts/tasks/task_details_editor.js and 1 other location - About 30 mins to fix
                      app/assets/javascripts/tasks/task_notification_editor.js on lines 163..165

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

                      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

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

                              var users = $('.username span').map(function () {
                                return $(this).text();
                              }).get();
                      Severity: Minor
                      Found in app/assets/javascripts/tasks/task_notification_editor.js and 1 other location - About 30 mins to fix
                      app/assets/javascripts/tasks/task_details_editor.js on lines 62..64

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

                      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

                      Avoid too many return statements within this method.
                      Open

                            return render :json => {:billable => false}
                      Severity: Major
                      Found in app/controllers/tasks_controller.rb - About 30 mins to fix

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

                            $("#collapse-all").click(function () {
                              $(".next_tasks_panel").addClass("collapsed");
                              self.relayout();
                            });
                        Severity: Minor
                        Found in app/assets/javascripts/tasks/planning.js and 1 other location - About 30 mins to fix
                        app/assets/javascripts/tasks/planning.js on lines 42..45

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

                        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

                            $("#show-all").click(function () {
                              $(".next_tasks_panel").removeClass("collapsed");
                              self.relayout();
                            });
                        Severity: Minor
                        Found in app/assets/javascripts/tasks/planning.js and 1 other location - About 30 mins to fix
                        app/assets/javascripts/tasks/planning.js on lines 37..40

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

                        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 compose_sql has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def compose_sql(arg1, arg2)
                            if arg1.blank?
                              if arg2.blank?
                                ''
                              else
                        Severity: Minor
                        Found in app/models/task_filter.rb - About 25 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 changes_as_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def changes_as_html
                            res = []
                            type = resource_type_attribute
                        
                            self.changes.each do |name, values|
                        Severity: Minor
                        Found in app/models/resource_attribute.rb - About 25 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 set_custom_attribute_values= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def set_custom_attribute_values=(params)
                            updated = []
                            existing = custom_attribute_values.clone.to_a
                        
                            params.each do |values|
                        Severity: Minor
                        Found in app/models/custom_attribute_methods.rb - About 25 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 clean_body has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def self.clean_body(body)
                              new_body_end = body.to_s.index(Mailman::BODY_SPLIT) || body.to_s.length
                              body = body.to_s[0, new_body_end].strip
                        
                              lines = body.to_s.split("\n")
                        Severity: Minor
                        Found in app/models/mailman.rb - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update
                            @resource = current_user.company.resources.find(params[:id])
                            @resource.attributes = resource_attributes
                            @resource.company = current_user.company
                            log = log_resource_changes(@resource)
                        Severity: Minor
                        Found in app/controllers/resources_controller.rb - About 25 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