duo-labs / duo-labs/markflow

Error: "markflow.exceptions.ReformatInconsistentException: Reformat of reformatted code results in different text."

Open
#66 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
21
Forks
4
PR merge metrics
No merged PRs in 30d

Description

With a relatively simple text file I get an exception with markflow.

This is the input:
```
The history of carbon capture took a new turn with the Sleipner project in Norway. The
Nordic country was among the first to implement a carbon tax in 1991. It gave companies
a financial incentive to reduce their carbon dioxide emissions.
```

When I use markflow with a line length of 78, it breaks:
```
markflow --line-length 78 ccs.md
File "/home/hanno/.local/bin/markflow", line 8, in
sys.exit(__main__())
^^^^^^^^^^
File "/home/hanno/.local/lib/python3.11/site-packages/markflow/__main__.py", line 382, in __main__
exit(main(sys.argv[1:]))
^^^^^^^^^^^^^^^^^^
File "/home/hanno/.local/lib/python3.11/site-packages/markflow/__main__.py", line 377, in main
return _reformat_files(args)
^^^^^^^^^^^^^^^^^^^^^
File "/home/hanno/.local/lib/python3.11/site-packages/markflow/__main__.py", line 282, in _reformat_files
new_contents = reformat_markdown_text(old_contents, args.line_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hanno/.local/lib/python3.11/site-packages/markflow/reformat_markdown.py", line 97, in reformat_markdown_text
raise ReformatInconsistentException(
markflow.exceptions.ReformatInconsistentException: Reformat of reformatted code results in different text. Please open a bug report or email jholland@duosecurity.com. (file: ccs.md)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown ccs.md text and `markflow --line-length 78 ccs.md`. Start in markflow/reformat_markdown.py at reformat_markdown_text and its consistency check, with markflow/__main__.py showing the CLI path. Done means this input reformats without ReformatInconsistentException and the result remains stable when reformatted again.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.