mashirozx/mastodon

View on GitHub
app/models/concerns/omniauthable.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method ensure_unique_username has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_unique_username(auth)
      username = auth.uid
      auth_provided_username = nil
      i        = 1
      force_use_number_suffix = false
Severity: Minor
Found in app/models/concerns/omniauthable.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 create_for_oauth has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def create_for_oauth(auth)
      Rails.logger.info "Creating user for #{auth.provider} identity"
      Rails.logger.info "  auth.info: #{auth.info.to_json}"
      Rails.logger.info "  auth.uid: #{auth.uid}"
      # Check if the user exists with provided email. If no email was provided,
Severity: Minor
Found in app/models/concerns/omniauthable.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 find_for_oauth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def find_for_oauth(auth, signed_in_resource = nil)
      # EOLE-SSO Patch
      auth.uid = (auth.uid[0][:uid] || auth.uid[0][:user]) if auth.uid.is_a? Hashie::Array
      identity = Identity.find_for_oauth(auth)

Severity: Minor
Found in app/models/concerns/omniauthable.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

There are no issues that match your filters.

Category
Status