homebrew-core/Formula/pyright.rb

31 lines
954 B
Ruby

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.275.tgz"
sha256 "cb1904c8fcc78fc76b549842b0ae66355489c83239149270311c8f0232234bcc"
license "MIT"
head "https://github.com/microsoft/pyright.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, all: "8c14f333d0fc31866c71a7db7fa6e2b6ee92bb88b2cb587cc9b8039c5355b59f"
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