cheshirekow / cmake_format

Source code formatter for cmake listfiles.
GNU General Public License v3.0
962 stars 105 forks source link

[cmake-lint] Incorrect "[C0327] Wrong line ending (unix)" on Windows #273

Open garethsb opened 3 years ago

garethsb commented 3 years ago

Testing cmake-lint with v0.6.13 on Windows with files that have \r\n at the end of all lines.

With line_ending = 'windows' in my config, I get [C0327] Wrong line ending (unix) on the last line of the file. With line_ending = 'unix' in my config, I get [C0327] Wrong line ending (windows) on every line (as expected) apart from the last line. It's like it's losing the last character of the file.

I tried line_ending = 'auto' but that doesn't seem to work for cmake-lint? I get:

ERROR An internal error occured. Please consider filing a bug report at github.com/cheshirekow/cmakelang/issues
Traceback (most recent call last):
  File "C:\Users\garethsb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cmakelang\lint\__main__.py", line 185, in main
    return inner_main()
  File "C:\Users\garethsb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cmakelang\lint\__main__.py", line 168, in inner_main
    process_file(cfg, local_ctx, intext)
  File "C:\Users\garethsb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cmakelang\lint\__main__.py", line 35, in process_file
    config.set_line_ending(detected)
AttributeError: 'Configuration' object has no attribute 'set_line_ending'
ptc-tgamper commented 10 months ago

I am hitting this, too.