Skip to content

Commit 8f069df

Browse files
coadometa-codesync[bot]
authored andcommitted
Rename --check flag to --validate in C++ public API parser (#56253)
Summary: Pull Request resolved: #56253 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] Reviewed By: huntie Differential Revision: D98484129
1 parent 4474dca commit 8f069df

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(
@@ -250,14 +250,14 @@ def main():
250250
help="Output directory for the snapshot",
251251
)
252252
parser.add_argument(
253-
"--check",
253+
"--validate",
254254
action="store_true",
255255
help="Generate snapshots to a temp directory and compare against committed ones",
256256
)
257257
parser.add_argument(
258258
"--snapshot-dir",
259259
type=str,
260-
help="Directory containing committed snapshots for comparison (used with --check)",
260+
help="Directory containing committed snapshots for comparison (used with --validate)",
261261
)
262262
parser.add_argument(
263263
"--view",
@@ -276,7 +276,7 @@ def main():
276276
)
277277
args = parser.parse_args()
278278

279-
verbose = not args.check
279+
verbose = not args.validate
280280

281281
doxygen_bin = get_doxygen_bin()
282282
version_result = subprocess.run(
@@ -319,13 +319,13 @@ def main():
319319
with tempfile.TemporaryDirectory() as tmpdir:
320320
snapshot_output_dir = (
321321
args.output_dir or tmpdir
322-
if args.check
322+
if args.validate
323323
else args.output_dir or get_default_snapshot_dir()
324324
)
325325

326326
build_snapshots(
327327
output_dir=snapshot_output_dir,
328-
verbose=not args.check,
328+
verbose=not args.validate,
329329
snapshot_configs=snapshot_configs,
330330
react_native_dir=react_native_package_dir,
331331
input_filter=input_filter,
@@ -334,13 +334,13 @@ def main():
334334
keep_xml=args.xml,
335335
)
336336

337-
if args.check:
337+
if args.validate:
338338
snapshot_dir = args.snapshot_dir or get_default_snapshot_dir()
339339

340-
if not check_snapshots(snapshot_output_dir, snapshot_dir):
340+
if not validate_snapshots(snapshot_output_dir, snapshot_dir):
341341
sys.exit(1)
342342

343-
print("All snapshot checks passed")
343+
print("All snapshot validations passed")
344344

345345

346346
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)