homebrew-core/Formula/yamllint.rb
2020-01-09 15:12:49 +01:00

48 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.20.0.tar.gz"
sha256 "6391bfd0f3d360a418fef54c6ccf77615c25b2b62c54fb770c07823471016b18"
revision 1
bottle do
cellar :any
sha256 "1a39e71f5471a2ef25cbb48d4ad7978171385ff38d5c40125f2c258cc6682244" => :catalina
sha256 "ee0e9115ae2423d3691c59c85ee10e03a0109706e24b2f51e21773ff15096a6b" => :mojave
sha256 "cb73a80359f4c689e5051d11cb3931b23268c573e00f52900875391442e10f51" => :high_sierra
end
depends_on "libyaml"
depends_on "python@3.8"
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/3d/d9/ea9816aea31beeadccd03f1f8b625ecf8f645bd66744484d162d84803ce5/PyYAML-5.3.tar.gz"
sha256 "e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615"
end
resource "pathspec" do
url "https://files.pythonhosted.org/packages/ce/f2/d35c292da8fbff725625a17ae40f48f933070acd5ccddb03d8c09d81758d/pathspec-0.7.0.tar.gz"
sha256 "562aa70af2e0d434367d9790ad37aed893de47f1693e4201fd1d3dca15d19b96"
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