RocketFuelLeak/RocketFuelLeakSite

View on GitHub

Showing 43 of 43 total issues

File markdown.js has 1059 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Released under MIT license
// Copyright (c) 2009-2010 Dominic Baggott
// Copyright (c) 2009-2010 Ash Berlin
// Copyright (c) 2011 Christoph Dorn <christoph@christophdorn.com> (http://www.christophdorn.com)
// Date: 2013-09-15T16:12Z
Severity: Major
Found in app/assets/javascripts/markdown.js - About 2 days to fix

    Function lists has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          lists: (function( ) {
            // Use a closure to hide a few variables.
            var any_list = "[*+-]|\\d+\\.",
                bullet_list = /[*+-]/,
                // Capture leading indent as it matters for determining nested lists.
    Severity: Major
    Found in app/assets/javascripts/markdown.js - About 6 hrs to fix

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

          case "link_ref":
            jsonml[ 0 ] = "a";
      
            // grab this ref and clean up the attribute node
            var ref = references[ attrs.ref ];
      Severity: Major
      Found in app/assets/javascripts/markdown.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/markdown.js on lines 558..580

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

      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

          case "img_ref":
            jsonml[ 0 ] = "img";
      
            // grab this ref and clean up the attribute node
            var ref = references[ attrs.ref ];
      Severity: Major
      Found in app/assets/javascripts/markdown.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/markdown.js on lines 535..557

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

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

        function convert_tree_to_html( tree, references, options ) {
          var i;
          options = options || {};
      
          // shallow clone
      Severity: Major
      Found in app/assets/javascripts/markdown.js - About 3 hrs to fix

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

                  if ( m[2] && m[2][0] === "<" && m[2][m[2].length-1] === ">" )
                    m[2] = m[2].substring( 1, m[2].length - 1 );
        Severity: Major
        Found in app/assets/javascripts/markdown.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/markdown.js on lines 1113..1114

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

        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 ( m[2] && m[2][0] === "<" && m[2][m[2].length-1] === ">" )
                    m[2] = m[2].substring( 1, m[2].length - 1 );
        Severity: Major
        Found in app/assets/javascripts/markdown.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/markdown.js on lines 1218..1219

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

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

            def initialize(user)
                alias_action :post_connect, to: :connect
                alias_action :patch_confirm, to: :confirm
        
                # Note: 'archive' is to READ archives
        Severity: Major
        Found in app/models/ability.rb - About 2 hrs to fix

          Method initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(user)
                  alias_action :post_connect, to: :connect
                  alias_action :patch_confirm, to: :confirm
          
                  # Note: 'archive' is to READ archives
          Severity: Minor
          Found in app/models/ability.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 link has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                "[": function link( text ) {
          
                  var orig = String(text);
                  // Inline content is possible inside `link text`
                  var res = inline_until_char.call( this, text.substr(1), "]" );
          Severity: Major
          Found in app/assets/javascripts/markdown.js - About 2 hrs to fix

            Function table has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Maruku.block.table = function table ( block ) {
            
                var _split_on_unescaped = function( s, ch ) {
                  ch = ch || '\\s';
                  if ( ch.match(/^[\\|\[\]{}?*.+^$]$/) )
            Severity: Minor
            Found in app/assets/javascripts/markdown.js - About 1 hr to fix

              Method create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create
                      if session[:omniauth].present?
                          super
                          session[:omniauth] = nil unless @user.new_record?
                      else
              Severity: Minor
              Found in app/controllers/users/registrations_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

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

                      if ( m[0].length < block.length )
                        next.unshift( mk_block( block.substr( m[0].length ), block.trailing, block.lineNumber + 2 ) );
              Severity: Major
              Found in app/assets/javascripts/markdown.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/markdown.js on lines 694..695

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

              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 ( m[0].length < block.length )
                        next.unshift( mk_block( block.substr( m[0].length ), block.trailing, block.lineNumber + 2 ) );
              Severity: Major
              Found in app/assets/javascripts/markdown.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/markdown.js on lines 709..710

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

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

                function strong_em( tag, md ) {
              
                  var state_slot = tag + "_state",
                      other_slot = tag === "strong" ? "em_state" : "strong_state";
              
              
              Severity: Minor
              Found in app/assets/javascripts/markdown.js - About 1 hr to fix

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

                      blockquote: function blockquote( block, next ) {
                        if ( !block.match( /^>/m ) )
                          return undefined;
                
                        var jsonml = [];
                Severity: Minor
                Found in app/assets/javascripts/markdown.js - About 1 hr to fix

                  Function block_meta has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Maruku.block.block_meta = function block_meta( block ) {
                      // check if the last line of the block is an meta hash
                      var m = block.match( /(^|\n) {0,3}\{:\s*((?:\\\}|[^\}])*)\s*\}$/ );
                      if ( !m )
                        return undefined;
                  Severity: Minor
                  Found in app/assets/javascripts/markdown.js - About 1 hr to fix

                    Function caret has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    $.fn.caret = function (begin, end) {
                        if (this.length == 0)
                            return;
                        
                        if (typeof begin == 'number') {
                    Severity: Minor
                    Found in app/assets/javascripts/jquery_caret.js - About 1 hr to fix

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

                          def lock
                              authorize! :lock, @topic
                              @topic.lock
                              respond_to do |format|
                                  if @topic.save
                      Severity: Major
                      Found in app/controllers/forum/topics_controller.rb and 4 other locations - About 1 hr to fix
                      app/controllers/applications_controller.rb on lines 113..122
                      app/controllers/applications_controller.rb on lines 129..138
                      app/controllers/applications_controller.rb on lines 145..154
                      app/controllers/forum/topics_controller.rb on lines 94..103

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

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

                          def accept
                              authorize! :accept, @application
                              @application.accept
                              respond_to do |format|
                                  if @application.save
                      Severity: Major
                      Found in app/controllers/applications_controller.rb and 4 other locations - About 1 hr to fix
                      app/controllers/applications_controller.rb on lines 113..122
                      app/controllers/applications_controller.rb on lines 145..154
                      app/controllers/forum/topics_controller.rb on lines 78..87
                      app/controllers/forum/topics_controller.rb on lines 94..103

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

                      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