-
Notifications
You must be signed in to change notification settings - Fork 0
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
Introduce Linting #31
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
46672a1
Linting
judtinzhang 395888d
Add pre-commit
judtinzhang 5065fbd
Test pre-commit
judtinzhang a5c55cc
Remove unnecessary items in setup.cfg
judtinzhang 4824d46
Fixed black
judtinzhang 7f2fab6
Change backend check to match penn mobile
judtinzhang e18ca74
Revert
judtinzhang ed710af
Lint
judtinzhang d1321ee
Add back coverage
judtinzhang 575fded
Skip django
judtinzhang c97d387
Add linting test
judtinzhang beaf219
Fix job
judtinzhang 135f653
Merge
judtinzhang 6666971
Merge
judtinzhang d404020
Add pipenv
judtinzhang 433beff
Pipenv install
judtinzhang 385f621
Please
judtinzhang 4574732
Please
judtinzhang 5bcc345
Lint
judtinzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,45 @@ jobs: | |
flake: true | ||
black: true | ||
pythonVersion: 3.11-buster | ||
skipDjangoCheck: true | ||
|
||
linting: | ||
name: Linting Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local/share/virtualenvs | ||
key: v0-${{ hashFiles('./Pipfile.lock') }} | ||
- name: Install Dependencies (pipenv) | ||
shell: bash | ||
continue-on-error: true | ||
run: |- | ||
cd . | ||
pip install pipenv | ||
pipenv install --dev | ||
- name: Lint (flake8) | ||
run: |- | ||
cd . | ||
pipenv run flake8 . | ||
- name: Lint (black) | ||
run: |- | ||
cd . | ||
pipenv run black --check . | ||
container: | ||
image: python:3.11-buster | ||
env: | ||
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres | ||
services: | ||
postgres: | ||
image: postgres:12 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
POSTGRES_PASSWORD: postgres | ||
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5" | ||
|
||
publish-backend: | ||
uses: pennlabs/shared-actions/.github/workflows/[email protected] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
repos: | ||
- repo: https://github.com/pennlabs/pre-commit-hooks | ||
rev: v1.0-mobile-backend | ||
hooks: | ||
- id: black | ||
args: [] | ||
- id: isort | ||
args: [] | ||
- id: flake8 | ||
args: [--config, setup.cfg] | ||
- id: detect-private-key |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,11 @@ git clone [email protected]:pennlabs/labs-analytics.git | |
pipenv install | ||
``` | ||
|
||
4. Setting up precommit: | ||
```bash | ||
pipenv run pre-commit install | ||
``` | ||
|
||
### Setting up for local development | ||
|
||
This guide details the steps to set up `Redis`, `Redis Insight`, `postgres` and `pgweb` instances using Docker, making it easy for development. | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import os | ||
|
||
|
||
REDIS_URL = os.getenv("REDIS_URL") | ||
REDIS_BATCH_SIZE = 1000 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[flake8] | ||
max-line-length = 100 | ||
exclude = .venv, migrations | ||
inline-quotes = double | ||
ignore = E203, W503 | ||
|
||
[isort] | ||
default_section = THIRDPARTY | ||
known_first_party = src, scripts | ||
line_length = 100 | ||
lines_after_imports = 2 | ||
multi_line_output = 3 | ||
include_trailing_comma = True | ||
use_parentheses = True | ||
|
||
[coverage:run] | ||
source = . |
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
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
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
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a reason we don't need isort anymore?