Check and fix mock names in pre-commit hook - #464
Open
cameron-craig-etas wants to merge 6 commits into
Open
Conversation
cameron-craig-etas
requested a deployment
to
workflow-approval
August 13, 2026 13:05 — with
GitHub Actions
Waiting
cameron-craig-etas
requested a deployment
to
workflow-approval
August 13, 2026 13:05 — with
GitHub Actions
Waiting
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
added 2 commits
August 13, 2026 14:50
cameron-craig-etas
requested a deployment
to
workflow-approval
August 13, 2026 14:02 — with
GitHub Actions
Waiting
cameron-craig-etas
requested a deployment
to
workflow-approval
August 13, 2026 14:02 — with
GitHub Actions
Waiting
cameron-craig-etas
requested a deployment
to
workflow-approval
August 13, 2026 14:09 — with
GitHub Actions
Waiting
cameron-craig-etas
requested a deployment
to
workflow-approval
August 13, 2026 14:09 — with
GitHub Actions
Waiting
cameron-craig-etas
marked this pull request as ready for review
August 14, 2026 07:05
cameron-craig-etas
requested review from
FScholPer,
MaciejKaszynski,
NicolasFussberger,
anmittag,
antonkri,
pawelrutkaq and
ramceb
as code owners
August 14, 2026 07:05
MaciejKaszynski
requested changes
Aug 14, 2026
MaciejKaszynski
left a comment
Contributor
There was a problem hiding this comment.
Mostly nit picks
| SPDX-License-Identifier: Apache-2.0 | ||
| ----------------------------------------------------------------------------- --> | ||
|
|
||
| # bad_mock.hpp |
Contributor
There was a problem hiding this comment.
Think this was added by mistake
Contributor
Author
There was a problem hiding this comment.
Ah yes, good spot
| - id: test-doubles-naming-fix | ||
| name: Check and fix test double file names | ||
| entry: python3 ./scripts/fix_test_doubles_naming_precommit.py | ||
| language: system |
Contributor
There was a problem hiding this comment.
Suggested change
| language: system | |
| language: python |
| """ | ||
| suffix = "".join(path.suffixes) | ||
| if suffix: | ||
| return path.name[: -len(suffix)], suffix |
Contributor
There was a problem hiding this comment.
I think you can use path.stem, instead of path.name[: -len(suffix)]
| FAKE = "fake" | ||
|
|
||
| @staticmethod | ||
| def from_path(path: Path): |
Contributor
There was a problem hiding this comment.
Suggested change
| def from_path(path: Path): | |
| def from_path(path: Path) -> 'TestDoubleName': |
You can use '' to type hint something that isn't "accessible".
Contributor
Author
There was a problem hiding this comment.
Aaaah brilliant, I was wondering how to do that. Brilliant :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#422
This PR adds a Python script to validate test doubles (mocks, stubs, fakes etc.), to ensure they use the test double name as a prefix (e.g
mock_component.cpp). We recently updated all our mocks to use a consistent format (/pull/457). This pre-commit will keep things nice and tidy 🧹As far as testing goes I have ran through these scenarios manually: