Files
react-native/.github/workflow-scripts/analyze_code.sh
T
Tim Yung cf9d28a097 RN: Improve lint-ci Script (#51853)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51853

While testing D75988059 with D76047973, I noticed a few opportunities to improve the script used by `yarn lint-ci`:

- The exit code does not currently propagate, meaning `lint-ci` will succeed when it shouldn't.
- The shell script uses some non-idiomatic practices, so this improves it.

Changelog:
[Internal]

Reviewed By: kassens, cipolleschi

Differential Revision: D76049502

fbshipit-source-id: ebefddf0909edc89cd97de756b93bfaaa3d7cdef
2025-06-05 10:14:06 -07:00

28 lines
630 B
Bash
Executable File

#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
export GITHUB_OWNER=-facebook
export GITHUB_REPO=-react-native
{
echo eslint
npm run lint --silent -- --format=json
echo flow
npm run flow-check --silent --json
echo google-java-format
node scripts/lint-java.js --diff
} | node packages/react-native-bots/code-analysis-bot.js
STATUS=$?
if [ $STATUS == 0 ]; then
echo "Code analyzed successfully."
else
echo "Code analysis failed, error status $STATUS."
fi
exit $STATUS