jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1162348?usp=email )

Change subject: tests: use pre-commit for tests
......................................................................

tests: use pre-commit for tests

Change-Id: Ia628a8340911035cc43b9dc0ca2c7f5482188b67
---
M .gitreview
A .pre-commit-config.yaml
M Gruntfile.js
M tox.ini
4 files changed, 55 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.gitreview b/.gitreview
index 1321a0b..93c86e0 100644
--- a/.gitreview
+++ b/.gitreview
@@ -3,4 +3,4 @@
 port=29418
 project=pywikibot/i18n.git
 defaultbranch=master
-defaultrebase=0
\ No newline at end of file
+defaultrebase=0
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..5eb5786
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,41 @@
+default_install_hook_types:
+  - commit-msg
+  - pre-commit
+repos:
+  - repo: meta
+    hooks:
+      - id: check-hooks-apply
+      - id: check-useless-excludes
+  - repo: https://gitlab.wikimedia.org/repos/ci-tools/commit-message-validator
+    rev: v2.1.0
+    hooks:
+      - id: commit-message-validator
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v5.0.0
+    hooks:
+      - id: check-added-large-files
+        args:
+          - --maxkb=100
+      - id: check-case-conflict
+      - id: check-executables-have-shebangs
+      - id: check-json
+      - id: check-merge-conflict
+      - id: check-shebang-scripts-are-executable
+      - id: check-vcs-permalinks
+      - id: check-yaml
+      - id: destroyed-symlinks
+      - id: detect-private-key
+      - id: double-quote-string-fixer
+      - id: end-of-file-fixer
+      - id: fix-byte-order-marker
+      - id: mixed-line-ending
+      - id: pretty-format-json
+        # list required for tab
+        args: ["--autofix", "--indent", "\t", "--no-ensure-ascii"]
+        exclude: ^package(-lock)?.json
+      - id: pretty-format-json
+        args: ["--autofix", "--indent", "\t", "--no-ensure-ascii", 
"--no-sort-keys"]
+        exclude: ^.+/.+\.json
+      - id: trailing-whitespace
+        args:
+          - --markdown-linebreak-ext=rst
diff --git a/Gruntfile.js b/Gruntfile.js
index b1de468..3bcf0f5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -11,4 +11,3 @@
        grunt.registerTask( 'test', ['lint'] );
        grunt.registerTask( 'default', ['test'] );
 };
-
diff --git a/tox.ini b/tox.ini
index adc535c..9e51a94 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,7 +7,9 @@
 skip_missing_interpreters = True

 # Environments to execute when invoking 'tox'
-envlist = py38
+envlist =
+    lint
+    py38

 [testenv]
 commands = ./run-tests.sh {envtmpdir}
@@ -17,3 +19,13 @@
     requests

 allowlist_externals = *
+
+[testenv:lint]
+basepython = python3.12
+deps =
+    pre-commit >= 4.2.0
+commands =
+    python --version
+    pre-commit run --all-files --show-diff-on-failure
+setenv =
+    PRE_COMMIT_COLOR=always

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1162348?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Change-Id: Ia628a8340911035cc43b9dc0ca2c7f5482188b67
Gerrit-Change-Number: 1162348
Gerrit-PatchSet: 7
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to