Skip to content
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
14 changes: 14 additions & 0 deletions .github/workflows/matchers/ruff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"problemMatcher": [
{
"owner": "ruff",
"pattern": [
{
"regexp": "^(Would reformat): (.+)$",
"message": 1,
"file": 2
}
]
}
]
}
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"project_name": "Project Name",
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '').replace('-', '').replace('_', '') }}",
"django_version": ["5.0"],
"django_version": ["5.2"],
"multilingual": "n",
"geodjango": "n",
"_copy_without_render": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ jobs:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: password
TOX_OVERRIDE: "testenv.pass_env=PG*"
RUFF_OUTPUT_FORMAT: github
TOX_OVERRIDE: "testenv.pass_env=PG*,RUFF_OUTPUT_FORMAT"
run: |
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
echo "::add-matcher::.github/workflows/matchers/ruff.json"
tox
services:
postgres:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ jobs:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: password
TOX_OVERRIDE: "testenv.pass_env=PG*"
RUFF_OUTPUT_FORMAT: github
TOX_OVERRIDE: "testenv.pass_env=PG*,RUFF_OUTPUT_FORMAT"
run: |
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
echo "::add-matcher::.github/workflows/matchers/ruff.json"
tox
services:
postgres:
Expand Down
40 changes: 9 additions & 31 deletions {{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ check: ## Check for any obvious errors in the project's setup.
check: pipdeptree-check npm-check django-check

format: ## Run this project's code formatters.
format: ruff-format black-format isort-format prettier-format stylelint-format djlint-format
format: ruff-format prettier-format stylelint-format djlint-format

lint: ## Lint the project.
lint: ruff-lint black-lint isort-lint flake8-lint npm-install eslint-lint prettier-lint stylelint-lint djlint-lint djlint-check
lint: ruff-lint eslint-lint prettier-lint stylelint-lint djlint-lint djlint-check

test: ## Run unit and integration tests.
test: django-test
Expand All @@ -68,8 +68,6 @@ test-report: coverage-clean test coverage-report
deploy: ## Deploy this project to demo or live.
deploy: fab-deploy



# ---------------
# Utility targets
# ---------------
Expand Down Expand Up @@ -119,28 +117,6 @@ fab-deploy:
fab deploy


# Ruff
ruff-lint:
ruff check .
ruff format --check apps project

ruff-format:
ruff check --fix-only .


# ISort
isort-lint:
isort --check-only --diff apps project

isort-format:
isort apps project


# Flake8
flake8-lint:
flake8 apps project


# Coverage
coverage-report: coverage-html coverage-xml
coverage report --show-missing
Expand Down Expand Up @@ -225,12 +201,14 @@ stylelint-format:
npm run stylelint --silent -- static/src/scss --fix


# Black
black-lint:
black --check apps project
# Ruff
ruff-lint:
ruff check
ruff format --check

black-format:
black apps project
ruff-format:
ruff check --fix-only
ruff format


# DJ lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class UserFactory(factory.django.DjangoModelFactory):
username = factory.Sequence(lambda n: f"user{n}")
first_name = factory.Faker("first_name")
last_name = factory.Faker("last_name")
email = factory.Sequence(lambda n: "person{0}@example.org".format(n))
password = "test123"
email = factory.Sequence(lambda n: f"person{n}@example.org")
password = "test123" # noqa:S105

class Meta:
model = User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
BROWSERSYNC_URL = "http://{host}:{port}/browser-sync/browser-sync-client.js?t={time}"


@functools.lru_cache()
@functools.cache
def browsersync_url(host):
"""
Return the browsersync javascript URL for a given hostname, or None if disabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ def start_webpack(self, **options):
webpack_args.append("--display=errors-only")

if webpack_args:
webpack_args = ["--"] + webpack_args
webpack_args = ["--", *webpack_args]

self.stdout.write(">>> Starting webpack")
self.webpack_process = subprocess.Popen(
["npm", "start"] + webpack_args,
self.webpack_process = subprocess.Popen( # noqa:S603
["npm", "start", *webpack_args], # noqa:S607
shell=False,
stdin=subprocess.PIPE,
stdout=self.stdout._out,
stderr=self.stderr._out,
)
self.stdout.write(">>> Webpack process on pid {}".format(self.webpack_process.pid))
self.stdout.write(f">>> Webpack process on pid {self.webpack_process.pid}")

def kill_webpack_process():
self.stdout.write(">>> Closing webpack process")
Expand Down
Loading