matthucke/graveyards4

View on GitHub

Showing 84 of 84 total issues

Method find_graveyard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def find_graveyard county, graveyard_path
    g = lookup_graveyard(county, graveyard_path)
    return g if g

    if graveyard_path =~ /(.*)-Cemetery/
Severity: Minor
Found in app/controllers/legacy_controller.rb - About 35 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    # for debug, dump to file.
    dump_auth_hash unless Rails.env.production?

    if identity = Identity.from_omniauth(auth_hash)
Severity: Minor
Found in app/controllers/sessions_controller.rb - About 35 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 from_omniauth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.from_omniauth(auth)
    ident = where(attrs_from_omniauth(auth)).first_or_initialize do |ident|
      raise "#{ident.provider} user id cannot be empty" if ident.uid.to_s.blank?
      ident.provider_text = auth.to_yaml
      ident.save
Severity: Minor
Found in app/models/identity.rb - About 35 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

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

    HashNode: function(pairs, locInfo) {
      LocationInfo.call(this, locInfo);
      this.type = "hash";
      this.pairs = pairs;
    },
Severity: Major
Found in app/assets/javascripts/libs/handlebars-v1.3.0.js and 3 other locations - About 35 mins to fix
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 665..669
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 720..724
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 749..753

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

    DataNode: function(id, locInfo) {
      LocationInfo.call(this, locInfo);
      this.type = "DATA";
      this.id = id;
    },
Severity: Major
Found in app/assets/javascripts/libs/handlebars-v1.3.0.js and 3 other locations - About 35 mins to fix
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 665..669
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 671..675
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 749..753

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

    CommentNode: function(comment, locInfo) {
      LocationInfo.call(this, locInfo);
      this.type = "comment";
      this.comment = comment;
    }
Severity: Major
Found in app/assets/javascripts/libs/handlebars-v1.3.0.js and 3 other locations - About 35 mins to fix
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 665..669
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 671..675
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 720..724

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

    ContentNode: function(string, locInfo) {
      LocationInfo.call(this, locInfo);
      this.type = "content";
      this.string = string;
    },
Severity: Major
Found in app/assets/javascripts/libs/handlebars-v1.3.0.js and 3 other locations - About 35 mins to fix
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 671..675
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 720..724
app/assets/javascripts/libs/handlebars-v1.3.0.js on lines 749..753

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

Avoid too many return statements within this function.
Open

  case 30:yy_.yytext = strip(1,2); return 40;
Severity: Major
Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return fn(context);
    Severity: Major
    Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

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

            opt_options.handCursor = opt_options.handCursor || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
      Severity: Minor
      Found in app/assets/javascripts/maps/markerwithlabel.js and 1 other location - About 30 mins to fix
      app/assets/javascripts/maps/markerwithlabel.js on lines 554..554

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

      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 too many return statements within this method.
      Open

            return ''
      Severity: Major
      Found in app/models/user_factory/base.rb - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32;
        Severity: Major
        Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

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

                opt_options.crossImage = opt_options.crossImage || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
          Severity: Minor
          Found in app/assets/javascripts/maps/markerwithlabel.js and 1 other location - About 30 mins to fix
          app/assets/javascripts/maps/markerwithlabel.js on lines 555..555

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

          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 too many return statements within this function.
          Open

            case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32;
          Severity: Major
          Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return false;
            Severity: Major
            Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                            return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
                                    {text: "", token: null, line: this.yylineno});
              Severity: Major
              Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return true;
                Severity: Major
                Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    case 21:this.popState(); return 24;
                  Severity: Major
                  Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      case 22:this.popState(); return 18;
                    Severity: Major
                    Found in app/assets/javascripts/libs/handlebars-v1.3.0.js - About 30 mins to fix

                      Method load_current_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def load_current_user
                          ident = current_identity or return nil
                      
                          ident.user.tap do |u|
                            return nil unless u
                      Severity: Minor
                      Found in app/controllers/concerns/knows_current_user.rb - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language