Skip to content

fix(indentation_namespace): false positive for MemInitLists #353

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

Merged
merged 2 commits into from
Apr 8, 2025

Conversation

aaronliu0130
Copy link
Member

@aaronliu0130 aaronliu0130 commented Mar 23, 2025

Should fix #346
A massive commit for a seemingly simple problem!

Fix whitespace/indentation_namespace false positive for member initializer lists (MemInitLists)
Adds new _ConstructorInfo, _WrappedInfo, and _MemInitListInfo nesting stack element classes
Remember last-popped nesting stack item
Update descriptor.pb.cc to 2016-12-16 version (commit 183d31c)

chore: refactor part of NestingState.Update()

Split out parentheses counting namespace consumption to have enough available conditional branches for next commit
Add type hints

@aaronliu0130
Copy link
Member Author

changelog for this force push

the typing for error() is too long a callable that should also specify the types of error() itself first so let's just drop it for now until the time for it comes oh noes oh gosh

@aaronliu0130 aaronliu0130 requested review from jayvdb and cclauss March 23, 2025 20:07
@aaronliu0130
Copy link
Member Author

aaronliu0130 commented Mar 23, 2025

changelog for this force push

add to changelog

Previous actions run (success): https://github.com/cpplint/cpplint/actions/runs/14022517156?pr=353

@Bouncner
Copy link

In our code base it solves the issues with members initializers, but there is one issue remaining:

#include "types.hpp"

namespace opossum {

namespace hana = boost::hana;

namespace detail {

// Extends to hana::make_tuple(hana::type_c<int32_t>, hana::type_c<int64_t>, ...);
static constexpr auto types =
    hana::make_tuple(BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TRANSFORM(EXPAND_TO_HANA_TYPE, _, data_types_macro)));

cpplint complains about the last line.

@aaronliu0130
Copy link
Member Author

I don't think we would bother with that, unfortunately... catching that would probably make cpplint way slower and the usual linesplitting AFAIK is to split inside the parentheses like

static constexpr auto types = hana::make_tuple(BOOST_PP_SEQ_ENUM(
    BOOST_PP_SEQ_TRANSFORM(EXPAND_TO_HANA_TYPE, _, data_types_macro)));

which is also what clang-format with Google style gives you.

@Bouncner
Copy link

Okay, we'll just NOLINT this line then.

Thanks for the quick fix with this PR!

@aaronliu0130 aaronliu0130 force-pushed the indent_ye_MILs branch 2 times, most recently from cf68b33 to 6566e2d Compare March 25, 2025 01:28
@aaronliu0130
Copy link
Member Author

aaronliu0130 commented Mar 25, 2025

@aaronliu0130
Copy link
Member Author

@cclauss Please review.

@@ -19,7 +19,6 @@ src/inspect/unnamed_namespace_check.hpp:28: Do not indent within a namespace.
src/inspect/unnamed_namespace_check.hpp:28: { should almost always be at the end of the previous line [whitespace/braces] [4]
src/inspect/unnamed_namespace_check.hpp:29: Do not indent within a namespace. [whitespace/indent_namespace] [4]
src/inspect/unnamed_namespace_check.hpp:29: Weird number of spaces at line-start. Are you using a 2-space indent? [whitespace/indent] [3]
src/inspect/unnamed_namespace_check.hpp:30: Do not indent within a namespace. [whitespace/indent_namespace] [4]
Copy link
Member Author

Choose a reason for hiding this comment

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

This is technically a false negative, but it's due to the already-violation that is whitespace/braces so I don't think it's worth the extra compute tradeoff to support.

@aaronliu0130
Copy link
Member Author

Rebase includes typo fix. Pls review

@aaronliu0130
Copy link
Member Author

aaronliu0130 commented Apr 6, 2025

This has now been sitting here for 2 weeks. I can rebase after #334 is merged to add a new changelog section.

@cclauss
Copy link
Member

cclauss commented Apr 7, 2025

Please resolve the git conflict in CHANGELOG.rst, and then I will approve this pull request.

@aaronliu0130
Copy link
Member Author

Great! Thanks. However rebasing is blocked by #334, which would bump the version and add a new block in the changelog.

@cclauss
Copy link
Member

cclauss commented Apr 7, 2025

#334 is now merged. Updating the version should only be done in the release process, not before. Modifying CHANGELOG.rst is always dicey because of git conflicts. My recommendation would be that new entries only pertain to the current pull request. Put a blank line before and after all new entries (to decrease the possibility of git conflicts).

At release time, we can update the version and remove the blank lines.

What is release vNEXT? Is it v2.0.2, v2.1.0, or v3.0.0? Different pull requests making different guesses is suboptimal (git conflicts). It is best to make the vNEXT version number decision at release time.
v2.0.1 is preserved at:

When releasing, we will:


Screenshot 2025-04-07 at 20 09 14

@aaronliu0130
Copy link
Member Author

Updating the version should only be done in the release process, not before.

In my opinion, it is worse. It can falsely confuse users (and support agents) into thinking the trunk software is on the latest stable release, and the only "benefit" of only updating the version on release is not needing to debate the version number. Nearly every major project I know bumps the version number immediately after release. I also do not see different PRs making different guesses on the version number, and it bumps the semver feature part as I feel like we should have at least e.g. #64 in the next release. Maybe we should just put a temporary version number (e.g. 2.0.1-next for right after releasing 2.0.1) in cpplint.py and leave the new CHANGELOG header as "TBA"? I like your blank lines idea, though.

Split out parentheses counting namespace consumption to have enough available conditional branches for next commit
Add type hints

# Conflicts:
#	cpplint.py
Fix whitespace/indentation_namespace false positive for member initializer lists (MemInitLists)
Adds new _ConstructorInfo, _WrappedInfo, and _MemInitListInfo nesting stack element classes
Remember last-popped nesting stack item
Update descriptor.pb.cc to 2016-12-16 version (commit 183d31c)
@cclauss
Copy link
Member

cclauss commented Apr 7, 2025

https://github.com/pydantic/pydantic/blob/04fd6395c7165232785992a6ad0e817e9db6e590/pydantic/version.py#L9 Same as the recent release made four days ago.

Preparing for tomorrow’s release of Celery celery/celery#9660

@cclauss cclauss assigned aaronliu0130 and unassigned cclauss Apr 8, 2025
@aaronliu0130 aaronliu0130 merged commit 48e8d85 into cpplint:develop Apr 8, 2025
10 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.

Issue with whitespace/indent_namespace and member initializer lists
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy