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

Swap out Flake8 for ruff in linting #232

Merged
merged 4 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 4 additions & 7 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ DECODE_LOG := 2>&1 | python3 -u src/logging/util/decodelog.py
SHELL = /bin/bash -o pipefail

# The APP_DIR variable is the path from the root of the repository to this Makefile.
# This variable is used to display errors from Flake8 and MyPy in the 'Files Changed'
# This variable is used to display errors from MyPy in the 'Files Changed'
# section of a pull request. If this is set to the incorrect value, you won't be able
# to see the errors on the correct files in that section
APP_DIR := app
ifdef CI
DOCKER_EXEC_ARGS := -T -e CI -e PYTEST_ADDOPTS="--color=yes"
FLAKE8_FORMAT := '::warning file=$(APP_DIR)/%(path)s,line=%(row)d,col=%(col)d::%(path)s:%(row)d:%(col)d: %(code)s %(text)s'
MYPY_FLAGS := --no-pretty
MYPY_POSTPROC := | perl -pe "s/^(.+):(\d+):(\d+): error: (.*)/::warning file=$(APP_DIR)\/\1,line=\2,col=\3::\4/"
else
FLAKE8_FORMAT := default
endif

# By default, all python/poetry commands will run inside of the docker container
Expand Down Expand Up @@ -199,10 +196,10 @@ format-check: ## Check file formatting

lint: lint-py ## Lint

lint-py: lint-flake lint-mypy
lint-py: lint-ruff lint-mypy

lint-flake:
$(PY_RUN_CMD) flake8 --format=$(FLAKE8_FORMAT) src tests
lint-ruff:
$(PY_RUN_CMD) ruff check src tests

lint-mypy:
$(PY_RUN_CMD) mypy --show-error-codes $(MYPY_FLAGS) src $(MYPY_POSTPROC)
Expand Down
230 changes: 220 additions & 10 deletions app/openapi.generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,28 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Service Unavailable
tags:
- Health
Expand Down Expand Up @@ -85,13 +106,55 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/ValidationError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Validation error
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Authentication error
tags:
- User
Expand Down Expand Up @@ -140,13 +203,55 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/ValidationError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Validation error
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Authentication error
tags:
- User
Expand Down Expand Up @@ -198,13 +303,55 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Authentication error
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Not found
tags:
- User
Expand Down Expand Up @@ -250,19 +397,82 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/ValidationError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Validation error
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Authentication error
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPError'
type: object
properties:
message:
type: string
description: The message to return
data:
$ref: '#/components/schemas/HTTPError'
status_code:
type: integer
description: The HTTP status code
warnings:
type: array
items:
$ref: '#/components/schemas/ValidationError'
errors:
type: array
items:
$ref: '#/components/schemas/ValidationError'
pagination_info:
description: The pagination information for paginated endpoints
allOf:
- $ref: '#/components/schemas/PaginationInfo'
description: Not found
tags:
- User
Expand Down
Loading
Loading