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

Support --style=file:<path/to/file> for older versions of clang-format #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luator
Copy link

@luator luator commented Feb 28, 2022

Allows using a .clang-format file from an arbitrary location (i.e. does not need to be in the project directory or parent).

This is done by loading the file and passing the config to clang-format as a YAML string, i.e. like this:

clang-format file.cpp --style "{BasedOnStyle: Google, IndentWidth: '4', ...}"

Adds conditional dependency on the yaml package for reading the file.

Note that starting from version 14, clang-format supports specifying a file like this on its own. So if you are interested in merging this change, it would probably make sense to extend it a bit to check the version and only load the config like this for versions <14.

This will be supported by clang-format 14 but we can already get it for
older versions by manually loading the file and passing the config as
YAML string.

Adds conditional dependency on the `yaml` package.
@luator luator changed the title Support --style=file:<path/to/file> for versions of clang-format Support --style=file:<path/to/file> for older versions of clang-format Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant