transmission-rails/transmission-rpc-ruby

View on GitHub

Showing 5 of 9 total issues

Class Torrent has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Torrent
      class TorrentError < StandardError; end
      class TorrentNotFoundError < StandardError; end
      class MissingAttributesError < StandardError; end
      class DuplicateTorrentError < StandardError; end
Severity: Minor
Found in lib/transmission/model/torrent.rb - About 2 hrs to fix

    Class RPC has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class RPC
    
        attr_accessor :session, :connector
    
        def initialize(options = {})
    Severity: Minor
    Found in lib/transmission/rpc.rb - About 2 hrs to fix

      Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(torrent_object, connector)
              if torrent_object.is_a? Array
                is_single = torrent_object.size == 1
                @attributes = is_single ? torrent_object.first : {}
                @ids = is_single ? [@attributes['id'].to_i] : []
      Severity: Minor
      Found in lib/transmission/model/torrent.rb - About 1 hr 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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def method_missing(symbol, *args)
              string = symbol.to_s
              if string[-1] == '='
                string = string[0..-2]
                key = Transmission::Arguments::TorrentSet.real_key string
      Severity: Minor
      Found in lib/transmission/model/torrent.rb - About 25 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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def method_missing(symbol, *args)
              string = symbol.to_s
              if string[-1] == '='
                string = string[0..-2]
                key = Transmission::Arguments::SessionSet.real_key string
      Severity: Minor
      Found in lib/transmission/model/session.rb - About 25 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