crewmate/crewmate

View on GitHub

Showing 358 of 358 total issues

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

    if Array(options[:include]).include? :thread_comments
      base[:first_comment] = first_comment.to_api_hash(options)  if first_comment
      base[:recent_comments] = recent_comments.map{|c|c.to_api_hash(options)}
    elsif !Array(options[:include]).include?(:comments)
      base[:first_comment_id] = first_comment.try(:id)
Severity: Major
Found in app/models/conversation/conversions.rb and 2 other locations - About 1 hr to fix
app/models/task/conversions.rb on lines 54..60
app/models/task_list/conversions.rb on lines 51..57

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

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_xml has 27 lines of code (exceeds 25 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.comment :id => id do
Severity: Minor
Found in app/models/comment/conversions.rb - About 1 hr to fix

    Function rgb2hsv has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.rgb2hsv = function (r, g, b) {
          var r = ( r / 255 );                   //RGB values = 0 ÷ 255
          var g = ( g / 255 );
          var b = ( b / 255 );
    
    
    Severity: Minor
    Found in app/javascripts/yahoo.color.js - About 1 hr to fix

      Function parseFormattedString has 27 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})? *(pm|am)" +
            "?)?)?)?";
        var d = string.match(new RegExp(regexp, "i"));
      Severity: Minor
      Found in public/javascripts/calendar_date_select/format_hyphen_ampm.js - About 1 hr to fix

        Method convert_to_task has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def convert_to_task
            authorize! :update, @conversation
        
            @conversation.attributes = params[:conversation]
            @conversation.updating_user = current_user
        Severity: Minor
        Found in app/controllers/conversations_controller.rb - About 1 hr to fix

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

            if (InsertionBar.current_form) {
              InsertionBar.place();
            } else {
              InsertionBar.show();
              InsertHere.enabled = false;
          Severity: Major
          Found in app/javascripts/pages.js and 1 other location - About 1 hr to fix
          app/javascripts/pages.js on lines 332..338

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

          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

            if (InsertionBar.current_form) {
              InsertionBar.place();
            } else {
              InsertionBar.show();
              InsertHere.enabled = false;
          Severity: Major
          Found in app/javascripts/pages.js and 1 other location - About 1 hr to fix
          app/javascripts/pages.js on lines 320..326

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

          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('ajax:complete', '.page_slot .note form, .page_slot .divider form', function(e, el) {
            el.down('.submit').show();
            el.down('img.loading').hide();
          });
          Severity: Major
          Found in app/javascripts/pages.js and 1 other location - About 1 hr to fix
          app/javascripts/pages.js on lines 357..360

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

          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('ajax:before', '.page_slot .note form, .page_slot .divider form', function(e, el) {
            el.down('.submit').hide();
            el.down('img.loading').show();
          });
          Severity: Major
          Found in app/javascripts/pages.js and 1 other location - About 1 hr to fix
          app/javascripts/pages.js on lines 362..365

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

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

          var InsertHereFunc = function(evt){
            if (!InsertHere.enabled)
              return;
          
            var el = $(evt.target);
          Severity: Minor
          Found in app/javascripts/pages.js - About 1 hr to fix

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

              def to_api_hash(options = {})
                base = {
                  :id => id,
                  :action => action,
                  :created_at => created_at.to_s(:api_time),
            Severity: Minor
            Found in app/models/activity.rb - About 1 hr to fix

              Method find_in_ldap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.find_in_ldap(login)
                  conf = Teambox.config.ldap_auth_settings
              
                  conn = User.create_ldap_connection
                  filter = Net::LDAP::Filter.eq(conf.identifier_key, login)
              Severity: Minor
              Found in app/models/user/authentication_ldap.rb - About 1 hr to fix

                Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def create
                    authorize! :converse, @current_project
                    @conversation = @current_project.conversations.new_by_user(current_user, params[:conversation])
                
                    if @conversation.save
                Severity: Minor
                Found in app/controllers/conversations_controller.rb - About 1 hr to fix

                  Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def create
                      logout_keeping_session!
                      @user = User.new(params[:user])
                  
                      @user.confirmed_user = ((@invitation && @invitation.email == @user.email) or
                  Severity: Minor
                  Found in app/controllers/users_controller.rb - About 1 hr to fix

                    Method render has 26 lines of code (exceeds 25 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 1 hr to fix

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

                        def loading_note_form(toggle,id=nil)
                          if toggle
                            page["note_form_loading#{"_#{id}" if id}"].show
                            page["note_submit#{"_#{id}" if id}"].hide
                          else
                      Severity: Major
                      Found in app/helpers/page_notes_helper.rb and 1 other location - About 1 hr to fix
                      app/helpers/page_dividers_helper.rb on lines 27..33

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

                      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 loading_divider_form(toggle,id=nil)
                          if toggle
                            page["divider_form_loading#{"_#{id}" if id}"].show
                            page["divider_submit#{"_#{id}" if id}"].hide
                          else
                      Severity: Major
                      Found in app/helpers/page_dividers_helper.rb and 1 other location - About 1 hr to fix
                      app/helpers/page_notes_helper.rb on lines 27..33

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

                      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

                            var csrf_param = $$('meta[name=csrf-param]').first(),
                                csrf_token = $$('meta[name=csrf-token]').first(),
                                serialized = Sortable.serialize('column_pages', {name: 'pages'});
                      Severity: Minor
                      Found in app/javascripts/pages.js and 1 other location - About 55 mins to fix
                      app/javascripts/pages.js on lines 34..36

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

                      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

                            if (csrf_param) {
                              var param = csrf_param.readAttribute('content'),
                                  token = csrf_token.readAttribute('content')
                              
                              serialized += '&' + param + '=' + token
                      Severity: Minor
                      Found in app/javascripts/pages.js and 1 other location - About 55 mins to fix
                      app/javascripts/pages.js on lines 38..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 54.

                      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

                              var csrf_param = $$('meta[name=csrf-param]').first(),
                                  csrf_token = $$('meta[name=csrf-token]').first(),
                                  serialized = Sortable.serialize('slots', {name: 'slots'});
                      Severity: Minor
                      Found in app/javascripts/pages.js and 1 other location - About 55 mins to fix
                      app/javascripts/pages.js on lines 286..288

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

                      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