hackedteam/core-macos

View on GitHub

Showing 5 of 5 total issues

File rcs-core.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'net/http'
require 'json'
require 'open-uri'
require 'pp'
require 'cgi'
Severity: Minor
Found in core/tools/rcs-core.rb - About 2 hrs to fix

    Method run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.run(options)
    
        begin
          c = CoreDeveloper.new
          c.name = options[:name]
    Severity: Minor
    Found in core/tools/rcs-core.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 retrieve_factory has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def retrieve_factory(ident, show, jsonfile)
        raise("you must specify a factory") if ident.nil?
    
        resp = @http.request_get('/factory', {'Cookie' => @cookie})
        resp.kind_of? Net::HTTPSuccess or raise(resp.body)
    Severity: Minor
    Found in core/tools/rcs-core.rb - About 1 hr to fix

      Method build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def build(param_file)
          jcontent = File.open(param_file, 'r') {|f| f.read}
          params = JSON.parse(jcontent)
      
          raise("factory not found") if factory.nil?
      Severity: Minor
      Found in core/tools/rcs-core.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 login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def login(host, port, user, pass)
          @host = host || '127.0.0.1'
          @port = port || 443
          @http = Net::HTTP.new(@host, @port)
          @http.use_ssl = true
      Severity: Minor
      Found in core/tools/rcs-core.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