Showing 7 of 7 total issues
Method download_manga
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def download_manga(illust, pattern, &block)
action = DownloadActionRegistry.new(&block)
illust.original_image_urls.each_with_index do |url, n|
begin
action.before_each.call(url, n) if action.before_each
- 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 init
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def init
id = ENV['PIXIV_ID'] or warn 'PIXIV_ID is not set'
password = ENV['PIXIV_PASSWORD'] or warn 'PIXIV_PASSWORD is not set'
abort unless id && password
- 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 init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init
id = ENV['PIXIV_ID'] or warn 'PIXIV_ID is not set'
password = ENV['PIXIV_PASSWORD'] or warn 'PIXIV_PASSWORD is not set'
abort unless id && password
Method each_slice
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def each_slice(n = nil)
if n
super
else
if block_given?
- 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 filename_from_pattern
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def filename_from_pattern(pattern, illust, url)
pattern.map {|i|
if i == :image_name
name = File.basename(url)
if name =~ /\.(\w+)\?\d+$/
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
if args.size < 2
@agent = args.first || self.class.new_agent
yield @agent if block_given?
ensure_logged_in
- 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 login
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def login(pixiv_id, password)
doc = agent.get("https://accounts.pixiv.net/login?lang=ja&source=pc&view_type=page")
return if doc && doc.body =~ /logout/
form = doc.forms_with(action: '/login').first
puts doc.body and raise Error::LoginFailed, 'login form is not available' unless form
- 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"