Skip to content

Commit ec0b729

Browse files
authored
feat: simplify pre-commit hook (#559)
* update: adds .vscode/settings.json to gitignore * update: simplifies black config - uses extend-exclude to use pre-configured black exclusions * feat: sets up pre-commit - Does not run pylint/pyright since they can't be used in pre-commit directly - TODO: migrate branch restrictions if required * feat: move branch checks to pre-commit * update: adds hook to prevent commits to master * update: use pre-commit to set up hooks * refactor: moves configs to pyproject.toml - Removes random `lib64` symlink - Updates makefile with new commands * lint: ruff + import sorting * feat: update ruff configs * lint: more ruff * lint: pyright * refactor: consolidates workflows * refactor: use matrix for running lint workflow * update: split check into a different step for clarity * fix: adds venv activation to steps * update: reduce workflow runs for lint jobs - Remove trigger for PR edits * update: ignore .ruff_cache * fix: broken test due to line change * update: move pyright to run on explicit request - Avoids issues with IDE integration - Already checked in workflows - Keeps hooks fast * update: handle PR branch checks * fix: target branch checks * lint: formatting
1 parent 968c756 commit ec0b729

File tree

440 files changed

+2579
-2184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

440 files changed

+2579
-2184
lines changed

Diff for: .circleci/authReactDjango.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ else
105105
echo "test failed for auth-react tests... exiting!"
106106
exit 1
107107
fi
108-
fi
108+
fi

Diff for: .circleci/authReactFastApi.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ else
100100
echo "test failed for auth-react tests... exiting!"
101101
exit 1
102102
fi
103-
fi
103+
fi

Diff for: .circleci/authReactFlask.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ else
102102
echo "test failed for auth-react tests... exiting!"
103103
exit 1
104104
fi
105-
fi
105+
fi

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ workflows:
6161
filters:
6262
branches:
6363
only:
64-
- master
64+
- master

Diff for: .circleci/installJava.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
wget https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz
44
mkdir /usr/java
5-
mv openjdk-15.0.1_linux-x64_bin.tar.gz /usr/java
5+
mv openjdk-15.0.1_linux-x64_bin.tar.gz /usr/java
66
cd /usr/java
77
tar -xzvf openjdk-15.0.1_linux-x64_bin.tar.gz
88
rm openjdk-15.0.1_linux-x64_bin.tar.gz

Diff for: .circleci/markAsSuccess.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ if [ $responseStatus -ne "200" ]
3636
then
3737
echo "patch api failed"
3838
exit 1
39-
fi
39+
fi

Diff for: .circleci/markDevTagAsTestNotPassed.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ then
3737
echo "failed core PUT API status code: $responseStatus. Exiting!"
3838
cat out.bin
3939
exit 1
40-
fi
40+
fi

Diff for: .circleci/setupAndTestBackendSDKWithFreeCore.sh

-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,3 @@ fi
8383

8484
# kill test-server
8585
kill $(lsof -t -i:$API_PORT)
86-

Diff for: .circleci/setupAndTestWithAuthReact.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ git checkout $2
5858
npm run init > /dev/null
5959
(cd ./examples/for-tests && npm run link) # this is there because in linux machine, postinstall in npm doesn't work..
6060
cd ./test/server/
61-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
62-
npm i
61+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
62+
npm i
6363
cd ../../../project/tests/auth-react/fastapi-server
6464
export PYTHONPATH="${PYTHONPATH}:/root/project"
6565
uvicorn app:app --host 0.0.0.0 --port 8083 &
6666
pid=$!
6767
cd ../../../../supertokens-auth-react/
6868

69-
# When testing with supertokens-auth-react for version >= 0.18 the SKIP_OAUTH
70-
# flag will not be checked because Auth0 is used as a provider so that the Thirdparty tests can run reliably.
69+
# When testing with supertokens-auth-react for version >= 0.18 the SKIP_OAUTH
70+
# flag will not be checked because Auth0 is used as a provider so that the Thirdparty tests can run reliably.
7171
# In versions lower than 0.18 Github is used as the provider.
7272

7373
# SKIP_OAUTH=true npm run test-with-non-node
@@ -143,4 +143,4 @@ fi
143143
echo "all tests passed, killing processes: $pid"
144144
kill -9 $pid
145145
rm -rf ./test/server/node_modules/supertokens-node
146-
git checkout HEAD -- ./test/server/package.json
146+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/setupAndTestWithAuthReactWithDjango.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ git checkout $2
6060
npm run init > /dev/null
6161
(cd ./examples/for-tests && npm run link) # this is there because in linux machine, postinstall in npm doesn't work..
6262
cd ./test/server/
63-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
63+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6464
npm i
6565
cd ../../../project/tests/auth-react/django3x
6666
export PYTHONPATH="${PYTHONPATH}:/root/project"
6767
uvicorn mysite.asgi:application --port 8083 &
6868
pid=$!
6969
cd ../../../../supertokens-auth-react/
7070

71-
# When testing with supertokens-auth-react for version >= 0.18 the SKIP_OAUTH
72-
# flag will not be checked because Auth0 is used as a provider so that the Thirdparty tests can run reliably.
71+
# When testing with supertokens-auth-react for version >= 0.18 the SKIP_OAUTH
72+
# flag will not be checked because Auth0 is used as a provider so that the Thirdparty tests can run reliably.
7373
# In versions lower than 0.18 Github is used as the provider.
7474

7575
# SKIP_OAUTH=true npm run test-with-non-node

Diff for: .circleci/setupAndTestWithAuthReactWithFlask.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ git checkout $2
6060
npm run init > /dev/null
6161
(cd ./examples/for-tests && npm run link) # this is there because in linux machine, postinstall in npm doesn't work..
6262
cd ./test/server/
63-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
63+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6464
npm i
6565
cd ../../../project/tests/auth-react/flask-server
6666
export PYTHONPATH="${PYTHONPATH}:/root/project"
6767
python3 app.py --port 8083 &
6868
pid=$!
6969
cd ../../../../supertokens-auth-react/
7070

71-
# When testing with supertokens-auth-react for version >= 0.18 the SKIP_OAUTH
72-
# flag will not be checked because Auth0 is used as a provider so that the Thirdparty tests can run reliably.
71+
# When testing with supertokens-auth-react for version >= 0.18 the SKIP_OAUTH
72+
# flag will not be checked because Auth0 is used as a provider so that the Thirdparty tests can run reliably.
7373
# In versions lower than 0.18 Github is used as the provider.
7474

7575
# SKIP_OAUTH=true npm run test-with-non-node
@@ -145,4 +145,4 @@ fi
145145
echo "all tests passed, killing processes: $pid"
146146
kill -9 $pid
147147
rm -rf ./test/server/node_modules/supertokens-node
148-
git checkout HEAD -- ./test/server/package.json
148+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/setupAndTestWithFrontend.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ pid=$!
6262
uvicorn app:app --host 0.0.0.0 --port 8082 &
6363
pid2=$!
6464
cd ../../../../supertokens-website/test/server
65-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
65+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6666
npm i
6767
cd ../../
68-
npm i
68+
npm i
6969

7070
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then
7171
TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npx mocha --exit --no-config --require isomorphic-fetch --timeout 500000 $(npx mocha-split-tests -r ./runtime.log -t $CIRCLE_NODE_TOTAL -g $CIRCLE_NODE_INDEX -f 'test/*.test.js')
@@ -86,4 +86,4 @@ echo "all tests passed, killing processes: $pid and $pid2"
8686
kill -9 $pid
8787
kill -9 $pid2
8888
rm -rf ./test/server/node_modules/supertokens-node
89-
git checkout HEAD -- ./test/server/package.json
89+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/setupAndTestWithFrontendWithDjango.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pid=$!
6262
uvicorn mysite.asgi:application --port 8082 &
6363
pid2=$!
6464
cd ../../../../supertokens-website/test/server
65-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
65+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6666
npm i
6767
cd ../../
6868
npm i
@@ -86,4 +86,4 @@ echo "all tests passed, killing processes: $pid and $pid2"
8686
kill -9 $pid
8787
kill -9 $pid2
8888
rm -rf ./test/server/node_modules/supertokens-node
89-
git checkout HEAD -- ./test/server/package.json
89+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/setupAndTestWithFrontendWithDjango2x.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pid=$!
6262
gunicorn mysite.wsgi --bind 0.0.0.0:8082 &
6363
pid2=$!
6464
cd ../../../../supertokens-website/test/server
65-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
65+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6666
npm i
6767
cd ../../
6868
npm i

Diff for: .circleci/setupAndTestWithFrontendWithDrfAsync.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pid=$!
6262
uvicorn mysite.asgi:application --port 8082 &
6363
pid2=$!
6464
cd ../../../../supertokens-website/test/server
65-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
65+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6666
npm i
6767
cd ../../
6868
npm i
@@ -86,4 +86,4 @@ echo "all tests passed, killing processes: $pid and $pid2"
8686
kill -9 $pid
8787
kill -9 $pid2
8888
rm -rf ./test/server/node_modules/supertokens-node
89-
git checkout HEAD -- ./test/server/package.json
89+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/setupAndTestWithFrontendWithDrfSync.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pid=$!
6262
gunicorn mysite.wsgi --bind 0.0.0.0:8082 &
6363
pid2=$!
6464
cd ../../../../supertokens-website/test/server
65-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
65+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6666
npm i
6767
cd ../../
6868
npm i
@@ -86,4 +86,4 @@ echo "all tests passed, killing processes: $pid and $pid2"
8686
kill -9 $pid
8787
kill -9 $pid2
8888
rm -rf ./test/server/node_modules/supertokens-node
89-
git checkout HEAD -- ./test/server/package.json
89+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/setupAndTestWithFrontendWithFlask.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pid=$!
6262
python3 app.py --port 8082 &
6363
pid2=$!
6464
cd ../../../../supertokens-website/test/server
65-
npm i git+https://github.com:supertokens/supertokens-node.git#$3
65+
npm i git+https://github.com:supertokens/supertokens-node.git#$3
6666
npm i
6767
cd ../../
6868
npm i
@@ -86,4 +86,4 @@ echo "all tests passed, killing processes: $pid and $pid2"
8686
kill -9 $pid
8787
kill -9 $pid2
8888
rm -rf ./test/server/node_modules/supertokens-node
89-
git checkout HEAD -- ./test/server/package.json
89+
git checkout HEAD -- ./test/server/package.json

Diff for: .circleci/updateDocsInWebsite.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ cp -r ../html/supertokens_python/* ../../supertokens-backend-website/app/docs/sd
2525
# push to git
2626
git config --global user.email "$EMAIL"
2727
git config --global user.name "$NAME"
28-
(cd ../../supertokens-backend-website && git add --all && git commit -m"updates python docs" && git pull && git push && ./releaseDev.sh)
28+
(cd ../../supertokens-backend-website && git add --all && git commit -m"updates python docs" && git pull && git push && ./releaseDev.sh)

Diff for: .cursorrules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
You are an expert Python and Typescript developer. Your job is to convert node code (in typescript) into Python code. The python code then goes into this SDK. The python code style should keep in mind:
22
- Avoid using TypeDict
3-
- Avoid using generic Dict as much as possible, except when defining the types for `user_context`.
3+
- Avoid using generic Dict as much as possible, except when defining the types for `user_context`.
44
- If a function has multiple `status` strings as outputs, then define one unique class per unique `status` string. The class name should be such that it indicates the status it is associated with.
55
- Variable and function names should be in snake_case. Class names in PascalCase.
66
- Whenever importing `Literal`, import it from `typing_extensions`, and not `types`.
77
- Do not use `|` for OR type, instead use `Union`
88
- When defining API interface functions, make sure the output classes inherit from `APIResponse` class, and that they have a `to_json` function defined whose output matches the structure of the provided Typescript code output objects.
99

10-
The semantic of the python code should be the same as what's of the provided Typescript code.
10+
The semantic of the python code should be the same as what's of the provided Typescript code.

Diff for: .github/helpers/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
node_modules
2-
package-lock.json
2+
package-lock.json

Diff for: .github/helpers/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"axios": "^0.26.1",
1414
"github-workflow-helpers": "github:supertokens/github-workflow-helpers"
1515
}
16-
}
16+
}

Diff for: .github/workflows/github-actions-changelog.yml

-15
This file was deleted.

Diff for: .github/workflows/lint-pr-title.yml

-20
This file was deleted.

Diff for: .github/workflows/lint-pr.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Lint PR"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
lint-pr-title:
13+
name: Lint PR Title
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: amannn/action-semantic-pull-request@v3
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
validateSingleCommit: true
21+
22+
# Enforces the update of a changelog file on every pull request
23+
lint-changelog:
24+
name: Enforce Changelogs
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: dangoslen/changelog-enforcer@v2
29+
with:
30+
changeLogPath: "CHANGELOG.md"
31+
skipLabels: "Skip-Changelog"

0 commit comments

Comments
 (0)