-
Notifications
You must be signed in to change notification settings - Fork 33
Maintainability upgrades and fixes #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
bb9d0df
572236c
b54b709
072b949
1bba206
91f4cec
ab44b1c
87c49a8
d4ef4da
2974b9a
6aedd5b
1f388ca
f649c45
e1ba438
c386b05
75fa791
4ec5d0f
c55cc28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,4 +55,4 @@ | |
| "yarn install && `yarn bin gulp production`;", | ||
| "/home/codespace/.local/bin/flask db upgrade;" | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,10 @@ | ||
| node_modules/ | ||
| .github/ | ||
| .mypy_cache/ | ||
| .pytest_cache/ | ||
| __pycache__/ | ||
| *.pyc | ||
| .venv/ | ||
| .scannerwork/ | ||
| .ruff_cache/ | ||
| .devcontainer/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: Format App | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master, develop] | ||
|
|
||
| jobs: | ||
| format: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.9' | ||
|
|
||
| - name: Install ruff | ||
| run: pip install ruff | ||
|
|
||
| - name: Run ruff format | ||
| run: ruff format packet | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add . | ||
| git diff --cached --quiet || git commit -m "Auto-format code with ruff" | ||
| git push | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,11 +27,11 @@ jobs: | |
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Lint with pylint | ||
| python -m pip install uv | ||
| if [ -f requirements.txt ]; then uv pip install -r requirements.txt --system; fi | ||
| - name: Lint with ruff and pylint | ||
| run: | | ||
| pylint packet/routes packet | ||
| ruff check packet && pylint packet/routes packet | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: typically each linter/formatter is run as a separate stage since its easier to tell which one failed |
||
|
|
||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -50,8 +50,8 @@ jobs: | |
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| python -m pip install uv | ||
| if [ -f requirements.txt ]; then uv pip install -r requirements.txt --system; fi | ||
| - name: Typecheck with mypy | ||
| run: | | ||
| # Disabled error codes to discard errors from imports | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Push to sonarqube | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - '*' | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
|
|
||
|
|
||
| jobs: | ||
| build: | ||
| name: Build and analyze | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
| - uses: SonarSource/sonarqube-scan-action@v6 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
| # If you wish to fail your job when the Quality Gate is red, uncomment the | ||
| # following lines. This would typically be used to fail a deployment. | ||
| # - uses: SonarSource/sonarqube-quality-gate-action@v1 | ||
| # timeout-minutes: 5 | ||
| # env: | ||
| # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # CSH Web Packet | ||
|
|
||
| [](https://www.python.org/downloads/release/python-390/) | ||
| [](https://www.python.org/downloads/release/python39/) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this changed? The previous link was valid and this one is to a 404. |
||
| [](https://travis-ci.com/ComputerScienceHouse/packet) | ||
|
|
||
| Packet is used by CSH to facilitate the freshmen packet portion of our introductory member evaluation process. This is | ||
|
|
@@ -58,7 +58,7 @@ reliable method. | |
|
|
||
| Use `pip3 install -r requirements.txt` to install the required python dependencies. A | ||
| [venv](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) is *highly* | ||
| recommended. To add new dependencies, add them to `requirements.in` and run `pip-compile requirements.in` to update | ||
| recommended. To add new dependencies add them to `requirements.in` and run `uv pip compile requirements.in -o requirements.txt` to update | ||
| the main file. | ||
|
|
||
| If 1 or more of the packages fail to install the likely issue is missing header files for the libraries with native C | ||
|
|
@@ -133,11 +133,12 @@ All DB commands are from the `Flask-Migrate` library and are used to configure D | |
| docs [here](https://flask-migrate.readthedocs.io/en/latest/) for details. | ||
|
|
||
| ## Code standards | ||
| This project is configured to use Pylint and mypy. Commits will be pylinted and typechecked by GitHub actions and if the | ||
| This project is configured to use ruff, pylint, and mypy. Commits will be ruffed, pylinted, and typechecked by GitHub actions and if the | ||
| score drops your build will fail blocking you from merging. To make your life easier just run it before making a PR. | ||
|
|
||
| To run pylint and mypy use these commands: | ||
| To run ruff, pylint, and mypy use these commands: | ||
| ```bash | ||
| ruff check packet | ||
| pylint packet/routes packet | ||
| mypy --disable-error-code import --disable-error-code name-defined --disallow-untyped-defs --exclude routes packet | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,4 +9,4 @@ let pylintTask = (cb) => { | |
| }); | ||
| }; | ||
|
|
||
| gulp.task('pylint', pylintTask); | ||
| gulp.task('pylint', pylintTask); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| const gulp = require('gulp'); | ||
| const exec = require('child_process').exec; | ||
|
|
||
| let ruffTask = (cb) => { | ||
| exec('ruff check packet', function (err, stdout, stderr) { | ||
| console.log(stdout); | ||
| console.log(stderr); | ||
| cb(err); | ||
| }); | ||
| }; | ||
|
|
||
| gulp.task('ruff', ruffTask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a little overengineered to have an auto format workflow especially since there is a format check part of the linting workflow already. I think it'd be better to let people fix the formatting themselves instead of a github bot committing to their branch automatically.