kymmt90/hatenablog

View on GitHub

Showing 7 of 7 total issues

Class Client has 22 methods (exceeds 20 allowed). Consider refactoring.
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
Severity: Minor
Found in lib/hatenablog/client.rb - About 2 hrs to fix

    Method build_xml has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.build_xml(uri, edit_uri, author_name, title, content, draft, categories, updated)
    Severity: Major
    Found in lib/hatenablog/entry.rb - About 1 hr to fix

      Method build_xml has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      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')
      Severity: Minor
      Found in lib/hatenablog/entry.rb - About 55 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

      Method entry_xml has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def entry_xml(title = '', content = '', categories = [], draft = 'no', updated = '', author_name = @user_id)
      Severity: Minor
      Found in lib/hatenablog/client.rb - About 45 mins to fix

        Method update_entry has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def update_entry(entry_id, title = '', content = '', categories = [], draft = 'no', updated = '')
        Severity: Minor
        Found in lib/hatenablog/client.rb - About 45 mins to fix

          Method post_entry has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def post_entry(title = '', content = '', categories = [], draft = 'no', updated = '')
          Severity: Minor
          Found in lib/hatenablog/client.rb - About 35 mins to fix

            Method update_xml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            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
            Severity: Minor
            Found in lib/hatenablog/entry.rb - About 35 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

            Severity
            Category
            Status
            Source
            Language