GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: allow same-directory header includes by PNHD · Pull Request #470 · cpplint/cpplint Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe ChangesInclude-subdirectory behavior
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to No concrete correctness or merge-blocking risk remains for this focused change. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed current head 1592d0b. The normal #375 case is fixed and the tests are green, but I found two path-handling cases that seem important to fix before merging.
One is a source path that goes through a symlink and then ... In that case cpplint can open one real file, while FileInfo.FullName() normalizes the path to a different lexical directory. The new same-directory header check can then look beside the wrong path. I reproduced both outcomes: it can warn even when the real sibling header exists, and it can suppress the warning when only an unrelated header exists in the normalized directory.
The other case is self-includes through filesystem aliases. If self.h includes alias.h and alias.h is a symlink or hard link to self.h, develop still reports build/include_subdir, but this PR suppresses it. os.path.samefile() confirms the two paths refer to the same file. The current normpath() / normcase() comparison only compares path strings, so it doesn't catch that identity case.
I also checked the ordinary same-directory behavior, missing headers, the sample-output changes, and the full test suite; those parts look good. I think these two filesystem cases should get regression tests and a fix before merge.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-reviewed current head d160830. Both findings from my previous review are fixed: I reproduced the symlink+.. false positive/false negative and both alias suppressions on 1592d0b, and all four behave correctly on this head.
The realpath/samefile change is narrowly scoped, the new regression tests fail without the corresponding fixes, and I also checked normal same-directory includes, self-includes, missing and invalid paths, symlinked sources, broken symlinks, and the fallback path handling without finding a new correctness issue.
Focused and full suites pass locally (236 tests, 96.48% coverage), along with pylint, mypy, pre-commit, and git diff --check.
No remaining blocker from me on this head. LGTM.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
AI-assisted review of d160830. The full local suite passes (236 tests, Python 3.12/macOS), but I found a source-file symlink regression at cpplint.py:5859-5860.
With alias/main.cc -> physical/real.cc and #include "utils.hpp" in that source, Clang searches beside the supplied source pathname:
| Header location | Clang C++17 | Base cpplint | This head |
|---|---|---|---|
Only alias/utils.hpp |
succeeds | warns | warns |
Only physical/utils.hpp |
fails | warns | no warning |
I reproduced this using clang++ -std=c++17 -fsyntax-only alias/main.cc and cpplint with --filter=-,+build/include_subdir. The second case is a new false negative: resolving the final source-file symlink makes an unrelated header suppress the diagnostic. The first is a remaining false positive.
Please resolve the parent directory for this lookup without dereferencing the final filename, while keeping the samefile self-include protection, and cover both header locations. A local experiment using realpath(dirname(filename)) restores both outcomes and passes the six existing include-path tests. This is distinct from the previously fixed directory-symlink-plus-.. case.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Follow-up to the review: I prepared a minimal, AI-assisted fix on top of this exact head in e88a7dc. It resolves the parent directory without following the final source-file symlink, preserving the existing self-include protection. Two parameterized regression cases cover a header beside only the alias and beside only the physical target. Both fail on the original implementation and pass with the fix. Local validation on Python 3.12/macOS: all 8 include-path cases pass, the full suite passes (238 tests), and Pylint passes. The commit is based directly on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
False positive for top-level header
There was an error while loading. Please reload this page.