Showing 31 of 31 total issues
Method parse
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(arguments)
Slop.parse(arguments) do |o|
o.banner = "Sym (#{Sym::VERSION}) – encrypt/decrypt data with a private key\n".bold.white
o.separator 'Usage:'.yellow
Method error
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.error(config: {},
exception: nil,
type: nil,
details: nil,
reason: nil,
- 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
Class Application
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Application
attr_accessor :opts,
:opts_slop,
:args,
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
output = []
output << example(comment: 'generate a new private key into an environment variable:',
command: 'export mykey=$(sym -g)',
Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = nil)
self.args = argv
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
- 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 process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process(code)
if code == true
content_edited = File.read(tempfile.path)
md5 = ::Base64.encode64(Digest::MD5.new.digest(content))
md5_edited = ::Base64.encode64(Digest::MD5.new.digest(content_edited))
- 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 execute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def execute(command)
command += ' 2>/dev/null' if stderr_disabled
puts "> #{command.yellow}" if opts[:verbose]
output = `#{command}`
result = $?
- 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 initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = nil)
self.args = argv
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
Method execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute
file = opts[:bash_support]
out = ''
Sym::Constants.config.each_pair do |key, config|
- 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 key
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def key
return nil if encrypted_key.nil?
decrypted_key = nil
if should_decrypt?
begin
- 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 inherited
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.inherited(klass)
klass.instance_eval do
class << self
attr_accessor :required, :incompatible
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
file = opts[:bash_support]
out = ''
Sym::Constants.config.each_pair do |key, config|
Method execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute
retries ||= 0
raise Sym::Errors::NoPrivateKeyFound.new("Unable to resolve private key from argument '#{opts[:key]}'") if self.key.nil?
the_key = self.key
- 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 options_satisfied_by?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def options_satisfied_by?(opts_hash)
proc = required_options.find { |option| option.is_a?(Proc) }
return true if proc && proc.call(opts_hash)
return false if incompatible_options.any? { |option| opts_hash[option] }
required_options.to_a.delete_if { |o| o.is_a?(Proc) }.all? { |o|
- 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 read!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def read!
KeySourceCheck::CHECKS.each do |source_check|
next unless result = source_check.detect(self) rescue nil
if key_ = normalize_key(result.key)
key_source_ = result.to_s
- 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 execute!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute!
initialize_key_source
unless command
raise Sym::Errors::InsufficientOptionsError,
" Can not determine what to do
- 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 detect_key
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def detect_key
begin
reader = Detector.new(opts, input_handler, password_cache)
key = reader.key
key_source = reader.key_source
- 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 operation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def operation
return nil unless self.enabled
with_timeout(1) do
with_retry do
yield if block_given?
- 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 provided_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def provided_options(**opts)
provided_opts = self.opts.clone
provided_opts.delete_if { |k, v| !v }
if opts[:safe]
provided_options.map do |k, v|
- 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 with_retry
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def with_retry(retries: 3, fail_block: nil)
attempts = 0
yield if block_given?
rescue StandardError => e
raise(e) if attempts >= retries
- 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"