require "language/node" class Pyright < Formula desc "Static type checker for Python" homepage "https://github.com/microsoft/pyright" url "https://registry.npmjs.org/pyright/-/pyright-1.1.182.tgz" sha256 "b1f3ac1a6607b2be69408da63eec14b832c08a3b9431c25683cfcf93fe68d836" license "MIT" head "https://github.com/microsoft/pyright.git", branch: "main" bottle do sha256 cellar: :any_skip_relocation, all: "77d965c46143287deddacc8c5d46011c1636a81b9bf1a729a61bbceadc38e49e" end depends_on "node" def install system "npm", "install", *Language::Node.std_npm_install_args(libexec) bin.install_symlink Dir["#{libexec}/bin/*"] end test do (testpath/"broken.py").write <<~EOS def wrong_types(a: int, b: int) -> str: return a + b EOS output = pipe_output("#{bin}/pyright broken.py 2>&1") assert_match 'error: Expression of type "int" cannot be assigned to return type "str"', output end end