Skip to content

apply --style to clang-tidy command #113

@2bndy5

Description

@2bndy5

If --style (clang-format's style guide) is not a blank string, it should also be applied to clang-tidy's --format-style argument. This will ensure the fixes applied by clang-tidy also conform to any changes that clang-format would apply.

from clang-tidy -h

  --format-style=<string>        -
                                   Style for formatting code around applied fixes:
                                     - 'none' (default) turns off formatting
                                     - 'file' (literally 'file', not a placeholder)
                                       uses .clang-format file in the closest parent
                                       directory
                                     - '{ <json> }' specifies options inline, e.g.
                                       -format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
                                     - 'llvm', 'google', 'webkit', 'mozilla'

This correlates to clang-format --style:

  --style=<string>               - Coding style, currently supports:
                                     LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit.
                                   Use -style=file to load style configuration from
                                   .clang-format file located in one of the parent
                                   directories of the source file (or current
                                   directory for stdin).
                                   Use -style=file:<format_file_path> to explicitly specifythe configuration file.    
                                   Use -style="{key: value, ...}" to set specific
                                   parameters, e.g.:
                                     -style="{BasedOnStyle: llvm, IndentWidth: 8}"

Doing this should help address #82 because we cannot apply clang-format changes after applying clang-tidy changes. See #82 (comment) for rationale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions