alain-andre/alain-andre-fr

View on GitHub

Showing 67 of 109 total issues

Function embedSWF has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

        embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, flashvarsObj, parObj, attObj, callbackFn) {
Severity: Major
Found in .themes/classic/source/javascripts/libs/swfobject-dynamic.js - About 1 hr to fix

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

        function testPlayerVersion() {
            var b = doc.getElementsByTagName("body")[0];
            var o = createElement(OBJECT);
            o.setAttribute("type", FLASH_MIME_TYPE);
            var t = b.appendChild(o);
    Severity: Minor
    Found in source/javascripts/libs/swfobject-dynamic.js - About 1 hr to fix

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

          def fill_url(site, page_or_post)
            url = REXML::Element.new "url"
      
            loc = fill_location(page_or_post)
            url.add_element(loc)
      Severity: Minor
      Found in plugins/sitemap_generator.rb - About 1 hr to fix

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

            function testPlayerVersion() {
                var b = doc.getElementsByTagName("body")[0];
                var o = createElement(OBJECT);
                o.setAttribute("type", FLASH_MIME_TYPE);
                var t = b.appendChild(o);
        Severity: Minor
        Found in .themes/classic/source/javascripts/libs/swfobject-dynamic.js - About 1 hr to fix

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

              def render(context)
                quote = paragraphize(super)
                author = "<strong>#{@by.strip}</strong>" if @by
                if @source
                  url = @source.match(/https?:\/\/(.+)/)[1].split('/')
          Severity: Minor
          Found in plugins/blockquote.rb - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

            var swfobject=function(){function s(a,b,d){var q,k=n(d);if(g.wk&&g.wk<312)return q;if(k){if(typeof a.id==l)a.id=d;if(g.ie&&g.win){var e="",c;for(c in a)if(a[c]!=Object.prototype[c])c.toLowerCase()=="data"?b.movie=a[c]:c.toLowerCase()=="styleclass"?e+=' class="'+a[c]+'"':c.toLowerCase()!="classid"&&(e+=" "+c+'="'+a[c]+'"');c="";for(var f in b)b[f]!=Object.prototype[f]&&(c+='<param name="'+f+'" value="'+b[f]+'" />');k.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+e+">"+c+
            "</object>";q=n(a.id)}else{f=i.createElement(o);f.setAttribute("type",m);for(var h in a)a[h]!=Object.prototype[h]&&(h.toLowerCase()=="styleclass"?f.setAttribute("class",a[h]):h.toLowerCase()!="classid"&&f.setAttribute(h,a[h]));for(e in b)b[e]!=Object.prototype[e]&&e.toLowerCase()!="movie"&&(a=f,c=e,h=b[e],d=i.createElement("param"),d.setAttribute("name",c),d.setAttribute("value",h),a.appendChild(d));k.parentNode.replaceChild(f,k);q=f}}return q}function n(a){var b=null;try{b=i.getElementById(a)}catch(d){}return b}
            Severity: Major
            Found in .themes/classic/source/javascripts/octopress.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

              var swfobject=function(){function s(a,b,d){var q,k=n(d);if(g.wk&&g.wk<312)return q;if(k){if(typeof a.id==l)a.id=d;if(g.ie&&g.win){var e="",c;for(c in a)if(a[c]!=Object.prototype[c])c.toLowerCase()=="data"?b.movie=a[c]:c.toLowerCase()=="styleclass"?e+=' class="'+a[c]+'"':c.toLowerCase()!="classid"&&(e+=" "+c+'="'+a[c]+'"');c="";for(var f in b)b[f]!=Object.prototype[f]&&(c+='<param name="'+f+'" value="'+b[f]+'" />');k.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+e+">"+c+
              "</object>";q=n(a.id)}else{f=i.createElement(o);f.setAttribute("type",m);for(var h in a)a[h]!=Object.prototype[h]&&(h.toLowerCase()=="styleclass"?f.setAttribute("class",a[h]):h.toLowerCase()!="classid"&&f.setAttribute(h,a[h]));for(e in b)b[e]!=Object.prototype[e]&&e.toLowerCase()!="movie"&&(a=f,c=e,h=b[e],d=i.createElement("param"),d.setAttribute("name",c),d.setAttribute("value",h),a.appendChild(d));k.parentNode.replaceChild(f,k);q=f}}return q}function n(a){var b=null;try{b=i.getElementById(a)}catch(d){}return b}
              Severity: Major
              Found in source/javascripts/octopress.js - About 1 hr to fix

                Method render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def render(context)
                      code_dir = (context.registers[:site].config['code_dir'].sub(/^\//,'') || 'downloads/code')
                      code_path = (Pathname.new(context.registers[:site].source) + code_dir).expand_path
                      file = code_path + @file
                
                
                Severity: Minor
                Found in plugins/include_code.rb - About 55 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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parse(tokens)
                      @nodelist ||= []
                      @nodelist.clear
                
                      while token = tokens.shift
                Severity: Minor
                Found in plugins/raw.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(tag_name, markup, tokens)
                      if /(?<fiddle>\w+\/?\d?)(?:\s+(?<sequence>[\w,]+))?(?:\s+(?<skin>\w+))?(?:\s+(?<height>\w+))?(?:\s+(?<width>\w+))?/ =~ markup
                        @fiddle   = fiddle
                        @sequence = (sequence unless sequence == 'default') || 'js,resources,html,css,result'
                        @skin     = (skin unless skin == 'default') || 'light'
                Severity: Minor
                Found in plugins/jsfiddle.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(config, page, all_posts, index_dir, pagination_dir, num_pages = nil)
                      @page = page
                      @per_page = config['paginate'].to_i
                      @page_dir = pagination_dir + 'page/'
                      @total_pages = num_pages || Pager.calculate_pages(all_posts, @per_page)
                Severity: Minor
                Found in plugins/pagination.rb - About 55 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 fill_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fill_url(site, page_or_post)
                      url = REXML::Element.new "url"
                
                      loc = fill_location(page_or_post)
                      url.add_element(loc)
                Severity: Minor
                Found in plugins/sitemap_generator.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(tag_name, markup, tokens)
                      attributes = ['class', 'src', 'width', 'height', 'title']
                
                      if markup =~ /(?<class>\S.*\s+)?(?<src>(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?<width>\d+))?(?:\s+(?<height>\d+))?(?<title>\s+.+)?/i
                        @img = attributes.reduce({}) { |img, attr| img[attr] = $~[attr].strip if $~[attr]; img }
                Severity: Minor
                Found in plugins/image_tag.rb - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def render(context)
                      includes_dir = File.join(context.registers[:site].source, '_includes')
                
                      if File.symlink?(includes_dir)
                        return "Includes directory '#{includes_dir}' cannot be a symlink"
                Severity: Minor
                Found in plugins/include_array.rb - About 55 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 prev_token_last_char =~ /\S/
                                t = "&#8217;"
                              else
                                t = "&#8216;"
                              end
                Severity: Major
                Found in plugins/rubypants.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                                              o.setAttribute("class", attObj[m]);
                                          }
                                          else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
                                              o.setAttribute(m, attObj[m]);
                  Severity: Major
                  Found in .themes/classic/source/javascripts/libs/swfobject-dynamic.js - About 45 mins to fix

                    Method get_gist_from_web has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_gist_from_web(gist, file)
                          gist_url = get_gist_url_for(gist, file)
                          data     = get_web_content(gist_url)
                    
                          locations = Array.new
                    Severity: Minor
                    Found in plugins/gist_tag.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 (i.toLowerCase() == "data") {
                                                parObj.movie = attObj[i];
                                            }
                                            else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                                                att += ' class="' + attObj[i] + '"';
                    Severity: Major
                    Found in source/javascripts/libs/swfobject-dynamic.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                                                  o.setAttribute("class", attObj[m]);
                                              }
                                              else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
                                                  o.setAttribute(m, attObj[m]);
                      Severity: Major
                      Found in source/javascripts/libs/swfobject-dynamic.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (i.toLowerCase() == "data") {
                                                    parObj.movie = attObj[i];
                                                }
                                                else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                                                    att += ' class="' + attObj[i] + '"';
                        Severity: Major
                        Found in .themes/classic/source/javascripts/libs/swfobject-dynamic.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language