stringer-rss/stringer

View on GitHub

Showing 7 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

    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

    Severity
    Category
    Status
    Source
    Language