Showing 12 of 883 total issues
Class SnapshotService
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class SnapshotService < ApplicationService
# Constraints
TYPE_TOTAL = :total
TYPE_DAILY = :daily
Method github
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def github
auth = request.env['omniauth.auth']
@user = User.where(github_uid: auth.uid).first_or_initialize
github_user_service = GithubUserService.new(@user)
- Read upRead up
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 index
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def index
@levels = levels = User::CompletenessService::LEVELS.keys
@search_fields = SEARCH_FIELDS
query = User.order('id DESC')
- Read upRead up
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 sync
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def sync
raise "Project ##{@project.id} - #{@project.title} does not have a homepage to sync" unless @project.homepage.present?
params = {connection_timeout: 5, read_timeout: 3, retries: 0, download_images: false}
page = MetaInspector.new(@project.homepage, params) rescue nil
- Read upRead up
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 change
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
create_table :snapshots do |t|
t.date :date, null: false
# Total values
Method github
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def github
auth = request.env['omniauth.auth']
@user = User.where(github_uid: auth.uid).first_or_initialize
github_user_service = GithubUserService.new(@user)
Method index
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@levels = levels = User::CompletenessService::LEVELS.keys
@search_fields = SEARCH_FIELDS
query = User.order('id DESC')
Method set
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set(skills)
keys = skills.keys
skills = convert_from_arrays(skills) if keys.size == 2 && keys.include?(:name) && keys.include?(:mastery)
parsed = {}
- Read upRead up
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 change
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
add_column :users, :name, :string
add_column :users, :username, :string
add_column :users, :avatar, :string
add_column :users, :cover, :string
Method set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set(field, value)
field = field.to_sym
field = :socials if User::SOCIALS.key?(field)
return unless FIELDS.key? field
- Read upRead up
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 website_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.website_url(website, path, protocol = 'http')
return nil unless path.present?
return path if is_url(path)
return url(path, protocol) if !website.present? || path.include?(extract(website))
- Read upRead up
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_domain
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_domain
old_domain = @user.domain
new_domain = user_params(:domain)[:domain]
if old_domain != new_domain
- Read upRead up
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"