swanson/stringer

View on GitHub

Showing 6 of 16 total issues

File application.js has 275 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

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

      def new_stories
        stories = []
    
        @raw_feed.entries.each do |story|
          break if @latest_entry_id && story.id == @latest_entry_id
    Severity: Minor
    Found in app/commands/feeds/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 7 (exceeds 5 allowed). Consider refactoring.
    Open

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

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

      def fetch
        raw_feed = fetch_raw_feed
    
        if raw_feed == 304
          feed_not_modified
    Severity: Minor
    Found in app/tasks/fetch_feed.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 import has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def import(opml_contents)
          feeds_with_groups = OpmlParser.new.parse_feeds(opml_contents)
    
          # It considers a situation when feeds are already imported without groups,
          # so it's possible to re-import the same subscriptions.xml just to set group_id
    Severity: Minor
    Found in app/commands/feeds/import_from_opml.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