forked from OSQA/osqa
-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
202 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,11 +30,19 @@ jobs: | |
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# see https://github.com/pre-commit/action/#using-this-action | ||
- name: pre-commit checks | ||
uses: pre-commit/[email protected] | ||
env: | ||
# it's okay for github to commit to main/master | ||
SKIP: no-commit-to-branch | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools-rust | ||
python setup.py install | ||
# replacement for "python setup.py install" | ||
# See also https://packaging.python.org/en/latest/discussions/setup-py-deprecated/#setup-py-deprecated | ||
python -m pip install . | ||
pip install -r requirements-tests.txt | ||
cat askbot_setup_test_inputs.txt | askbot-setup | ||
- name: Run tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# See http://pre-commit.com/#python | ||
# See https://github.com/pre-commit/pre-commit-hooks | ||
# Run 'pre-commit install' to install the pre-commit hooks | ||
repos: | ||
|
||
# TODO: enable | ||
#- repo: https://github.com/adamchainz/django-upgrade | ||
# rev: 1.15.0 | ||
# hooks: | ||
# - id: django-upgrade | ||
# args: [--target-version, "4.2"] | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-case-conflict | ||
# TODO: enable check-docstring-first | ||
# - id: check-docstring-first | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: debug-statements | ||
- id: detect-private-key | ||
# ruff format will handle quoting | ||
# - id: double-quote-string-fixer | ||
# TODO: enable each of these, one at a time: | ||
# - id: end-of-file-fixer | ||
# - id: mixed-line-ending | ||
# - id: trailing-whitespace | ||
# exclude: (.csv|.tsv)$ | ||
# - id: pretty-format-json | ||
# args: ['--no-sort-keys', '--autofix'] | ||
# don't commit directly to main or master | ||
- id: no-commit-to-branch | ||
|
||
# TODO: enable auto-formatting of Django templates (html, css, js) | ||
#- repo: https://github.com/rtts/djhtml | ||
# rev: '3.0.6' | ||
# hooks: | ||
# - id: djhtml | ||
# - id: djcss | ||
# - id: djjs | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.5 | ||
hooks: | ||
- id: ruff | ||
args: ["--fix"] | ||
# TODO: ruff-format | ||
# - id: ruff-format | ||
|
||
# ruff does not re-implement all of pylint, see https://github.com/astral-sh/ruff/issues/970 | ||
# TODO: put back pylint | ||
#- repo: https://github.com/PyCQA/pylint | ||
# rev: v3.0.1 | ||
# hooks: | ||
# - id: pylint | ||
# args: | ||
# # black is controlling line length: | ||
# - --disable=line-too-long | ||
# # let's not worry too much right now about dup code. | ||
# - --disable=duplicate-code | ||
# - --disable=fixme | ||
# - --disable=import-error | ||
# - --disable=logging-fstring-interpolation | ||
# - --disable=missing-class-docstring | ||
# - --disable=missing-function-docstring | ||
# - --disable=missing-module-docstring | ||
# - --disable=too-few-public-methods | ||
# - --disable=too-many-arguments | ||
# # - --disable=too-many-branches | ||
# - --disable=too-many-locals | ||
# # isort is taking care of import order: | ||
# - --disable=wrong-import-order | ||
# # re-enable these args | ||
# - --disable=unused-argument | ||
# - --disable=invalid-name | ||
# - --disable=raise-missing-from | ||
|
||
#- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
# rev: v1.5.4 | ||
# hooks: | ||
# # TODO: enable forbid-crlf and forbid-tabs | ||
# # - id: forbid-crlf | ||
# # don't remove-crlf, seems dangerous | ||
# # - id: remove-crlf | ||
# # - id: forbid-tabs | ||
# # don't remove-tabs, seems dangerous | ||
# # - id: remove-tabs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# pyproject.toml duplicates some information in setup.py | ||
# However, pyproject.toml is now standard, and needed for ruff config | ||
# See also https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html | ||
# See also https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ | ||
[project] | ||
name = "askbot" | ||
requires-python = ">=3.8" | ||
dynamic = ["version", "dependencies", "scripts", "classifiers", "license", | ||
"description", "readme", "authors", "keywords"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "askbot.VERSION"} | ||
|
||
[tool.ruff] | ||
# exclude Django migrations | ||
extend-exclude = ["**/migrations"] | ||
|
||
[tool.ruff.lint] | ||
# add more rules | ||
# see https://docs.astral.sh/ruff/configuration/#using-pyprojecttoml | ||
# "F" contains autoflake, see https://github.com/astral-sh/ruff/issues/1647 | ||
# These are all TODO, because they make so many changes. | ||
# I put ** on some to do earlier. | ||
select = [ | ||
# default Ruff checkers as of ruff 0.1.3: E4, E7, E9, F | ||
# ** TODO: "E4", | ||
# ** TODO: "E7", | ||
# ** TODO: "E9", | ||
# ** TODO: "F", # pyflakes | ||
|
||
# the rest in alphabetical order: | ||
# TODO: "A", # flake8-builtins | ||
# TODO: "ARG", # flake8-unused-arguments | ||
# TODO: "B", # flake8-bugbear | ||
# TODO: "BLE", # flake8-blind-except | ||
# TODO: Do I want "COM", # flake8-commas | ||
# TODO: "C4", # flake8-comprehensions | ||
# ** TODO: "DJ", # flake8-django | ||
# TODO: "DTZ", # flake8-datetimez | ||
# TODO: "EM", # flake8-errmsg | ||
# ** TODO: "EXE", # flake8-executable | ||
# TODO: "FURB", # refurb | ||
# TODO: "FBT", # flake8-boolean-trap | ||
# TODO: "G", # flake8-logging-format | ||
# ** TODO: "I", # isort | ||
# TODO: "ICN", # flake8-import-conventions | ||
# TODO: "INP", # flake8-no-pep420 | ||
# TODO: "INT", # flake8-gettext | ||
# TODO: "ISC", # flake8-implicit-str-concat | ||
# TODO: "LOG", # flake8-logging | ||
# TODO: "PERF", # perflint | ||
# TODO: "PIE", # flake8-pie | ||
# TODO: "PL", # pylint | ||
# TODO: "PYI", # flake8-pyi | ||
# TODO: "RET", # flake8-return | ||
# TODO: "RSE", # flake8-raise | ||
# TODO: "RUF", | ||
# TODO: "SIM", # flake8-simplify | ||
# TODO: "SLF", # flake8-self | ||
# TODO: "SLOT", # flake8-slots | ||
# TODO: "TID", # flake8-tidy-imports | ||
# ** TODO: "UP", # pyupgrade | ||
# ** TODO: "Q", # flake8-quotes | ||
# TODO: "TCH", # flake8-type-checking | ||
# TODO: "T10", # flake8-debugger | ||
# ** TODO: "T20", # flake8-print | ||
# TODO: "S", # flake8-bandit | ||
# TODO: "YTT", # flake8-2020 | ||
# TODO: add more flake8 rules | ||
] | ||
|
||
# rules to ignore globally: | ||
ignore = [ | ||
] | ||
|
||
[tool.ruff.lint.extend-per-file-ignores] | ||
|
||
# per-file ignores | ||
#"**/migrations/*" = ["Q"] | ||
#"**/management/commands/*" = ["T20"] |