Sha256: 6fd9090ca63d5fd451c094cb65956f7362affeb38d85354b65874f0d15044571

Contents?: true

Size: 391 Bytes

Versions: 3

Compression:

Stored size: 391 Bytes

Contents

require 'roodi/checks/check'

module Roodi
  module Checks
    class MethodNameCheck < Check
      def interesting_nodes
        [:defn]
      end

      def evaluate(node)
        pattern = /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/
        add_error "Method name \"#{node[1]}\" should match pattern #{pattern.inspect}" unless node[1].to_s =~ pattern
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roodi-0.5 lib/roodi/checks/method_name_check.rb
roodi-1.1.1 lib/roodi/checks/method_name_check.rb
roodi-1.2.0 lib/roodi/checks/method_name_check.rb