Skip to content
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

Add pre commit for python linter and formatter #259

Merged
merged 25 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ stage
.gitignore
**/__pycache__/
mkdocs/
**/.venv/
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Identify what to put in the following fields:
og:url
g:type
og:title
og:description
og:image
og:description
og:image
og:type (optional)
og:local (option)
using the standards set forth in the instructions.
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ labels: ''
assignees: ''

---


6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/lighthouse--accessibility---forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ assignees: ''
### Overview
In order for your sites form(s) to be usable by visitors using screen readers all the form <input> elements need labels. There are specific details and exceptions, which can be found in the instructions below.

### Action Items
### Action Items
*If your site already has forms* review the instructions and document the changes needed to bring your form(s) into WCAG compliance, by commenting on this issue.
*If your site does not have forms* review the instructions and design new forms using the WCAG standards.
*If your site does not have forms* review the instructions and design new forms using the WCAG standards.

### Instructions
Deque University
Deque University
https://dequeuniversity.com/rules/axe/3.2/label
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The formatting of links can make them readable or unreadable by screen readers.

### Action Items
*If your site already has links* review the instructions and document the changes needed to bring your link(s) into WCAG compliance, by commenting on this issue.
*If your site does not have links yet* review the instructions and design all new links using the WCAG standards.
*If your site does not have links yet* review the instructions and design all new links using the WCAG standards.

### Instructions
Deque University
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ assignees: ''
---

### Overview
Links to cross-origin destinations are unsafe both from a security and performance perspective.
Links to cross-origin destinations are unsafe both from a security and performance perspective.

### Action Item
Run [Lighthouse](https://developers.google.com/web/tools/lighthouse/) and then follow the instructions in [cross-origin destinations are unsafe]
(https://developers.google.com/web/tools/lighthouse/audits/noopener) .
(https://developers.google.com/web/tools/lighthouse/audits/noopener) .

## Summary of instructions
When using *target=_blank* also adding *rel="noopener"* to the tag ensures that new page runs in a separate process.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/lighthouse--image-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assignees: ''
When you run the lighthouse review it may suggest some specific image optimizations such as choosing another image format and making those changes may or may not improve your sites actual performance.

### Action Items
Run lighthouse on a local version of the site and then apply suggested changes and retest locally before determining if you want to keep the changes.
Run lighthouse on a local version of the site and then apply suggested changes and retest locally before determining if you want to keep the changes.

### Instructions/Resources
Google's Tools for Web Developers: [Optimize Images](https://developers.google.com/web/tools/lighthouse/audits/optimize-images)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ assignees: ''

---

### Overview
### Overview
Describe the purpose for the proposal change

### Action items
- [ ] Indicate current state in a yaml snipit here:

- [ ] Indicate desired future state in a yaml snipit here:

- [ ] Perform test
- [ ] Perform test
- [ ] one project.md file
- [ ] updating logic of appropriate include file
- [ ] Get signoff
- [ ] update all project.md files with new or revised fields
- [ ] Update Template project.md wiki page
- [ ] Update Template project.md wiki page
- [ ] Submit pull request - indicating Issue #294 is affected (format changes log), and the text "fixes Issue #[number that you are creating now]

### Resources
Expand Down
7 changes: 3 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Fixes #

### Changes

-
-
-
-
-
-

<!-- Please ignore everything below until #78 closes. -->

Expand All @@ -24,4 +24,3 @@ Fixes #
<br>
</details>
-->

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ data/

**/super-linter.log
app/staticfiles

**/.venv/
2 changes: 1 addition & 1 deletion app/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"@babel/env",
"@babel/preset-react"
]
}
}
55 changes: 55 additions & 0 deletions app/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
default_language_version:
# default language version for each language used in the repository
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
# See https://pre-commit.com/hooks.html for more hooks
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: name-tests-test
args: [ "--django" ]
- id: trailing-whitespace
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--settings-file", "app/setup.cfg"]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: []
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ["--config", "app/setup.cfg"]
additional_dependencies: [
"flake8-bugbear",
"flake8-comprehensions",
"flake8-mutable",
"flake8-print",
"flake8-simplify",
]
- repo: https://github.com/pycqa/pylint
rev: "v2.14.0-b1"
hooks:
- id: pylint
exclude: "[a-zA-Z]*/(migrations)/(.)*|(mkdocs)/(.)*"
args: [
"--load-plugins=pylint_django",
"--disable=C0114,C0115,C0116",
"--django-settings-module=config.settings",
"--rcfile=app/setup.cfg",
]
additional_dependencies: [
django,
djangorestframework,
pylint_django,
]
32 changes: 32 additions & 0 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# App

Contains the source code for the backend piece of Civic Tech Jobs

---
## Overview
TBD

---
## Getting Started
### Pre-requisites
- python 3.X
- pip
- venv
- docker
- docker-compose

### Setup Local Environment
- Clone this repo
- Navigate into this directory
- `cd ./CivicTechJobs/app`
- Setup your python virtual environment and install dependencies
- `python -m venv .venv`
- `source .venv/bin/activate`
- `pip install -r ./requirements.txt`
- To deactivate virtual environment, type `deactivate`
Aveline-art marked this conversation as resolved.
Show resolved Hide resolved
- Setup git hooks for pre-commit (only has to be done once)
- `pre-commit install`
- `pre-commit autoupdate`
- `pre-commit run --all-files`
- run to test it's working. should return no errors
-
2 changes: 1 addition & 1 deletion app/config/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_asgi_application()
Loading