fastladder/fastladder

View on GitHub

Showing 137 of 237 total issues

Function uniq has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    uniq : function(){
        var tmp = {};
        var len = this.length;
        for(var i=0;i<this.length;i++){
            if(tmp.hasOwnProperty(this[i])){
Severity: Minor
Found in app/assets/javascripts/lib/utils/common.js - 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

Avoid too many return statements within this function.
Open

    return false;
Severity: Major
Found in app/assets/javascripts/lib/events/hotkey.js - About 30 mins to fix

    Function check_wait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function check_wait(){
        if(app.config.use_wait != 1) return false;
        var st = check_wait.state;
        var key = Keybind.lastInput;
        // 初回
    Severity: Minor
    Found in app/assets/javascripts/lib/reader/main.js - 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

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

      def update
        sub = self.get_subscription
        updated = false
        if params[:rate] =~ /^[0-5]$/
          sub.rate = params[:rate].to_i
    Severity: Minor
    Found in app/controllers/api/feed_controller.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

    Function read_next_subs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        read_next_subs: function(){
            if(app.state.requested) return;
            var next = get_next();
            if(next){
                app.state.requested = true;
    Severity: Minor
    Found in app/assets/javascripts/lib/reader/commands.js - 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

    Function lastIndexOf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    Array.prototype.lastIndexOf = Array.prototype.lastIndexOf || function(searchElement,fromIndex){
        var max = this.length-1;
        var i = (fromIndex < 0)   ? Math.max(max+1 + fromIndex,0) :
                (fromIndex > max) ? max :
                max-(fromIndex||0) || max;
    Severity: Minor
    Found in app/assets/javascripts/lib/utils/array_extra.js - 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

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

        def crawl(feed)
          response = nil
          result = {
            message: '',
            error: false,
    Severity: Minor
    Found in lib/fastladder/crawler.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

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

        def fixup_relative_links(feed, body)
          doc = Nokogiri::HTML.fragment(body)
          links = doc.css('a[href]')
          if links.empty?
            body
    Severity: Minor
    Found in lib/fastladder/fastladder_crawler.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

    Function clone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      clone: function(source, target) {
        var options = Object.extend({
          setLeft:    true,
          setTop:     true,
          setWidth:   true,
    Severity: Minor
    Found in app/assets/javascripts/lib/utils/common.js - 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

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

      def index
        url = url_from_path(:url) unless params[:url].blank?
        @feed = Feed.find_by(feedlink: url) unless url.blank?
        unless @feed.nil?
          @is_feedlink = true
    Severity: Minor
    Found in app/controllers/about_controller.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

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

      def url_from_path(name)
        if (url = params[name]).present?
          if not (parsed_url = Addressable::URI.parse(url)).is_a? Addressable::URI or parsed_url.host.nil?
            url = nil
          end
    Severity: Minor
    Found in app/controllers/application_controller.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

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

        def fixup_relative_links(feed, body)
          doc = Nokogiri::HTML.fragment(body)
          links = doc.css('a[href]')
          if links.empty?
            body
    Severity: Minor
    Found in lib/fastladder/crawler.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

    Function findParent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    QueryCSS.findParent = function(rule,element){
        elememt = _$(element);
        if(!isFunction(rule)){
            rule = rule.isQueryCSS ? rule : new QueryCSS(rule).match;
        }
    Severity: Minor
    Found in app/assets/javascripts/lib/reader/main.js - 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

    Function offsetParent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      offsetParent: function(element) {
        if (element.offsetParent) return element.offsetParent;
        if (element == document.body) return element;
    
        while ((element = element.parentNode) && element != document.body)
    Severity: Minor
    Found in app/assets/javascripts/lib/utils/common.js - 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

    Function foreach has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function foreach(a,f){
        var c = 0;
        var len = a.length;
        var i = len % 8;
        if (i>0) do {
    Severity: Minor
    Found in app/assets/javascripts/lib/utils/common.js - 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

    Function positionedOffset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      positionedOffset: function(element) {
        var valueT = 0, valueL = 0;
        do {
          valueT += element.offsetTop  || 0;
          valueL += element.offsetLeft || 0;
    Severity: Minor
    Found in app/assets/javascripts/lib/utils/common.js - 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

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

        def crawl(feed)
          response = nil
          result = {
            message: '',
            error: false,
    Severity: Minor
    Found in lib/fastladder/fastladder_crawler.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