ari/jobsworth

View on GitHub

Showing 327 of 327 total issues

Method burnup_extracted_from_show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def burnup_extracted_from_show
    start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
    filter = filter_from_filter_by

    @items = []
Severity: Minor
Found in app/controllers/widgets_controller.rb - About 1 hr to fix

    Method name_from_worklog has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def name_from_worklog(w, r)
        if r == 1
          "#{w.task.issue_num} <a href=\"/tasks/view/#{w.task.task_num}\">#{ERB::Util.h w.task.name}</a> <br /><small>#{ERB::Util.h w.task.full_name}</small>".html_safe
        elsif r == 2
          w.is_a?(Tag) ? "#{w.name}" : I18n.t('worklog_reports.status.none')
    Severity: Minor
    Found in app/models/worklog_report.rb - About 1 hr to fix

      Method event_logs_for_timeline has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.event_logs_for_timeline(current_user, params)
          tz = TZInfo::Timezone.new(current_user.time_zone)
          now = tz.now
      
          filter_project = params[:filter_project].to_i
      Severity: Minor
      Found in app/models/event_log.rb - About 1 hr to fix

        Method init_start_and_end_dates has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def init_start_and_end_dates(params)
            range = params[:range].to_i
            case range
              when 0
                # Today
        Severity: Minor
        Found in app/models/worklog_report.rb - About 1 hr to fix

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

            def receive(email)
              # create wrapper email object
              wrapper = Mailman::Email.new(email)
          
              logger.tagged('EMAIL TRACKING') { logger.info 'receive wrapper' }
          Severity: Minor
          Found in app/models/mailman.rb - About 1 hr to fix

            Function bindEvents has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              TaskNotificationEditor.prototype.bindEvents = function () {
                var self = this;
            
                // add me click
                $('#add_me').click(function () {
            Severity: Minor
            Found in app/assets/javascripts/tasks/task_notification_editor.js - About 1 hr to fix

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

                ServiceEditor.prototype.bindEvents = function () {
                  var self = this;
              
                  // set up autocomplete for customer
                  $("#service-edit-autocomplete-for-customer").autocomplete({
              Severity: Minor
              Found in app/assets/javascripts/services.js - About 1 hr to fix

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

                  def create_csv
                    csv_string = ''
                    if @column_headers
                      CSV.generate(csv_string, :col_sep => ',') do |csv|
                
                
                Severity: Minor
                Found in app/models/worklog_report.rb - About 1 hr to fix

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

                    def file_type_image(ft)
                      return case ft.file_extension
                               when 'doc' then
                                 'document.png'
                               when 'zip' then
                  Severity: Minor
                  Found in app/helpers/project_files_helper.rb - About 1 hr to fix

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

                      def create
                        @task.task_due_calculation(params[:task][:due_at], current_user)
                        @task.duration = TimeParser.parse_time(params[:task][:duration])
                        @task.duration = 0 if @task.duration.nil?
                        if @task.service_id == -1
                    Severity: Minor
                    Found in app/controllers/tasks_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

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

                      def update
                        @task = AbstractTask.accessed_by(current_user).find_by(:id => params[:id])
                        if @task.nil?
                          flash[:error] = t('flash.error.not_exists_or_no_permission', model: TaskRecord.model_name.human)
                          redirect_from_last and return
                    Severity: Minor
                    Found in app/controllers/tasks_controller.rb - About 1 hr to fix

                      Method burndown_extracted_from_show has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def burndown_extracted_from_show
                          start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
                          filter = filter_from_filter_by
                      
                          @items = []
                      Severity: Minor
                      Found in app/controllers/widgets_controller.rb - About 1 hr to fix

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

                        jobsworth.Gantt = (function ($) {
                        
                          function Gantt(options) {
                            this.options = options;
                            this.init();
                        Severity: Minor
                        Found in app/assets/javascripts/gantt.js - About 1 hr to fix

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

                          jobsworth.CustomAttributeEdit = (function ($) {
                          
                            function CustomAttributeEdit(options) {
                              this.options = options;
                              this.init();
                          Severity: Minor
                          Found in app/assets/javascripts/custom_attribute_edit.js - About 1 hr to fix

                            Method get_body has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def self.get_body(email)
                                  body = nil
                                  if email.multipart?
                                    email.parts.each do |m|
                                      next if body
                            Severity: Minor
                            Found in app/models/mailman.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 validate_attributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def validate_attributes
                                # check attributes are valid
                                invalid = resource_attributes.select { |attr| !attr.check_regex }
                                res = invalid.empty?
                            
                            
                            Severity: Minor
                            Found in app/models/resource.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 render_task_dependants has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def render_task_dependants(t, depth, root_present)
                                res = ''
                                @printed_ids ||= []
                            
                                return if @printed_ids.include? t.id
                            Severity: Minor
                            Found in app/helpers/tasks_helper.rb - About 1 hr to fix

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

                                def remove(perm)
                                  case perm
                                    when 'comment' then
                                      self.can_comment = false
                                    when 'work' then
                              Severity: Minor
                              Found in app/models/project_permission.rb - About 1 hr to fix

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

                                  def search
                                    search_criteria = params[:term].strip
                                
                                    @customers = []
                                    @users = []
                                Severity: Minor
                                Found in app/controllers/customers_controller.rb - About 1 hr to fix

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

                                    def set(perm)
                                      case perm
                                        when 'comment' then
                                          self.can_comment = 1
                                        when 'work' then
                                  Severity: Minor
                                  Found in app/models/project_permission.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language