Sha256: f733890d2cd632723c3a7d5982bbb6b9e0e5b364a482c7e2fa52166d85a6b10a

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

module Codesake
  module Utils
    module Secrets
      DEFAULT_SECRETS = ["secret", "password", "username", "login", "xxx", "fixme", "fix", "todo", "passwd"]
      attr_accessor :secrets
      attr_accessor :reserved_keywords

      def initialize
        load_secrets
      end

      def load_secrets
        @secrets = DEFAULT_SECRETS
      end

      def add(word)
        @secrets << word
        @secrets
      end

      def reserved?(word)
        @secrets.include?(word)
      end

      def find_reserved_keywords

        ret = []

        @file_content.each_with_index do |l, i|
          l = l.unpack("C*").pack("U*")
          l.split.each do |tok|
            # ret << {:line=> i+1, :matcher=>tok, :source_line=>l} if @secrets.include?(tok.downcase)
            ret << {:line=> i+1, :matcher=>tok } if @secrets.include?(tok.downcase)

          end
        end

        ret
      end



    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codesake-0.15.1 lib/codesake/utils/secrets.rb