Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function arguments can get incorrectly appended to comments #47

Closed
alastair-harrison-oxb opened this issue Jun 21, 2018 · 4 comments
Closed
Labels
acknowledged I've seen the report. I may not have anything more to say just yet!

Comments

@alastair-harrison-oxb
Copy link

$ clang-format --version
0.3.6

When I run cmake-format on a code block like this:

my_function(
  item1

  # Some comment
  item2
)

cmake-format gives me the following output:

my_function(item1 # Some comment item2)

There should be a line break before item2.

@sum01
Copy link

sum01 commented Jun 21, 2018

Isn't this more or less the same as #46 or at least very related? It seems that it's probably the cause of this issue anyways.

@bergercookie
Copy link

bergercookie commented Jun 22, 2018

Isn't this more or less the same as #46 or at least very related? It seems that it's probably the cause of this issue anyways.

Looks like it's related but not the very same issue.

Adding to this, consider the following example

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
  # a comment here
endif()

I assume in this case, cmake-format (incorrectly) tries to join the string to the previous line, but this also results in the following exception:

ValueError: invalid width -1 (must be > 0)

Here's the full traceback:

image

@cheshirekow cheshirekow added the acknowledged I've seen the report. I may not have anything more to say just yet! label Jun 22, 2018
@cheshirekow
Copy link
Owner

cheshirekow commented Jul 5, 2018

Fixed I believe in the upcoming release. If you're able, please try https://github.com/cheshirekow/cmake_format/releases/tag/v0.4.0rc1 and lte me know how it goes

@alastair-harrison-oxb
Copy link
Author

Yes, seems to maintain the semantics of the function call now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged I've seen the report. I may not have anything more to say just yet!
Projects
None yet
Development

No branches or pull requests

4 participants