Closed denji closed 3 years ago
I think the output result is the better format.
Another related issue is that formatter is actually breaking multiline string values with braces. (eg. json) failing test:
def test_multiline_string(self):
self._check_formatting(
(
"""http {\n"""
""" log_format le_json '{"time":"$time_iso8601", '\n"""
""" '"client_agent":"$client_agent",\n"""
""" '"user_agent":"$http_user_agent"}';\n"""
"""}\n"""
),
(
"""http {\n"""
""" log_format le_json '{"time":"$time_iso8601", '\n"""
""" '"client_agent":"$client_agent",\n"""
""" '"user_agent":"$http_user_agent"}';\n"""
"""}\n"""
),
)
Modified test output:
----------------------------- Captured stdout call -----------------------------
original:
http {
log_format le_json '{"time":"$time_iso8601", '
'"client_agent":"$client_agent",
'"user_agent":"$http_user_agent"}';
}
formatted:
http {
log_format le_json ' {
"time":"$time_iso8601", '
'"client_agent":"$client_agent",
'"user_agent":"$http_user_agent"
}
';
}
And this causes three unnecessary newlines on output for each log record.
Could we use the official nginxinc/crossplane
parser to improve code quality?
@denji my goal was to be without any dependencies (just Python), so deployment to various environments is easy (just copy the script). So I won't accept introducing 3rd party libs.
Multiline
log_format
does not correction the alignmentInput data:
Output result