Skip to content

Commit

Permalink
Added support for 'found forbidden document start|end'.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamere-allo-peter committed May 4, 2022
1 parent b4350b6 commit c7105c9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ This GitHub Action will automatically create Pull Requests to your repository wi
# Fixers
yamlfixer currently (as of 0.6.4) can fix the following problems as reported by `yamllint` :
yamlfixer currently (as of 0.9.6) can fix the following problems as reported by `yamllint` :
- comment not indented like content (comments-indentation)
- found forbidden document end
- found forbidden document start
- line too long
- missing document end
- missing document start
Expand Down
18 changes: 8 additions & 10 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Here's a list of problems reported by yamllint which are not currently
supported by yamlfixer, but which might be supported in a future
release :

* too few spaces inside brackets
* too few spaces inside empty brackets
* too many spaces after question mark
* found forbidden document end "..."
* found forbidden document start "---"
* forbidden implicit octal value "%s"
* forbidden explicit octal value "%s"
* string value is not quoted with %s quotes
* string value is not quoted
* string value is redundantly quoted with %s quotes
- too few spaces inside brackets
- too few spaces inside empty brackets
- too many spaces after question mark
- forbidden implicit octal value "%s"
- forbidden explicit octal value "%s"
- string value is not quoted with %s quotes
- string value is not quoted
- string value is redundantly quoted with %s quotes
2 changes: 2 additions & 0 deletions tests/test_listfixers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def test_listfixers(self):
"""\
Fixers:
- comment not indented like content (comments-indentation)
- found forbidden document end
- found forbidden document start
- line too long
- missing document end
- missing document start
Expand Down
8 changes: 8 additions & 0 deletions yamlfixer/problemfixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ def fix_missing_docend(self, left, right): # pylint: disable=unused-argument
self.ffixer.lines.insert(self.linenum + 1, '...')
self.ffixer.loffset += 1

def fix_forbidden_docstartend(self, left, right): # pylint: disable=unused-argument
"""Fix:
- found forbidden document end
- found forbidden document start
""" # noqa: D205, D208, D400
del self.ffixer.lines[self.linenum]
self.ffixer.loffset -= 1

def fix_newlineateof(self, left, right): # pylint: disable=unused-argument,no-self-use
r"""Fix:
- no new line character at the end of file
Expand Down

0 comments on commit c7105c9

Please sign in to comment.