crewmate/crewmate

View on GitHub

Showing 358 of 358 total issues

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

    if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255) return false;
Severity: Major
Found in app/javascripts/yahoo.color.js and 2 other locations - About 1 hr to fix
app/javascripts/yahoo.color.js on lines 133..133
app/javascripts/yahoo.color.js on lines 135..135

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

    if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255) return false;
Severity: Major
Found in app/javascripts/yahoo.color.js and 2 other locations - About 1 hr to fix
app/javascripts/yahoo.color.js on lines 134..134
app/javascripts/yahoo.color.js on lines 135..135

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

    if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255) return false;
Severity: Major
Found in app/javascripts/yahoo.color.js and 2 other locations - About 1 hr to fix
app/javascripts/yahoo.color.js on lines 133..133
app/javascripts/yahoo.color.js on lines 134..134

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

Function parseFormattedString has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Date.parseFormattedString = function (string) {

    var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" + 
        "( ([0-9]{1,2}):([0-9]{2})?" +
        "?)?)?)?"; 
Severity: Minor
Found in public/javascripts/calendar_date_select/format_iso_date.js - About 1 hr to fix

    Method api_wrap has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def api_wrap(object, options={})
        objects = if object.respond_to? :each
          object.map{|o| o.to_api_hash(options) }
        else
          object.to_api_hash(options)
    Severity: Minor
    Found in app/controllers/api_v1/api_controller.rb - About 1 hr to fix

      Method avatar_or_gravatar_url has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def avatar_or_gravatar_url(size = :thumb, secure = false)
          avatar_or_gravatar_path(size, secure).tap do |url|
            if url.starts_with? 'http'
              scheme = secure ? 'https:' : 'http:'
              url.sub('http:', scheme)
      Severity: Minor
      Found in app/models/user/avatar.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 routes_for_model has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def routes_for_model(modelname)
          mpath = modelname.underscore
          reject_actions = ['edit', 'new']
          [].tap do |list|
            @consolidated_routes.each do |route|
      Severity: Minor
      Found in app/helpers/apidocs_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 to_xml has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def to_xml(options = {})
          options[:indent] ||= 2
          xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
          xml.instruct! unless options[:skip_instruct]
          xml.task :id => id do
      Severity: Minor
      Found in app/models/task/conversions.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 refreshCalendarGrid has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        refreshCalendarGrid: function () {
          this.beginning_date = new Date(this.date).stripTime();
          this.beginning_date.setDate(1);
          this.beginning_date.setHours(12); // Prevent daylight savings time boundaries from showing a duplicate day
          var pre_days = this.beginning_date.getDay() // draw some days before the fact
      Severity: Minor
      Found in public/javascripts/calendar_date_select/calendar_date_select.js - 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 toggleElement has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        toggleElement: function(el, effect) {
          var contained = el.next()
          // if next element is an expanded area..
          if (contained && contained.hasClassName('contained')) {
            if (el.hasClassName('expanded')) {
      Severity: Minor
      Found in app/javascripts/navigation.js - 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 updateFilters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        updateFilters: function() {
          if (Filter.assigned_options == null && Filter.count_due_date == null)
            Filter.init();
          
          var el_name = $("filter_tasks_by_name")
      Severity: Minor
      Found in app/javascripts/filter.js - 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 belongs_to_project? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def belongs_to_project?
            if @current_project and logged_in?
              if current_user.projects.exists? @current_project
                # user is a project member
                unless @current_project.archived?
      Severity: Minor
      Found in app/controllers/application_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

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

      document.on('click', '.nav_links .el .show_less', function(e,el) {
        e.stop()
        $$('.el#show_more').invoke('show')
        $$('.el.extra').invoke('hide')
      })
      Severity: Major
      Found in app/javascripts/navigation.js and 1 other location - About 1 hr to fix
      app/javascripts/navigation.js on lines 98..102

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

      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

      document.on('click', '.nav_links .el .show_more', function(e,el) {
        e.stop()
        $$('.el#show_more').invoke('hide')
        $$('.el.extra').invoke('show')
      })
      Severity: Major
      Found in app/javascripts/navigation.js and 1 other location - About 1 hr to fix
      app/javascripts/navigation.js on lines 104..108

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

      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 to_api_hash has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def to_api_hash(options = {})
          base = {
            :id => id,
            :organization_id => organization_id,
            :name => name,
      Severity: Minor
      Found in app/models/project/conversions.rb - About 1 hr to fix

        Method to_api_hash has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def to_api_hash(options = {})
            base = {
              :id => id,
              :project_id => project_id,
              :user_id => user_id,
        Severity: Minor
        Found in app/models/task_list/conversions.rb - About 1 hr to fix

          Function toggleFold has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            toggleFold: function(task) {
              var block_id = "inline_"+task.readAttribute("id")
          
              if (task.hasClassName('expanded')) {
                task.removeClassName('expanded')
          Severity: Minor
          Found in app/javascripts/tasks_inline.js - About 1 hr to fix

            Method set_page_title has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def set_page_title
                  location_name = "#{params[:action]}_#{params[:controller]}"
                  translate_location_name = t("page_title.#{location_name}", :default => '')
            
                  if params.has_key?(:id) && ['show_projects','edit_projects'].include?(location_name)
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 1 hr to fix

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

                def destroy
                  @slot_id = @note.page_slot.id
              
                  if can?(:destroy, @page)
                    @note.destroy
              Severity: Major
              Found in app/controllers/notes_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/dividers_controller.rb on lines 79..93

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

              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

                def destroy
                  @slot_id = @divider.page_slot.id
              
                  if can?(:destroy, @page)
                    @divider.destroy
              Severity: Major
              Found in app/controllers/dividers_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/notes_controller.rb on lines 79..93

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

              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