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

Linting update #116

Merged
merged 7 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
34 changes: 18 additions & 16 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
#### Helpful background context
Describe any additional context beyond what the PR accomplishes if it is likely
to be useful to a reviewer.
### Purpose and background context
Describe the overall purpose of the PR changes and any useful background context.

Delete this section if it isn't applicable to the PR.

#### How can a reviewer manually see the effects of these changes?
### How can a reviewer manually see the effects of these changes?
Explain how to see the proposed changes in the application if possible.

Delete this section if it isn't applicable to the PR.

#### What are the relevant tickets?
Include links to Jira Software and/or Jira Service Management tickets here.
### Includes new or updated dependencies?
YES | NO

### Changes expectations for external applications?
YES | NO

### What are the relevant tickets?
- Include links to Jira Software and/or Jira Service Management tickets here.

#### Developer
### Developer
- [ ] All new ENV is documented in README
- [ ] All new ENV has been added to staging and production environments
- [ ] All related Jira tickets are linked in commit message(s)
- [ ] Stakeholder approval has been confirmed (or is not needed)

#### Code Reviewer
- [ ] The commit message is clear and follows our guidelines
(not just this pull request message)
### Code Reviewer(s)
- [ ] The commit message is clear and follows our guidelines (not just this PR message)
- [ ] There are appropriate tests covering any new functionality
- [ ] The documentation has been updated or is unnecessary
- [ ] The changes have been verified
- [ ] The provided documentation is sufficient for understanding any new functionality introduced
- [ ] Any manual tests have been performed and verified
- [ ] New dependencies are appropriate or there were no changes

#### Includes new or updated dependencies?
YES | NO
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
default_language_version:
python: python3.11 # set for project python version
repos:
- repo: local
hooks:
- id: black-apply
name: black-apply
entry: pipenv run black
language: system
pass_filenames: true
types: ["python"]
- id: mypy
name: mypy
entry: pipenv run mypy
language: system
pass_filenames: true
types: ["python"]
exclude: "tests/"
- id: ruff-apply
name: ruff-apply
entry: pipenv run ruff check --fix
language: system
pass_filenames: true
types: ["python"]
- id: safety
name: safety
entry: pipenv check
language: system
pass_filenames: false
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ECR_NAME_DEV:=transmogrifier-dev
ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/transmogrifier-dev
### End of Terraform-generated header ###

help: ## Print this message
@awk 'BEGIN { FS = ":.*##"; print "Usage: make <target>\n\nTargets:" } \
/^[-_[:alpha:]]+:.?*##/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)

### Dependency commands ###
install: ## Install script and dependencies
Expand All @@ -24,23 +27,30 @@ coveralls: test
pipenv run coverage lcov -o ./coverage/lcov.info


### Linting commands ###
lint: bandit black flake8 isort mypy ## Lint the repo

bandit:
pipenv run bandit -r transmogrifier
# linting commands
lint: black mypy ruff safety

black:
pipenv run black --check --diff .

flake8:
pipenv run flake8 .
mypy:
pipenv run mypy .

isort:
pipenv run isort . --check --diff
ruff:
pipenv run ruff check .

mypy:
pipenv run mypy transmogrifier
safety:
pipenv check
pipenv verify

# apply changes to resolve any linting errors
lint-apply: black-apply ruff-apply

black-apply:
pipenv run black .

ruff-apply:
pipenv run ruff check --fix .


### Terraform-generated Developer Deploy Commands for Dev environment ###
Expand Down
8 changes: 4 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ python-dateutil = "*"
sentry-sdk = "*"
smart-open = {version = "*", extras = ["s3"]}
types-python-dateutil = "*"
lxml-stubs = "*"

[dev-packages]
bandit = "*"
black = "*"
coverage = "*"
coveralls = "*"
flake8 = "*"
isort = "*"
mypy = "*"
pytest = "*"
ipython = "*"
pre-commit = "*"
ruff = "*"
safety = "*"

[requires]
python_version = "3.11"
Expand Down
Loading
Loading