crewmate/crewmate

View on GitHub

Showing 358 of 358 total issues

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

document.on("click", "a.expanded_mode", function(e,el) {
  e.stop();
  ActivityFeed.expandAll();
  $$('a.collapsed_mode')[0].up('.el').toggle();
  $$('a.expanded_mode')[0].up('.el').toggle();
Severity: Major
Found in app/javascripts/compact_mode.js and 1 other location - About 3 hrs to fix
app/javascripts/compact_mode.js on lines 18..24

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

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

  def update_from_pivotal_tracker(author, activity)
    story = activity[:stories][:story]
    author_name = activity[:author]
    self.updating_user = author || self.user

Severity: Minor
Found in app/models/task.rb - About 3 hrs 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 unpack_object has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def unpack_object(object, data, non_mass=[])
    object.tap do |obj|
      obj.attributes = data

      non_mass.each do |key|
Severity: Minor
Found in app/models/teambox_data/teambox.rb - About 3 hrs 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

window.f_scrollTop = function() { return ([window.pageYOffset ? window.pageYOffset : null, document.documentElement ? document.documentElement.scrollTop : null, document.body ? document.body.scrollTop : null].select(function(x){return x>0}).first()||0 ); }
public/javascripts/calendar_date_select/calendar_date_select.js on lines 43..43

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

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

window.f_height = function() { return( [window.innerHeight ? window.innerHeight : null, document.documentElement ? document.documentElement.clientHeight : null, document.body ? document.body.clientHeight : null].select(function(x){return x>0}).first()||0); }
public/javascripts/calendar_date_select/calendar_date_select.js on lines 44..44

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

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

  updateCounts: function(due_only) {
    if (Filter.assigned_options == null && Filter.count_due_date == null)
      Filter.init();

    var el = $("filter_assigned");
Severity: Minor
Found in app/javascripts/filter.js - About 3 hrs 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

  setProjectFilter: function(id, enabled) {
    if (id == 0)
      this.filters.project = enabled ? null : []
    else
    {
Severity: Major
Found in app/javascripts/hours.js and 1 other location - About 3 hrs to fix
app/javascripts/hours.js on lines 50..60

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

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

  setOrganizationFilter: function(id, enabled) {
    if (id == 0)
      this.filters.organization = enabled ? null : []
    else
    {
Severity: Major
Found in app/javascripts/hours.js and 1 other location - About 3 hrs to fix
app/javascripts/hours.js on lines 63..73

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

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

    def process(start=1,final=10)
      @start = start
      @final = final
      @rows = []

Severity: Minor
Found in app/helpers/gantt_helper.rb - About 3 hrs 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

File pages.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Element.addMethods({
  getSlotId: function(element) {
    element = $(element)
    return element.readAttribute('slot') ||
      (element.id && element.id.match(/^page_slot_(\d+)$/) && RegExp.$1)
Severity: Minor
Found in app/javascripts/pages.js - About 3 hrs to fix

    Method initialize has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(user)
    
        # Comment & commentable permissions
    
        can :update, Comment do |comment|
    Severity: Major
    Found in app/models/ability.rb - About 3 hrs to fix

      File application_controller.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class ApplicationController < ActionController::Base
        helper :all # include all helpers, all the time
        protect_from_forgery # See ActionController::RequestForgeryProtection for details
      
        include AuthenticatedSystem
      Severity: Minor
      Found in app/controllers/application_controller.rb - About 2 hrs to fix

        File hours.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var Hours = {
          initFromJSON: function(hours_data) {
            Hours.init(hours_data.start)
            Hours.addHours(hours_data.hours)
            Hours.userMap = hours_data.userMap
        Severity: Minor
        Found in app/javascripts/hours.js - About 2 hrs to fix

          Function sumByHours has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            sumByHours: function(field, map) {
              var comments = this.getFilteredComments()
              var weekSum = [{},{},{},{},{},{}]
              var totalSum = {}
              var weekTotal = 0
          Severity: Major
          Found in app/javascripts/hours.js - About 2 hrs to fix

            Function initButtonsDiv has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              initButtonsDiv: function()
              {
                var buttons_div = this.buttons_div;
                if (this.options.get("time"))
                {
            Severity: Minor
            Found in public/javascripts/calendar_date_select/calendar_date_select.js - About 2 hrs 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 convert_to_task! has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def convert_to_task!
                task_list = task_list_id.blank? ? nil : TaskList.find(task_list_id)
                task_list ||= TaskList.find_or_create_by_name_and_project_id_and_user_id('Inbox', project.id, user.id)
                assigned_person = project.people.find(assigned_id) if assigned_id && (assigned_id != 'Unassigned')
            
            
            Severity: Minor
            Found in app/models/conversation/tasks.rb - About 2 hrs 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 check_state has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def check_state
                @check_state = true
                if type_name == :import
                  case status_name
                  when :uploading
            Severity: Minor
            Found in app/models/teambox_data.rb - About 2 hrs 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 parseFormattedString has a Cognitive Complexity of 20 (exceeds 5 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})? *(pm|am)" +
                  "?)?)?)?";
              var d = string.match(new RegExp(regexp, "i"));
            Severity: Minor
            Found in public/javascripts/calendar_date_select/format_hyphen_ampm.js - About 2 hrs 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 calendar_for_tasks has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.calendar_for_tasks(tasks, projects, filter_user, host = nil, port = 80)
                  calendar_name = case projects
                  when Project then projects.name
                  else "Crewmate - All Projects"
                  end
            Severity: Minor
            Found in app/models/project.rb - About 2 hrs 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 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def render(opts = nil, extra_options = {}, &block)
                  if opts && opts.is_a?(Hash) then
                    if opts[:to_yaml] or opts[:as_yaml] then
                      headers["Content-Type"] = "text/plain;"
                      text = nil
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 2 hrs 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