helpers icon indicating copy to clipboard operation
helpers copied to clipboard

Fix missing in_place arg in Markdown Linter

Open sonniki opened this issue 6 months ago • 1 comments

Linter fails on Markdown files due to the former argument in_place being removed in a recent commit https://github.com/causify-ai/helpers/commit/0387ed7fa93653b9ca98396fb3580a7fa7a19ba3

@gpsaggese what is the intended new approach of formatting a file in place there? Passing the same file path to the input and output arguments?

sonniki avatar May 27 '25 15:05 sonniki

@gpsaggese this issue has already opened here, hence not opening a redundant one.

indrayudd avatar May 30 '25 22:05 indrayudd

After some investigation:

  • In the old version of lint_notes.py, the --in_place argument explicitly controlled whether the input file was overwritten with the linted output.

  • In the current version, --in_place has been removed. Instead:

    • You can pass both -i and -o to specify input and output files explicitly.
    dev_scripts_helpers/documentation/lint_notes.py -i file1.md -o file2.md
    
    • If only -i is provided and it points to a file (not stdin), the script defaults to in-place behavior by setting out_file = in_file.
    # Lints file in-place.
    dev_scripts_helpers/documentation/lint_notes.py -i file1.md
    

Solution

The cause of the lint failure was due to this line in a previous commit: https://github.com/causify-ai/helpers/blob/b32aa8b2eb8c357c2e8610aae35ddf5859023d12/linters/amp_lint_md.py#L67-L69 This used the deprecated --in_place flag, which is no longer supported in the updated lint_notes.py.

This has already been fixed in the current version of the repo by replacing it with: https://github.com/causify-ai/helpers/blob/dafdb4af43039e4ddc5eed62ba9c3cdf5f22bab9/linters/amp_lint_md.py#L66-L68

aangelo9 avatar Jun 04 '25 21:06 aangelo9

Good investigation @aangelo9

sonniki avatar Jun 05 '25 06:06 sonniki