Skip to content

Conversation

Yujinmon
Copy link
Contributor

Hello,
As i mentioned in issue #234 , i noticed there is error in namespace indentation.
Refer to google style guide, there have to be no function indentation inside of namespace scope.
But lint couldn't catch it.

So i changed
image

like this, and checked it works well.
image

Honestly I could prove excatly why, But It would be appreciated if you could check.

Thank you

@aaronliu0130 aaronliu0130 self-assigned this Apr 20, 2024
@aaronliu0130
Copy link
Member

The PR currently fails on the following testcase:

	namespace Test{
	void foo() { }
	}  // namespace Test

Note the leading whitespace.

The only test that fails is for when the entire namespace, including the declaration, is indented. I'm not sure if we should support that usecase, but the error would also seem misleading.
I don't think we should be supporting this case. Saying "don't indent namespaces" is also not very misleading.
@aaronliu0130 aaronliu0130 changed the title Fix false negative in namespace indentation error. Err on functions indented inside namespaces Apr 23, 2024
@aaronliu0130 aaronliu0130 merged commit 762b1e6 into cpplint:develop Apr 23, 2024
@cvvergara
Copy link

Hi all
I normally use develop branch on pgRouting's CI

I can see you are aware of the problem on develop with this PR.

https://github.com/cvvergara/pgrouting/actions/runs/8868982380/job/24349155971#step:4:77
https://github.com/pgrouting/pgrouting/blob/develop/src/alpha_shape/pgr_alphaShape.cpp#L321-L324

The common place I see this happen is when the parameters of a function within a namespace are indented

Note that if the code is wrapped with #if 0 #endif it also generates the error

https://github.com/cvvergara/pgrouting/actions/runs/8868982380/job/24349155971#step:4:84
https://github.com/cvvergara/pgrouting/blob/develop/src/bellman_ford/bellman_ford_driver.cpp#L55

The filter --filter=-whitespace/indent_namespace works ok

@aaronliu0130
Copy link
Member

aaronliu0130 commented Apr 28, 2024

I will check this out. Note that our other maintainer has been inactive, so merging the eventual fix may take some time due to the review requirement.

@aaronliu0130
Copy link
Member

This would involve refactoring state to also keep track of function parameter nesting (and ideally template argument nesting too).

GideokKim added a commit to kroma-network/tachyon that referenced this pull request Oct 8, 2024
Since cpplint 2.0.0, indent inspection has been added but still contains a bug.
This commit filters out the indent inspection to avoid issues caused by a bug.

See cpplint/cpplint#235
GideokKim added a commit to kroma-network/tachyon that referenced this pull request Oct 8, 2024
Since cpplint 2.0.0, indent inspection has been added but still contains a bug.
This commit filters out the indent inspection to avoid issues caused by a bug.

See cpplint/cpplint#235
@aaronliu0130 aaronliu0130 linked an issue Jan 29, 2025 that may be closed by this pull request
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.

Lint is not working for catching Namespace Indentation error
3 participants