Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRule formatting tool. #21
Comments
matttproud
added a commit
that referenced
this issue
Apr 9, 2014
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Yep, that'd be great. Preserving comments is the biggest (and basically only) problem. And agreement on how to split expressions over multiple lines. |
fabxc
added
kind/enhancement
and removed
feature request
labels
Apr 28, 2016
This comment has been minimized.
This comment has been minimized.
|
Aren't we in the middle of adding this to promtool? |
This comment has been minimized.
This comment has been minimized.
|
Related: #1779 |
brian-brazil
added
component/promtool
priority/P3
labels
Jul 14, 2017
simonpasquier
pushed a commit
to simonpasquier/prometheus
that referenced
this issue
Oct 12, 2017
bobmshannon
pushed a commit
to bobmshannon/prometheus
that referenced
this issue
Nov 19, 2018
pgier
pushed a commit
to pgier/prometheus
that referenced
this issue
Jan 23, 2019
geekodour
referenced this issue
Feb 27, 2019
Open
Make promtool better for CI with syntax-only config check #5222
This comment has been minimized.
This comment has been minimized.
|
Some observations:
|
This comment has been minimized.
This comment has been minimized.
Our current YAML library doesn't do this, but is hoping to "soon". |
This comment has been minimized.
This comment has been minimized.
|
I'd like to include this in my gsoc proposal. @brian-brazil, can you link to the YAML library you're referring to? |
This comment has been minimized.
This comment has been minimized.
|
https://github.com/go-yaml/yaml, but I'd scope this to just the PromQL as this stands. |
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil But since the PromQL from rules is always embedded in YAML files, it at least has to preserve YAML comments, right? Otherwise the tool wouldn't be very useful as nobody wants to lose their comments the benefit of formatting. |
This comment has been minimized.
This comment has been minimized.
|
That'd be nice, but we can get benefits without that. I'd rather also not depend on something with an unclear timeline for a gsoc project. |
This comment has been minimized.
This comment has been minimized.
|
Let's start with the PromQL part. The YAML part should be almost trivial once the library preserves comments and things like the |
This comment has been minimized.
This comment has been minimized.
|
Ok! |
This comment has been minimized.
This comment has been minimized.
|
v3 of the YAML library is out, which should allow for all of this. |
juliusv commentedJan 4, 2013
Like "gofmt" for Go, we ought to have a "promfmt" for Prometheus since we have a syntax tree. The idea being that the system produces uniform style that minimizes deviation and learning curve.