41 lines
1.2 KiB
Ruby
41 lines
1.2 KiB
Ruby
class Pycodestyle < Formula
|
|
desc "Simple Python style checker in one Python file"
|
|
homepage "https://pycodestyle.pycqa.org/"
|
|
url "https://github.com/PyCQA/pycodestyle/archive/2.7.0.tar.gz"
|
|
sha256 "5651c4b981bb0620e6ffb6a94dd6a68ec7fdcbd88c3219e5a976424692700f56"
|
|
license "MIT"
|
|
head "https://github.com/PyCQA/pycodestyle.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "6d8fc8922c94085c4b7d8b627617468c03b7fa9a3499b2bcde0d6da4005eff6c"
|
|
end
|
|
|
|
def install
|
|
bin.install "pycodestyle.py" => "pycodestyle"
|
|
end
|
|
|
|
test do
|
|
# test invocation on a file with no issues
|
|
(testpath/"ok.py").write <<~EOS
|
|
print(1)
|
|
EOS
|
|
assert_equal "",
|
|
shell_output("#{bin}/pycodestyle ok.py")
|
|
|
|
# test invocation on a file with a whitespace style issue
|
|
(testpath/"ws.py").write <<~EOS
|
|
print( 1)
|
|
EOS
|
|
assert_equal "ws.py:1:7: E201 whitespace after '('\n",
|
|
shell_output("#{bin}/pycodestyle ws.py", 1)
|
|
|
|
# test invocation on a file with an import not at top of file
|
|
(testpath/"imp.py").write <<~EOS
|
|
pass
|
|
import sys
|
|
EOS
|
|
assert_equal "imp.py:2:1: E402 module level import not at top of file\n",
|
|
shell_output("#{bin}/pycodestyle imp.py", 1)
|
|
end
|
|
end
|