Showing 3 of 5 total issues
Method grab_page_screenshot_webkit2png
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def grab_page_screenshot_webkit2png(url)
# generate file names, knowing that webkit2png appends '-full' to the supplied string
tmp_filename = new_temporary_image_filename
screenshot_dir = File.dirname tmp_filename
screenshot_file_base = File.basename tmp_filename, '.png'
Method grab_page_screenshot_webkit2png
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def grab_page_screenshot_webkit2png(url)
# generate file names, knowing that webkit2png appends '-full' to the supplied string
tmp_filename = new_temporary_image_filename
screenshot_dir = File.dirname tmp_filename
screenshot_file_base = File.basename tmp_filename, '.png'
- 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 uniqueness_of_url_and_name_per_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def uniqueness_of_url_and_name_per_user
unless self.user.nil?
if self.user.endpoints.where(url: self.url).exists?
errors.add(:url, "must be unique")
end
- 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"