stringer-rss/stringer

View on GitHub

Showing 13 of 13 total issues

File application.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//= require jquery-min.js
//= require bootstrap-min.js
//= require bootstrap.file-input.js
//= require mousetrap-min.js
//= require jquery-visible-min.js
Severity: Minor
Found in app/assets/javascripts/application.js - About 2 hrs to fix

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

      toggleCurrentKeepUnread: function() {
        if (this.cursorPosition < 0) this.cursorPosition = 0;
        this.at(this.cursorPosition).toggleKeepUnread();
      },
    Severity: Major
    Found in app/assets/javascripts/application.js and 3 other locations - About 1 hr to fix
    app/assets/javascripts/application.js on lines 251..254
    app/assets/javascripts/application.js on lines 256..259
    app/assets/javascripts/application.js on lines 266..269

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

    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

      viewCurrentInTab: function() {
        if (this.cursorPosition < 0) this.cursorPosition = 0;
        this.at(this.cursorPosition).openInTab();
      },
    Severity: Major
    Found in app/assets/javascripts/application.js and 3 other locations - About 1 hr to fix
    app/assets/javascripts/application.js on lines 251..254
    app/assets/javascripts/application.js on lines 261..264
    app/assets/javascripts/application.js on lines 266..269

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

    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

      toggleCurrent: function() {
        if (this.cursorPosition < 0) this.cursorPosition = 0;
        this.at(this.cursorPosition).toggle();
      },
    Severity: Major
    Found in app/assets/javascripts/application.js and 3 other locations - About 1 hr to fix
    app/assets/javascripts/application.js on lines 256..259
    app/assets/javascripts/application.js on lines 261..264
    app/assets/javascripts/application.js on lines 266..269

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

    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

      toggleCurrentStarred: function() {
        if (this.cursorPosition < 0) this.cursorPosition = 0;
        this.at(this.cursorPosition).toggleStarred();
      }
    Severity: Major
    Found in app/assets/javascripts/application.js and 3 other locations - About 1 hr to fix
    app/assets/javascripts/application.js on lines 251..254
    app/assets/javascripts/application.js on lines 256..259
    app/assets/javascripts/application.js on lines 261..264

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

    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 storyClicked has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      storyClicked: function(e) {
        if (e.metaKey || e.ctrlKey || e.which == 2) {
          var backgroundTab = window.open(this.model.get("permalink"));
          if (backgroundTab) backgroundTab.blur();
          window.focus();
    Severity: Minor
    Found in app/assets/javascripts/application.js - 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 call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.call(raw_feed, feed_id, latest_entry_id = nil)
        stories = []
    
        raw_feed.entries.each do |story|
          break if latest_entry_id && story.id == latest_entry_id
    Severity: Minor
    Found in app/commands/feed/find_new_stories.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

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

      def expand_absolute_urls(content, base_url)
        doc = Nokogiri::HTML.fragment(content)
    
        [["a", "href"], ["img", "src"], ["video", "src"]].each do |tag, attr|
          doc.css("#{tag}[#{attr}]").each do |node|
    Severity: Minor
    Found in app/helpers/url_helpers.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

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

      def self.boolean_accessor(attribute, key, default: false)
        store_accessor(attribute, key)
    
        define_method(key) do
          value = super()
    Severity: Minor
    Found in app/models/application_record.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 update_api_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_api_key
        return unless password_digest_changed? || username_changed?
    
        if password_challenge.blank? && password.blank?
          message = "Cannot change username without providing a password"
    Severity: Minor
    Found in app/models/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

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

      def create
        authorization.skip
        @feed_url = params[:feed_url]
        feed = Feed::Create.call(@feed_url, user: current_user)
    
    
    Severity: Minor
    Found in app/controllers/feeds_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

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

      def self.call(authorization:, **params)
        if params[:mark] == "group"
          authorization.check(Group.find(params[:id]))
          MarkGroupAsRead.call(params[:id], params[:before])
        end
    Severity: Minor
    Found in app/commands/fever_api/write_mark_group.rb and 1 other location - About 20 mins to fix
    app/commands/fever_api/write_mark_feed.rb on lines 4..10

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

    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

      def self.call(authorization:, **params)
        if params[:mark] == "feed"
          authorization.check(Feed.find(params[:id]))
          MarkFeedAsRead.call(params[:id], params[:before])
        end
    Severity: Minor
    Found in app/commands/fever_api/write_mark_feed.rb and 1 other location - About 20 mins to fix
    app/commands/fever_api/write_mark_group.rb on lines 4..10

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

    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