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

style: break lines more often, allow multiline params #2623

Conversation

Hazer
Copy link
Member

@Hazer Hazer commented Jun 1, 2024

Description

I propose those changes, so for example:

  constexpr auto MAX_GAMEPADS = std::min(static_cast<std::size_t>(platf::MAX_GAMEPADS), sizeof(std::int16_t) * 8);

breaks instead like this:

  constexpr auto MAX_GAMEPADS = std::min(
    static_cast<std::size_t>(platf::MAX_GAMEPADS), 
    sizeof(std::int16_t) * 8
  );

Also, ensures most places don't do:

BOOST_LOG(debug)  << "--begin controller touch packet--"sv << std::endl
                  << "controllerNumber ["sv;

And do

BOOST_LOG(debug) 
  << "--begin controller touch packet--"sv << std::endl
  << "controllerNumber ["sv;

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@Hazer Hazer mentioned this pull request Jun 1, 2024
11 tasks
@Hazer
Copy link
Member Author

Hazer commented Jun 1, 2024

Explanation

  • BreakBeforeBinaryOperators: NonAssignment: Ensures that binary operators (like <<) are treated appropriately for breaking lines.
  • PenaltyBreakBeforeFirstCallParameter: 1: Encourages breaking before the first call parameter, making the first line shorter.
  • PenaltyBreakComment: 1, PenaltyBreakString: 1: Lowers the penalty for breaking at these points, encouraging breaks.
  • PenaltyBreakFirstLessLess: 0 Minimizes the penalty for breaking before the << operator, making it more likely that clang-format will break lines at these points.
  • PenaltyExcessCharacter: 1000000: Adds a high penalty for exceeding the maximum line length, ensuring lines are broken earlier.

.clang-format Outdated Show resolved Hide resolved
.clang-format Outdated Show resolved Hide resolved
@Hazer Hazer marked this pull request as draft June 1, 2024 03:04
.clang-format Outdated Show resolved Hide resolved
@ReenigneArcher ReenigneArcher marked this pull request as ready for review June 1, 2024 13:26
@ReenigneArcher ReenigneArcher merged commit bc96c71 into LizardByte:style-adjust-clang-format-rules Jun 1, 2024
3 of 4 checks passed
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.

2 participants