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

clang-format 18 #1113

Merged
merged 3 commits into from
Jun 12, 2024
Merged

clang-format 18 #1113

merged 3 commits into from
Jun 12, 2024

Conversation

graebm
Copy link
Contributor

@graebm graebm commented May 10, 2024

Issue:

  • We've used clang-format 9 since forever, but it's not easy for people to get such an old version anymore.
  • You really need everyone on the same exact version clang-format, even PATCH matters
  • It's very hard to get the same version on everyone's machine (Ubuntu 24 has 18, brew on MacOS has 18, but Amazon Linux 2 only has 11, and AL2023 only has 15)

Description of Changes:

  • start using latest version of clang-format: 18.1.6
  • use pipx to install and run clang-format from PyPI. This lets everyone run the same version, regardless of OS
  • rewrite format-check.sh as format-check.py
    • now we can run it on Windows
    • most people on this team know Python better than Bash
    • add -i option to edit files in place
    • the script runs the specific clang-format version via pipx, so even if you have some other version of clang-format installed, the script will get it right
  • CI just runs ./format-check.py instead of using some 3rdparty Github Action

Updating your Machine:

  • MacOS:
    • if you have clang-format 9 from homebrew, uninstall it: brew uninstall llvm@9
    • if you have another version from homebrew, uninstall it: brew uninstall clang-format
    • install pipx: brew install pipx
    • ensure programs that pipx install are on your $PATH: pipx ensurepath
    • install the correct clang-format, so your IDE can use it too: pipx install clang-format==18.1.6

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.07%. Comparing base (4f874ce) to head (f463324).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1113   +/-   ##
=======================================
  Coverage   83.07%   83.07%           
=======================================
  Files          56       56           
  Lines        5756     5756           
=======================================
  Hits         4782     4782           
  Misses        974      974           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

include/aws/common/error.h Outdated Show resolved Hide resolved
Use python instead of shell script.
Add -i option to edit in place.
Copy link
Contributor

@waahm7 waahm7 left a comment

Choose a reason for hiding this comment

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

🥳 🎆🎆 🎊🎊🎊🥳

import re
from subprocess import list2cmdline, run
from tempfile import NamedTemporaryFile

Copy link
Contributor

Choose a reason for hiding this comment

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

trivial:

Suggested change
# 18.1.6 is the latest version as of June 2024

@graebm graebm merged commit 4fccc79 into main Jun 12, 2024
52 checks passed
@graebm graebm deleted the format-update branch June 12, 2024 16:52
graebm added a commit to awslabs/aws-c-auth that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-cal that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-compression that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-event-stream that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-http that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-io that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-iot that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-mqtt that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-s3 that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-sdkutils that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-checksums that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-auth that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-cal that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-compression that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-http that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-io that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-iot that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-mqtt that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-s3 that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-sdkutils that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-checksums that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-c-event-stream that referenced this pull request Jun 12, 2024
graebm added a commit to awslabs/aws-crt-python that referenced this pull request Jun 13, 2024
see: awslabs/aws-c-common#1113

remove the `./scripts/format-c.py` script in favor of having the same `./format-check.py -i` script in the same place as every other repo
graebm added a commit to awslabs/aws-crt-dotnet that referenced this pull request Jun 14, 2024
graebm added a commit to awslabs/aws-crt-ffi that referenced this pull request Jun 14, 2024
graebm added a commit to awslabs/aws-crt-cpp that referenced this pull request Jun 14, 2024
graebm added a commit to awslabs/aws-crt-python that referenced this pull request Jun 18, 2024
see: awslabs/aws-c-common#1113

remove the `./scripts/format-c.py` script in favor of having the same `./format-check.py -i` script in the same place as every other repo
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.

3 participants