Skip to content

Commit 5388ac7

Browse files
coadometa-codesync[bot]
authored andcommitted
Rename --check flag to --validate in C++ public API parser
Summary: Renames flag for verifying that the C++ public API snapshot is with sync with the actual public API surface to match the JS API command. Changelog: [Internal] Differential Revision: D98484129
1 parent 0fa3e48 commit 5388ac7

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
1313
"clean": "node ./scripts/build/clean.js",
1414
"cxx-api-build": "python -m scripts.cxx-api.parser",
15-
"cxx-api-validate": "python -m scripts.cxx-api.parser --check",
15+
"cxx-api-validate": "python -m scripts.cxx-api.parser --validate",
1616
"flow-check": "flow check",
1717
"flow": "flow",
1818
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",

scripts/cxx-api/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ Maintainers should run this command whenever making intentional C++ API changes:
3131
python -m scripts.cxx-api.parser
3232
```
3333

34-
#### Check snapshots against committed baseline
34+
#### Validate snapshots against committed baseline
3535

3636
This mode generates snapshots to a temporary directory and compares them against the committed `.api` files. It is designed for CI:
3737

3838
```sh
39-
python -m scripts.cxx-api.parser --check
39+
python -m scripts.cxx-api.parser --validate
4040
```
4141

42-
If any snapshot differs, a unified diff is printed and the process exits with a non-zero status. To fix a failing check, regenerate the snapshots with `python -m scripts.cxx-api.parser` and commit the updated `.api` files.
42+
If any snapshot differs, a unified diff is printed and the process exits with a non-zero status. To fix a failing validation, regenerate the snapshots with `python -m scripts.cxx-api.parser` and commit the updated `.api` files.
4343

4444
## How it works
4545

scripts/cxx-api/parser/__main__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .doxygen import get_doxygen_bin, run_doxygen
2525
from .main import build_snapshot
2626
from .path_utils import get_react_native_dir
27-
from .snapshot_diff import check_snapshots
27+
from .snapshot_diff import validate_snapshots
2828

2929

3030
def run_command(
@@ -240,14 +240,14 @@ def main():
240240
help="Output directory for the snapshot",
241241
)
242242
parser.add_argument(
243-
"--check",
243+
"--validate",
244244
action="store_true",
245245
help="Generate snapshots to a temp directory and compare against committed ones",
246246
)
247247
parser.add_argument(
248248
"--snapshot-dir",
249249
type=str,
250-
help="Directory containing committed snapshots for comparison (used with --check)",
250+
help="Directory containing committed snapshots for comparison (used with --validate)",
251251
)
252252
parser.add_argument(
253253
"--view",
@@ -266,7 +266,7 @@ def main():
266266
)
267267
args = parser.parse_args()
268268

269-
verbose = not args.check
269+
verbose = not args.validate
270270

271271
doxygen_bin = get_doxygen_bin()
272272
version_result = subprocess.run(
@@ -309,13 +309,13 @@ def main():
309309
with tempfile.TemporaryDirectory() as tmpdir:
310310
snapshot_output_dir = (
311311
args.output_dir or tmpdir
312-
if args.check
312+
if args.validate
313313
else args.output_dir or get_default_snapshot_dir()
314314
)
315315

316316
build_snapshots(
317317
output_dir=snapshot_output_dir,
318-
verbose=not args.check,
318+
verbose=not args.validate,
319319
snapshot_configs=snapshot_configs,
320320
react_native_dir=react_native_package_dir,
321321
input_filter=input_filter,
@@ -324,13 +324,13 @@ def main():
324324
keep_xml=args.xml,
325325
)
326326

327-
if args.check:
327+
if args.validate:
328328
snapshot_dir = args.snapshot_dir or get_default_snapshot_dir()
329329

330-
if not check_snapshots(snapshot_output_dir, snapshot_dir):
330+
if not validate_snapshots(snapshot_output_dir, snapshot_dir):
331331
sys.exit(1)
332332

333-
print("All snapshot checks passed")
333+
print("All snapshot validations passed")
334334

335335

336336
if __name__ == "__main__":

scripts/cxx-api/parser/snapshot_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import os
1212

1313

14-
def check_snapshots(generated_dir: str, committed_dir: str) -> bool:
14+
def validate_snapshots(generated_dir: str, committed_dir: str) -> bool:
1515
"""Compare generated snapshots against committed ones.
1616
17-
Returns True if check passes (snapshots match or no committed snapshots).
17+
Returns True if validation passes (snapshots match or no committed snapshots).
1818
Returns False if snapshots differ.
1919
"""
2020
if not os.path.isdir(committed_dir):

0 commit comments

Comments
 (0)