woese/guara-crm

View on GitHub

Showing 101 of 101 total issues

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

  def create
    #@business_activity = BusinessActivity.new(params[:business_activity])

    respond_to do |format|
      if @business_activity.save
Severity: Major
Found in app/controllers/business_activities_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/business_departments_controller.rb on lines 47..56
app/controllers/business_segments_controller.rb on lines 47..56
app/controllers/company_businesses_controller.rb on lines 8..16

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

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

  def create
    #@business_department = BusinessDepartment.new(params[:business_department])

    respond_to do |format|
      if @business_department.save
Severity: Major
Found in app/controllers/business_departments_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/business_activities_controller.rb on lines 46..55
app/controllers/business_segments_controller.rb on lines 47..56
app/controllers/company_businesses_controller.rb on lines 8..16

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

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

                minMax  = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
Severity: Major
Found in app/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 55 mins to fix
app/assets/javascripts/jquery-ui-timepicker-addon.js on lines 756..756
app/assets/javascripts/jquery-ui-timepicker-addon.js on lines 758..758
app/assets/javascripts/jquery-ui-timepicker-addon.js on lines 759..759

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

                secMax  = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
Severity: Major
Found in app/assets/javascripts/jquery-ui-timepicker-addon.js and 3 other locations - About 55 mins to fix
app/assets/javascripts/jquery-ui-timepicker-addon.js on lines 756..756
app/assets/javascripts/jquery-ui-timepicker-addon.js on lines 757..757
app/assets/javascripts/jquery-ui-timepicker-addon.js on lines 759..759

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

  def create
    #@business_segment = BusinessSegment.new(params[:business_segment])

    respond_to do |format|
      if @business_segment.save
Severity: Major
Found in app/controllers/business_segments_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/business_activities_controller.rb on lines 46..55
app/controllers/business_departments_controller.rb on lines 47..56
app/controllers/company_businesses_controller.rb on lines 8..16

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

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

  def update
    #@business_segment = BusinessSegment.find(params[:id])

    respond_to do |format|
      if @business_segment.update_attributes(params[:business_segment])
Severity: Major
Found in app/controllers/business_segments_controller.rb and 2 other locations - About 50 mins to fix
app/controllers/business_activities_controller.rb on lines 62..71
app/controllers/company_businesses_controller.rb on lines 23..31

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

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

  def update

    respond_to do |format|
      if @company_business.update_attributes(params[:company_business])
        format.html { redirect_to @company_business, notice: 'Company business was successfully updated.' }
Severity: Major
Found in app/controllers/company_businesses_controller.rb and 2 other locations - About 50 mins to fix
app/controllers/business_activities_controller.rb on lines 62..71
app/controllers/business_segments_controller.rb on lines 63..72

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

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

  def update
    #@business_activity = BusinessActivity.find(params[:id])

    respond_to do |format|
      if @business_activity.update_attributes(params[:business_activity])
Severity: Major
Found in app/controllers/business_activities_controller.rb and 2 other locations - About 50 mins to fix
app/controllers/business_segments_controller.rb on lines 63..72
app/controllers/company_businesses_controller.rb on lines 23..31

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

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

Avoid deeply nested control flow statements.
Open

                        if(this.millisec > this._defaults.millisecMax) this.millisec = this._defaults.millisecMax;
Severity: Major
Found in app/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (h == 0) tmph = 12 +'a';
                            else if (h < 12) tmph += 'a';
                            else tmph += 'p';
    Severity: Major
    Found in app/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if(this.millisec < this._defaults.millisecMin)
                                  this.millisec = this._defaults.millisecMin;
      Severity: Major
      Found in app/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

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

                        'set': function(id, val) {
                            var data = element.data("jsoncache");
                            data[id] = val;
                            element.data("jsoncache", data)
                        },
        Severity: Minor
        Found in app/assets/javascripts/fcbk.js and 1 other location - About 45 mins to fix
        app/assets/javascripts/fcbk.js on lines 522..526

        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

        Avoid deeply nested control flow statements.
        Open

                                    } else if (aph == 12) h = 12;
                                    else h = aph + 12;
        Severity: Major
        Found in app/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

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

                          'set': function(id, val) {
                              var data = element.data("cache");
                              data[id] = val;
                              element.data("cache", data)
                          },
          Severity: Minor
          Found in app/assets/javascripts/fcbk.js and 1 other location - About 45 mins to fix
          app/assets/javascripts/fcbk.js on lines 468..472

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

            def self.search_by_params(results=nil, query)
              
              results = self.send(:relation) if results.nil?
              where = {}
              
          Severity: Minor
          Found in app/models/contact.rb - About 45 mins 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 migrate! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def migrate!
              
                raise "schema_from needs" if @schema_from.nil?
                raise "schema_to needs" if @schema_to.nil?
                
          Severity: Minor
          Found in lib/active_migration/migration.rb - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                                          if (aph == 12) h = 0;
                                          else h = aph;
          Severity: Major
          Found in app/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

            Consider simplifying this complex logical expression.
            Open

                  unless (!record.complete? && ((value == "") || (value == '0'*14) || (Cnpj.new(value).valido?))) || 
                         (Cnpj.new(value).valido?)
                    record.errors[attribute] << (options[:message] || ("%s %s" % [I18n.t("customer_pjs.doc"), I18n.t('errors.messages.invalid')]) )
                  end
            Severity: Major
            Found in app/validators/customer_cnpj_validator.rb - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                                      if ((_key.exclamation <= charcode && charcode <= _key.slash) || (_key.colon <= charcode && charcode <= _key.at) || (_key.squarebricket_left <= charcode && charcode <= _key.apostrof)) {
                                          string = string.replace(string[i], escape(string[i]))
                                      }
              Severity: Major
              Found in app/assets/javascripts/fcbk.js - About 40 mins to fix

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

                                'get': function(id) {
                                    return element.data("jsoncache")[id] != 'undefined' ? element.data("jsoncache")[id] : null
                                },
                Severity: Minor
                Found in app/assets/javascripts/fcbk.js and 1 other location - About 40 mins to fix
                app/assets/javascripts/fcbk.js on lines 527..529

                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

                Severity
                Category
                Status
                Source
                Language