From bb6f207e0b45339913f20363b1cc264768f5c2e0 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 23 Nov 2022 22:35:21 -0500 Subject: [PATCH] Run: brew install --build-from-source --verbose --debug ruff File: /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/ruff.rb Docs: https://docs.brew.sh/Formula-Cookbook Test: brew test ruff --- ruff.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ruff.rb diff --git a/ruff.rb b/ruff.rb new file mode 100644 index 0000000000..7c19ecc781 --- /dev/null +++ b/ruff.rb @@ -0,0 +1,27 @@ +class Ruff < Formula + desc "An extremely fast Python linter, written in Rust." + homepage "https://github.com/charliermarsh/ruff" + url "https://github.com/charliermarsh/ruff/archive/refs/tags/v0.0.137.tar.gz" + sha256 "d5521f2ad9ee87ca8018bd23ea731fc05abd0fa4a01878880a8cc5119596f837" + license "MIT" + head "https://github.com/charliermarsh/ruff.git", branch: "main" + + # STOPSHIP(charlie): Requires Rust 1.65.0. + # See: https://github.com/Homebrew/homebrew-core/pull/116480 + depends_on "rust" => :build + + def install + system "cargo", "install", "--no-default-features", *std_cargo_args + bin.install "target/release/ruff" => "ruff" + end + + test do + (testpath/"test.py").write <<~EOS + import os + EOS + expected = <<~EOS + test.py:1:1: F401 `os` imported but unused + EOS + assert_equal expected, shell_output("#{bin}/ruff -- --quiet #{testpath}/test.py") + end +end