Sha256: a78f39e41e668b2e262bf93c182b0da624cc533826de314f1fdabbb1d4a97c9c

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

require 'pre-commit/utils'

module PreCommit
  class RubySymbolHashrockets
    HASHROCKET_PATTERN = '[^:](:{1}(?:\$|@|@@|[_A-Za-z])?\w*[=!?]?\s*=>\s*)'

    def self.call(staged_files)
      return if staged_files.empty?
      lines = `#{Utils.grep} '#{HASHROCKET_PATTERN}' #{staged_files.join(" ")}`.strip
      return unless $?.success?
      "detected :symbol => value hashrocket:\n#{lines}"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pre-commit-0.11.0 lib/pre-commit/checks/ruby_symbol_hashrockets.rb
pre-commit-0.10.0 lib/pre-commit/checks/ruby_symbol_hashrockets.rb
pre-commit-0.9.2 lib/pre-commit/checks/ruby_symbol_hashrockets.rb
pre-commit-0.9.1 lib/pre-commit/checks/ruby_symbol_hashrockets.rb
pre-commit-0.9.0 lib/pre-commit/checks/ruby_symbol_hashrockets.rb