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

Add clang-format #1086

Merged
merged 12 commits into from May 1, 2023
Merged

Add clang-format #1086

merged 12 commits into from May 1, 2023

Conversation

louwers
Copy link
Collaborator

@louwers louwers commented Apr 29, 2023

I tried to use clang-unformat to generate a config that best matches the code base.

However there is not a lot of consistency, so I got mixed results.

I made some minor changes, I kept AllowShortFunctionsOnASingleLine, disabled PackConstructorInitializers and AllowShortEnumsOnASingleLine. I set AlignAfterOpenBracket to BlockIndent (makes it a bit easier to move arguments around since together with BinPackArguments disabled every argument will be on its own line):

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignafteropenbracket

I also added a PenaltyBreakAssignment, which for example better worked here:

 static const auto geomPolygon = Polygon<double>{
 ...
``

instead of

static const auto geomPolygon =
Polygon{
...


You can change the config yourself and run 


pre-commit run --all-files


if you want to make modifications.

@louwers
Copy link
Collaborator Author

louwers commented Apr 30, 2023

OK the BlockIndent option looked nice but it has problems llvm/llvm-project#55473

So I am going to revert that.

Copy link
Contributor

@ovivoda ovivoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great effort @louwers !

@louwers louwers enabled auto-merge (squash) May 1, 2023 14:57
@louwers louwers merged commit 71f6da2 into maplibre:main May 1, 2023
14 checks passed
@louwers louwers deleted the clang-format-2 branch May 1, 2023 14:57
TimSylvester added a commit that referenced this pull request May 2, 2023
* commit '958cdb82067cc16c2e7a6746b24221240d3e7927':
  [pre-commit.ci] pre-commit autoupdate (#1096)
  Add clang-format (#1086)
  Update paths from maplibre-gl-native to maplibre-native (#1090)
  Revert GLES3 changes for OSMesa in Windows (#1079)
  [cmake] Use MLN prefix instead of MBGL (#1054)
  Create security policy (#1080)
  Adjust trivial links to maplibre-native (#1083)

# Conflicts:
#	include/mbgl/gfx/shader.hpp
#	src/mbgl/gfx/vertex_buffer.hpp
#	src/mbgl/gl/context.cpp
#	src/mbgl/gl/vertex_array.hpp
#	src/mbgl/renderer/layers/render_background_layer.cpp
#	src/mbgl/renderer/render_orchestrator.cpp
#	src/mbgl/renderer/render_orchestrator.hpp
TimSylvester added a commit that referenced this pull request May 3, 2023
* topic/drawable: (21 commits)
  build issues
  [pre-commit.ci] auto fixes from pre-commit.com hooks
  order drawables
  [pre-commit.ci] auto fixes from pre-commit.com hooks
  refactor
  [pre-commit.ci] pre-commit autoupdate (#1096)
  Add clang-format (#1086)
  Move generic shader lookup to context virtual
  Update paths from maplibre-gl-native to maplibre-native (#1090)
  missing includes
  warnings
  warnings
  warnings
  Eliminate GL drawable/builder dependencies from generic background layer
  Missing include
  Evaluate and apply color
  Revert GLES3 changes for OSMesa in Windows (#1079)
  [cmake] Use MLN prefix instead of MBGL (#1054)
  warnings
  Create security policy (#1080)
  ...
ntadej pushed a commit to ntadej/maplibre-native that referenced this pull request May 6, 2023
Co-authored-by: mwilsnd <mwilsnd@gmail.com>
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

3 participants