soramugi/twordtag

View on GitHub

Showing 4 of 4 total issues

Method tweets has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def tweets date = nil
    start_date = date || yesterday
    end_date   = start_date + 1
    is_retry   = true
    tweet_id   = nil
Severity: Minor
Found in app/models/user.rb - About 3 hrs 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 generate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate text
    nouns_word         = []
    ignore_not_include = '名詞'
    ignore_include     = '名詞,数'
    ignore_word        = 'http'
Severity: Minor
Found in app/models/tag.rb - 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

Method update_with_twitter_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update_with_twitter_status
    return unless provider == 'twitter'
    _image_url = client.user.profile_image_url.to_s
    _name      = client.user.screen_name
    if _image_url != image_url || _name != name
Severity: Minor
Found in app/models/user.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 create_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def create_tags date = nil
    date = date || yesterday
    raise 'Not provider twitter' unless provider == 'twitter'
    raise 'Created done' if TagLog.find_by_user_id_and_date(id, date)
    tags = []
Severity: Minor
Found in app/models/user.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

Severity
Category
Status
Source
Language