Closed adamryczkowski closed 6 months ago
More data needed:
definitions
/--definitions
?If the definition is provided, could you share at least partial definition (without spoiling any proprietary code if it's proprietary) with pattern like this:
function(try_to_win_best_picture_academy_award title alternative_title)
set(opts FOREIGN_LANGUAGE)
set(oneValue GENRE YEAR)
set(multiValues DIRECTORS CAST)
cmake_parse_arguments(_ "${opts}" "${oneValue}" "${multiValue}" ${ARGN})
endfunction()
#!/bin/bash
function log() { echo "[reproduction]" $@ }
function show-diff() { git diff $1 $2 && log "-- Files are identical" }
log "Create CMake file"
cat <
log "Run gersemi first time with indent=15" gersemi --indent 15 /tmp/gersemi-28-repro.cmake > /tmp/gersemi-28-repro-after-first-time.cmake
log "Run gersemi second time with indent=4" gersemi --indent 4 /tmp/gersemi-28-repro-after-first-time.cmake > /tmp/gersemi-28-repro-after-second-time.cmake
log "Show diff between original and first reformatting" show-diff /tmp/gersemi-28-repro.cmake /tmp/gersemi-28-repro-after-first-time.cmake
log "Show diff between original and second reformatting" show-diff /tmp/gersemi-28-repro.cmake /tmp/gersemi-28-repro-after-second-time.cmake
log "Show diff between first and second reformatting" show-diff /tmp/gersemi-28-repro-after-first-time.cmake /tmp/gersemi-28-repro-after-second-time.cmake
![image](https://github.com/BlankSpruce/gersemi/assets/32396809/364c30f2-b0a5-4fda-8b23-63bb5c782b59)
I think I got it. Your example omitted if()/endif()
or anything similar that introduces a block. A proper example is:
if(TRUE)
checkgitversion("${CheckGitSetup_REPOSITORY_PATH}" "${CheckGitSetup_TEMPLATE_FILE}" "${CheckGitSetup_OUTPUT_FILE}" "${CheckGitSetup_INCLUDE_HEADER}")
endif()
I'll fix that in 0.13.1.
I did play with the crazy tab indent of size 15 and noticed one thing:
After formatting this piece of code:
with the indent 15 and then back to 4 again, I arrived with a different string: