Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .ci/scripts/pr_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import re
import sys
import tomllib
from pathlib import Path

import tomllib
from git import Repo


Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
pip3 install ruff
ruff format --check --diff plugin-template utils.py
ruff check --diff plugin-template utils.py
ruff check plugin-template utils.py
- name: "Bootstrap catdog plugin"
working-directory: "plugin_template"
run: |
Expand All @@ -54,7 +54,7 @@ jobs:

- name: "Lint code"
run: |
ruff check --diff
ruff check

- name: "Check for common gettext problems"
run: |
Expand Down
3 changes: 2 additions & 1 deletion plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# ]
# ///

import typing as t
import argparse
import os
import shlex
import shutil
import subprocess
import sys
import typing as t
from pathlib import Path

import jamldump
Expand Down Expand Up @@ -511,6 +511,7 @@ def remove_deprecated_files(plugin_root_dir: Path, sections: list[str]) -> None:
def reformat_files(plugin_root_dir: Path, config: dict[str, t.Any]) -> None:
try:
subprocess.run(["ruff", "format"], cwd=plugin_root_dir)
subprocess.run(["ruff", "check", "--select", "I", "--fix"], cwd=plugin_root_dir)
except FileNotFoundError:
pass

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ issue_format = "`#{issue} <https://github.com/pulp/plugin_template/issues/{issue
[tool.ruff]
line-length = 100
extend-exclude = ["templates"]

[tool.ruff.lint]
extend-select = ["I"]
2 changes: 1 addition & 1 deletion scripts/get_template_config_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#
# ///

import argparse
import sys

import argparse
import yaml

if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion scripts/update_core_lowerbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from packaging.requirements import Requirement
from packaging.version import Version


CORE_TEMPLATE_URL = "https://raw.githubusercontent.com/pulp/pulpcore/main/template_config.yml"


Expand Down
3 changes: 2 additions & 1 deletion templates/ci/Makefile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
.PHONY: format
format:
ruff format
ruff check --select I --fix

.PHONY: lint
lint:
yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows
bump-my-version bump --dry-run release
ruff format --check --diff
ruff check --diff
ruff check
{%- if check_manifest %}
check-manifest
{%- endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/lint.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: "Lint code"
run: |
ruff check --diff
ruff check
{%- if check_gettext %}

- name: "Check for common gettext problems"
Expand Down
15 changes: 15 additions & 0 deletions templates/github/pyproject.toml.tool.j2
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,18 @@ extend-exclude = [
"{{ path }}",
{%- endfor %}
]

[tool.ruff.lint]
# This section is managed by the plugin template. Do not edit manually.
extend-select = ["I", "TID", "T10"]
{%- if plugin_name != "core" %}

[tool.ruff.lint.flake8-tidy-imports.banned-api]
# This section is managed by the plugin template. Do not edit manually.
"pulpcore.app".msg = "The 'pulpcore' apis must only be consumed via 'pulpcore.plugin'."
{%- endif %}

[tool.ruff.lint.isort]
# This section is managed by the plugin template. Do not edit manually.
sections = { second-party = ["pulpcore"] }
section-order = ["future", "standard-library", "third-party", "second-party", "first-party", "local-folder"]
6 changes: 3 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from datetime import timedelta
from pathlib import Path
import re
import stat
import textwrap
import tomllib
from datetime import timedelta
from pathlib import Path

import requests_cache
import tomlkit
import tomllib
import yaml

# Jinja tests and filters
Expand Down
Loading