kigster/secrets-cipher-base64

View on GitHub

Showing 27 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
Severity: Major
Found in lib/sym/app/cli_slop.rb - About 3 hrs to fix

    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,
    Severity: Minor
    Found in lib/sym/app.rb - About 2 hrs 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

    Class Application has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Application
    
        attr_accessor :opts,
                      :opts_slop,
                      :args,
    Severity: Minor
    Found in lib/sym/application.rb - About 2 hrs to fix

      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)',
      Severity: Minor
      Found in lib/sym/app/commands/show_examples.rb - About 1 hr to fix

        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
        Severity: Minor
        Found in lib/sym/app/cli.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 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))
        Severity: Minor
        Found in lib/sym/app/commands/open_editor.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 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 = $?
        Severity: Minor
        Found in lib/sym/app/keychain.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 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
        Severity: Minor
        Found in lib/sym/app/cli.rb - About 1 hr to fix

          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|
          Severity: Minor
          Found in lib/sym/app/commands/bash_completion.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 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
          Severity: Minor
          Found in lib/sym/app/private_key/decryptor.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 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
          
          
          Severity: Minor
          Found in lib/sym/app/commands/base_command.rb - About 1 hr to fix

            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|
            Severity: Minor
            Found in lib/sym/app/commands/bash_completion.rb - About 1 hr to fix

              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
              Severity: Minor
              Found in lib/sym/app/commands/password_protect_key.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 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|
              Severity: Minor
              Found in lib/sym/app/commands/base_command.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 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
              Severity: Minor
              Found in lib/sym/app/private_key/detector.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 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
              Severity: Minor
              Found in lib/sym/application.rb - About 45 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 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
              Severity: Minor
              Found in lib/sym/app/private_key/handler.rb - About 45 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 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?
              Severity: Minor
              Found in lib/sym/app/password/cache.rb - About 45 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 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|
              Severity: Minor
              Found in lib/sym/application.rb - About 45 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 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
              Severity: Minor
              Found in lib/sym/extensions/with_retry.rb - About 45 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