alandefreitas / clang-unformat

A simple tool to infer a .clang-format file from existing code
Boost Software License 1.0
58 stars 13 forks source link

Dulplication of `AfterFunctionDeclarationName` #17

Open tonyho opened 8 months ago

tonyho commented 8 months ago

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
alandefreitas commented 8 months ago

It ended up being defined twice here:

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

tonyho commented 8 months ago

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?

alandefreitas commented 8 months ago

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.