When using the .cmake-format without an extension the script doesn't know which parser to utilise so tries each in-turn. However in doing so ALL exceptions are passed and you get a very unhelpful error:
"RuntimeError: Failed to parse C:\development\CPM.cmake\.cmake-format as any of yaml, json, or python"
Investigation
Adding the .yaml extension I determined the source of my issue is:
ModuleNotFoundError: No module named 'yaml'
Solutions
The cmake-format package should explicitly depend on Yaml to circumvent this current issue.
Where all three parsers fail a 'best guess' could be made based on some simple Regex i.e. contains "format:\n" at start of file as to display the exception e.g. Failed to parse C:\development\CPM.cmake\.cmake-format, best-guess is 'yaml' format. Parser returned: "ModuleNotFoundError: No module named 'yaml'"
Just display the error output from all 3 parsers, a bit verbose but would solve all cases!
Situation
When using the
.cmake-format
without an extension the script doesn't know which parser to utilise so tries each in-turn. However in doing so ALL exceptions are passed and you get a very unhelpful error: "RuntimeError: Failed to parse C:\development\CPM.cmake\.cmake-format as any of yaml, json, or python
"Investigation
Adding the
.yaml
extension I determined the source of my issue is:ModuleNotFoundError: No module named 'yaml'
Solutions
cmake-format
package should explicitly depend on Yaml to circumvent this current issue.Failed to parse C:\development\CPM.cmake\.cmake-format, best-guess is 'yaml' format. Parser returned: "ModuleNotFoundError: No module named 'yaml'"