clang-unformat icon indicating copy to clipboard operation
clang-unformat copied to clipboard

Dulplication of `AfterFunctionDeclarationName`

Open tonyho opened this issue 1 year ago • 3 comments
trafficstars

When I running the unformat, it would generate 2 line with same content:

  AfterFunctionDeclarationName: false              # edit distance 69
  AfterFunctionDeclarationName: false              # edit distance 69

In the section of :

SpaceBeforeParensOptions:
  AfterControlStatements: false                    # edit distance 69
  AfterForeachMacros: true                         # did not affect the output
  AfterFunctionDeclarationName: false              # edit distance 69
  AfterFunctionDeclarationName: false              # edit distance 69
  AfterFunctionDefinitionName: true                # did not affect the output
  AfterIfMacros: true                              # did not affect the output
  AfterOverloadedOperator: true                    # did not affect the output
  AfterRequiresInClause: true                      # did not affect the output
  AfterRequiresInExpression: true                  # did not affect the output
  BeforeNonEmptyParentheses: false                 # edit distance 69

tonyho avatar Jan 19 '24 08:01 tonyho

It ended up being defined twice here:

https://github.com/alandefreitas/clang-unformat/blob/1b53dd7017e2f2ed171a61a87835e774c578d328/standalone/clang_format.cpp#L476-L481

alandefreitas avatar Jan 19 '24 14:01 alandefreitas

It ended up being defined twice here:↳

https://github.com/alandefreitas/clang-unformat/blob/1b53dd7017e2f2ed171a61a87835e774c578d328/standalone/clang_format.cpp#L476-L481

Thanks. As I am new to clang-format, a question raised from my mind: is this the normal case or will it be modified in the next release/commit? Or should I delete the duplication by myself?

tonyho avatar Jan 22 '24 03:01 tonyho

As I am new to clang-format, a question raised from my mind: is this the normal case or will it be modified in the next release/commit?

clang-format usually includes new options in new releases. If clang-format includes an option but this project doesn't consider it, it'll simply fail to optimize for that option.

On the other hand, if this project tries to optimize for an option but your version of clang-format doesn't support it, then it'll simply ignore the option.

Or should I delete the duplication by myself?

The option should be removed because it can create an output with a duplicated key.

Apart from that, the tool should still work.

This is a very personal project I shared I'm not able to spend much time maintaining it.

Users usually just open small PRs to fix small problems and I merge them.

alandefreitas avatar Jan 22 '24 12:01 alandefreitas