fastladder/fastladder

View on GitHub
app/assets/javascripts/lib/reader/addon.js

Summary

Maintainability
F
5 days
Test Coverage

File addon.js has 910 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// print_ads
LDR.register_hook('BEFORE_PRINTFEED', function(feed){
    print_ads(feed.ads);
});

Severity: Major
Found in app/assets/javascripts/lib/reader/addon.js - About 2 days to fix

    `` has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    ListView.extend({
        element_id: "listview_items",
        element_class: "listview",
        get_item_by_id: function(id){
            if(this.item_index[id]){
    Severity: Minor
    Found in app/assets/javascripts/lib/reader/addon.js - About 3 hrs to fix

      Function Set has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Set(a){
          if(a.isSet) return a;
          var self;
          var index = {};
          self = [];
      Severity: Major
      Found in app/assets/javascripts/lib/reader/addon.js - About 3 hrs to fix

        Function toggle_clip has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function toggle_clip(id){
            var body = _$("item_body_"+id);
            var param = get_item_info(id);
            var rate = subs_item(get_active_feed().subscribe_id).rate;
            function fetch_clip(url,callback){
        Severity: Major
        Found in app/assets/javascripts/lib/reader/addon.js - About 2 hrs to fix

          Function instant_clip has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Control.instant_clip = function(){
              var item = get_active_item(true);
              if(!item) return;
              // copy rate
              var rate = subs_item(get_active_feed().subscribe_id).rate;
          Severity: Minor
          Found in app/assets/javascripts/lib/reader/addon.js - About 1 hr to fix

            Function instant_clip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            Control.instant_clip = function(){
                var item = get_active_item(true);
                if(!item) return;
                // copy rate
                var rate = subs_item(get_active_feed().subscribe_id).rate;
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js - 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

            Function toRelativeDate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            Number.prototype.toRelativeDate = function(){
              var k = this > 0 ? this : -this;
              var u = "second";
              var vec = this >= 0 ? "ago" : "after";
              var st = 0;
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js - 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

            Function next_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                next_item: function(){
                    this.unfocus();
                    // roll
                    var self = this;
                    // 次のページをロード
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js - 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

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

                unselect: function(id){
                    if(id){
                        var item = this.get_item_by_id(id);
                        var item_element = _$(id);
                    } else if(this.selected_item){
            Severity: Major
            Found in app/assets/javascripts/lib/reader/addon.js and 1 other location - About 5 hrs to fix
            app/assets/javascripts/lib/reader/addon.js on lines 511..524

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

            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

                select: function(id){
                    if(id){
                        var item = this.get_item_by_id(id);
                        var item_element = _$(id);
                    } else if(this.selected_item){
            Severity: Major
            Found in app/assets/javascripts/lib/reader/addon.js and 1 other location - About 5 hrs to fix
            app/assets/javascripts/lib/reader/addon.js on lines 525..538

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

            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

                WheelDown.add('div', function(e){
                    if(now - last_wheel > ignore_msec){
                        Control.read_next_subs();
                        last_wheel = now - 0;
                    }
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/lib/reader/addon.js on lines 938..943

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

                WheelUp.add('div', function(e){
                    if(now - last_wheel > ignore_msec){
                        Control.read_prev_subs();
                        last_wheel = now - 0;
                    }
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/lib/reader/addon.js on lines 929..934

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

                            if(item){
                                self.offset++;
                                ul.shift();
                                ul.push(self.make_item_from(item), true)
                            }
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/lib/reader/addon.js on lines 589..593

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

                            if(item){
                                self.offset--;
                                ul.pop()
                                ul.unshift(self.make_item_from(item), true);
                            }
            Severity: Minor
            Found in app/assets/javascripts/lib/reader/addon.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/lib/reader/addon.js on lines 580..584

            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

            There are no issues that match your filters.

            Category
            Status