Add methods to initialize and access turtleList, and refactor turtle access methods for improved code consistency and readability. #3567
This file contains 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
name: ESLint | |
on: | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
name: Lint updated JavaScript files with ESLint | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- name: Get changed files | |
id: getfile | |
run: | | |
CHANGED_FILES="$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | xargs)" | |
export CHANGED_FILES # the export command will fail if the inner shell expansion failed | |
echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT | |
- name: Install ESLint | |
run: npm install eslint | |
- name: Lint changed files using ESLint | |
run: | | |
for i in ${{ steps.getfile.outputs.files }} | |
do | |
if [[ "$i" == "D" ]] | |
then | |
ignore=1 | |
elif [[ ( "$i" == "M" ) || ( "$i" == "A" ) || ( "$i" == "R" ) || ( "$i" == "C" ) || ( "$i" == "U" ) ]] | |
then | |
ignore=0 | |
fi | |
echo "file $i $ignore" | |
if [[ "$i" == *".js" && $ignore == 0 ]] | |
then | |
echo "linting $i" | |
npx eslint $i | |
fi | |
done |