47 lines
1.6 KiB
Ruby
47 lines
1.6 KiB
Ruby
class Yamllint < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Linter for YAML files"
|
|
homepage "https://github.com/adrienverge/yamllint"
|
|
url "https://github.com/adrienverge/yamllint/archive/v1.16.0.tar.gz"
|
|
sha256 "2e4a304e28d5fa413d194ed78ebd323da8b8d5ecc42fdc62b605585318754622"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "ea697e77252febd3059a6c253c1d50d2c8c901e5215dadd9ce3009d5e092f3e8" => :mojave
|
|
sha256 "4f291e33c644a17f2bb2e450b5dea719248aa31fec004acf773def389c1f2eae" => :high_sierra
|
|
sha256 "8bf2e635cb886716c1ffe69a83d816021623735ce420526d9ba41cf9e83fb457" => :sierra
|
|
end
|
|
|
|
depends_on "libyaml"
|
|
depends_on "python"
|
|
|
|
resource "PyYAML" do
|
|
url "https://files.pythonhosted.org/packages/a3/65/837fefac7475963d1eccf4aa684c23b95aa6c1d033a2c5965ccb11e22623/PyYAML-5.1.1.tar.gz"
|
|
sha256 "b4bb4d3f5e232425e25dda21c070ce05168a786ac9eda43768ab7f3ac2770955"
|
|
end
|
|
|
|
resource "pathspec" do
|
|
url "https://files.pythonhosted.org/packages/84/2a/bfee636b1e2f7d6e30dd74f49201ccfa5c3cf322d44929ecc6c137c486c5/pathspec-0.5.9.tar.gz"
|
|
sha256 "54a5eab895d89f342b52ba2bffe70930ef9f8d96e398cccf530d21fa0516a873"
|
|
end
|
|
|
|
def install
|
|
virtualenv_install_with_resources
|
|
end
|
|
|
|
test do
|
|
(testpath/"bad.yaml").write <<~EOS
|
|
---
|
|
foo: bar: gee
|
|
EOS
|
|
output = shell_output("#{bin}/yamllint -f parsable -s bad.yaml", 1)
|
|
assert_match "syntax error: mapping values are not allowed here", output
|
|
|
|
(testpath/"good.yaml").write <<~EOS
|
|
---
|
|
foo: bar
|
|
EOS
|
|
assert_equal "", shell_output("#{bin}/yamllint -f parsable -s good.yaml")
|
|
end
|
|
end
|