Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rstfmt cannot handle "docutils.utils.SystemMessage: (ERROR/3) Unexpected indentation." #39

Open
oxmb opened this issue Jun 28, 2024 · 0 comments

Comments

@oxmb
Copy link

oxmb commented Jun 28, 2024

I have this minimal file, with a unexpected indentation on line 3:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
 mollit anim id est laborum.

When I run rstfmt on this file, I get this error:

:3: (ERROR/3) Unexpected indentation.
Traceback (most recent call last):
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2798, in text
    block = self.state_machine.get_text_block(flush_left=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/statemachine.py", line 403, in get_text_block
    block = self.input_lines.get_text_block(self.line_offset,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/statemachine.py", line 1352, in get_text_block
    raise UnexpectedIndentationError(self[start:end], source,
docutils.statemachine.UnexpectedIndentationError: (StringList(['occaecat cupidatat non proident, sunt in culpa qui officia deserunt'], items=[('', 1)]), '', 3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mb/.local/share/nvim/venv/bin/rstfmt", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/rstfmt/__main__.py", line 91, in main
    do_file(args, path, misformatted)
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/rstfmt/__main__.py", line 19, in do_file
    doc = rstfmt.parse_string(inp)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/rstfmt/rstfmt.py", line 758, in parse_string
    parser.parse(s, doc)
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/parsers/rst/__init__.py", line 184, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 169, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
                                  ^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2801, in text
    msg = self.reporter.error('Unexpected indentation.',
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/utils/__init__.py", line 231, in error
    return self.system_message(self.ERROR_LEVEL, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/rstfmt/rstfmt.py", line 281, in system_message
    msg = super().system_message(level, message, *children, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mb/.local/share/nvim/venv/lib/python3.12/site-packages/docutils/utils/__init__.py", line 197, in system_message
    raise SystemMessage(msg, level)
docutils.utils.SystemMessage: :3: (ERROR/3) Unexpected indentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant