class PhpExpectationsHook

Constants

SEPARATOR

Public Instance Methods

default_smell_exceptions() click to toggle source
# File lib/expectations_hook.rb, line 31
def default_smell_exceptions
  LOGIC_SMELLS + FUNCTIONAL_SMELLS + OBJECT_ORIENTED_SMELLS
end
domain_language() click to toggle source
# File lib/expectations_hook.rb, line 35
def domain_language
  {
    minimumIdentifierSize: 3,
    jargon: []
  }
end
language() click to toggle source
# File lib/expectations_hook.rb, line 8
def language
  'Mulang'
end
mulang_code(request) click to toggle source
# File lib/expectations_hook.rb, line 12
def mulang_code(request)
  result = request.result[:ast]

  Mulang::Code.new(mulang_language, to_mulang_ast(result))
end
to_mulang_ast(output) click to toggle source
# File lib/expectations_hook.rb, line 18
def to_mulang_ast(output)
  unless output.include? SEPARATOR
    return ['Unable to get Mulang AST - Command failed!', :errored]
  end

  json = output.split(SEPARATOR).last
  ast = JSON.parse json, symbolize_names: true

  Mulang::PHP.parse(ast)
rescue => e
  raise Mumukit::CompilationError, e
end