macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
115 stars 58 forks source link

Expand pretty-format-yaml to allow customisation of offset #143

Closed macisamuele closed 1 year ago

macisamuele commented 1 year ago

Fix: #132

@hdadhich01's report essentially highlights the fact that the current pretty-format-yaml tool does not offer configurable offset for nested structures and considering that some YAML prettifiers embedded into IDEs do have a non zero offset it would cause some friction with respect to "format-on-save" and pre-commit checks.

This PR aims to expose offset configuration such that cases like #132 can be handled via pre-commit hook configuration. In the specific case of the report, the "IDE preferred" formatting would be preserved if --indent=4 and --offset=2 arguments are provided

codecov[bot] commented 1 year ago

Codecov Report

Merging #143 (1319a0e) into master (4a72877) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #143   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          309       313    +4     
=========================================
+ Hits           309       313    +4     
Impacted Files Coverage Δ
..._formatters_pre_commit_hooks/pretty_format_yaml.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.