ari/jobsworth

View on GitHub

Showing 267 of 327 total issues

Function bind has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Filter.prototype.bind = function () {
    var self = this;

    // the user/client search box
    $(".search_filter").focus(function () {
Severity: Minor
Found in app/assets/javascripts/filter.js - About 1 hr to fix

    Method to_html has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def to_html
        return '' if body.blank?
    
        pres = []
    
    
    Severity: Minor
    Found in app/models/wiki_revision.rb - About 1 hr to fix

      Method receive has a Cognitive Complexity of 14 (exceeds 5 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

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

        def range
          return @range if @range
      
          # Swap to an appropriate range based on entries returned
          start_date = self.start_date
      Severity: Minor
      Found in app/models/worklog_report.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 milestones_to_select_tag has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def milestones_to_select_tag(milestones)
          options = [%Q[<option value="0" title="#{t('forms.select.please_select')}">#{t('forms.select.none')}</option>]] + milestones.collect do |milestone|
            date = milestone.due_at.nil? ? t('shared.not_set') : l(milestone.due_at, format: current_user.date_format)
      
            selected = if (@task.milestone_id == milestone.id) || (@task.milestone_id.nil? && milestone.id == '0')
      Severity: Minor
      Found in app/helpers/tasks_helper.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 init_start_and_end_dates has a Cognitive Complexity of 14 (exceeds 5 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

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