michaelbaudino/addic7ed-ruby

View on GitHub

Showing 3 of 3 total issues

File common.rb has 1283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Addic7ed

  SHOWS_URL            = 'http://www.addic7ed.com/ajax_getShows.php'
  EPISODES_URL         = 'http://www.addic7ed.com/ajax_getEpisodes.php'
  EPISODE_REDIRECT_URL = 'http://www.addic7ed.com/re_episode.php'
Severity: Major
Found in lib/addic7ed/common.rb - About 3 days to fix

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

        def find_best_subtitle(lang, no_hi = false)
          @best_subtitle ||= {}
          subtitles(lang).each do |sub|
            @best_subtitle[lang] = sub if sub.works_for?(video_file.group, no_hi) and sub.can_replace? @best_subtitle[lang]
          end
    Severity: Minor
    Found in lib/addic7ed/episode.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 commented_as_compatible_with? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def commented_as_compatible_with?(other_version)
          return false if /(won't|doesn't|not) +work/i.match comment
          return false if /resync +(from|of)/i.match comment
          res   = comment.include? other_version.downcase
          res ||= comment.include? COMPATIBILITY_720P[other_version].downcase if COMPATIBILITY_720P[other_version]
    Severity: Minor
    Found in lib/addic7ed/subtitle.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