Showing 7 of 7 total issues
Class Client
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Client
DEFAULT_CONFIG_PATH = './config.yml'.freeze
COLLECTION_URI = "https://blog.hatena.ne.jp/%s/%s/atom/entry".freeze
MEMBER_URI = "https://blog.hatena.ne.jp/%s/%s/atom/entry/%s".freeze
Method build_xml
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.build_xml(uri, edit_uri, author_name, title, content, draft, categories, updated)
Method build_xml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.build_xml(uri, edit_uri, author_name, title, content, draft, categories, updated)
builder = Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml|
xml.entry('xmlns' => 'http://www.w3.org/2005/Atom',
'xmlns:app' => 'http://www.w3.org/2007/app') do
xml.link(href: edit_uri, rel: 'edit')
- 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 entry_xml
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def entry_xml(title = '', content = '', categories = [], draft = 'no', updated = '', author_name = @user_id)
Method update_entry
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def update_entry(entry_id, title = '', content = '', categories = [], draft = 'no', updated = '')
Method post_entry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def post_entry(title = '', content = '', categories = [], draft = 'no', updated = '')
Method update_xml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_xml
@document.at_css('author name').content = @author_name
@document.at_css('title').content = @title
@document.at_css('link[@rel="alternate"]')['href'] = @uri
@document.at_css('link[@rel="edit"]')['href'] = @edit_uri
- 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"