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

config not correctly loaded when running pre-commit on Windows #488

Closed
JJMC89 opened this issue Nov 9, 2024 · 1 comment · Fixed by #489
Closed

config not correctly loaded when running pre-commit on Windows #488

JJMC89 opened this issue Nov 9, 2024 · 1 comment · Fixed by #489
Assignees

Comments

@JJMC89
Copy link

JJMC89 commented Nov 9, 2024

Problem: When running the pre-commit hook in Windows PowerShell, get_config returns {} because prog='docsig.EXE' instead of 'docsig'.

t.patch:
moves disable from cli arg to config

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c526fa256..09d8499fd 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -81,8 +81,6 @@ repos:
     rev: v0.64.0
     hooks:
       - id: docsig
-        args:
-          - "-dSIG101,SIG202,SIG203,SIG301,SIG302,SIG401,SIG402,SIG404,SIG501,SIG502,SIG503,SIG505"
         exclude: ^(tests|scripts)
   - repo: https://github.com/PyCQA/flake8
     rev: 7.1.1
diff --git a/pyproject.toml b/pyproject.toml
index 1b959f4e4..11fe224b8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -127,6 +127,23 @@ Changelog = "https://doc.wikimedia.org/pywikibot/master/changelog.html"
 Tracker = "https://phabricator.wikimedia.org/tag/pywikibot/"


+[tool.docsig]
+disable = [
+    "SIG101",
+    "SIG202",
+    "SIG203",
+    "SIG301",
+    "SIG302",
+    "SIG401",
+    "SIG402",
+    "SIG404",
+    "SIG501",
+    "SIG502",
+    "SIG503",
+    "SIG505",
+]
+
+
 [tool.isort]
 py_version = 37
 add_imports = ["from __future__ import annotations"]
pip install pre-commit
git clone https://github.com/wikimedia/pywikibot
cd pywikibot
git apply t.patch
pre-commit install
pre-commit run docsig --files pywikibot\userinterfaces\buffer_interface.py

Actual result:

docsig...................................................................Failed
- hook id: docsig
- exit code: 1

pywikibot\userinterfaces\buffer_interface.py:41 in UI.init_handlers
    SIG203: parameters missing (params-missing)
pywikibot\userinterfaces\buffer_interface.py:45 in UI.input
    SIG203: parameters missing (params-missing)
    SIG503: return missing from docstring (return-missing)
pywikibot\userinterfaces\buffer_interface.py:50 in UI.input_choice
    SIG203: parameters missing (params-missing)
    SIG501: cannot determine whether a return statement should exist (confirm-return-needed)
    hint: annotate type to indicate whether return documentation needed
pywikibot\userinterfaces\buffer_interface.py:56 in UI.input_list_choice
    SIG203: parameters missing (params-missing)
    SIG503: return missing from docstring (return-missing)
pywikibot\userinterfaces\buffer_interface.py:62 in UI.output
    SIG203: parameters missing (params-missing)
pywikibot\userinterfaces\buffer_interface.py:66 in UI.pop_output
    SIG501: cannot determine whether a return statement should exist (confirm-return-needed)
    hint: annotate type to indicate whether return documentation needed

Expected result:
(all detectable issues are disabled in pyproject.tmol)

docsig...................................................................Passed

Environment:

  • Python version: 3.13
  • docsig version: 0.64.0
  • Windows PowerShell
@jshwi jshwi self-assigned this Nov 10, 2024
jshwi added a commit that referenced this issue Nov 10, 2024
Config correctly loads `docsig` instead of looking for `docsig.exe`

Signed-off-by: Stephen Whitlock <stephen@jshwisolutions.com>
@jshwi jshwi linked a pull request Nov 10, 2024 that will close this issue
jshwi added a commit that referenced this issue Nov 10, 2024
Config correctly loads `docsig` instead of looking for `docsig.exe`

Signed-off-by: Stephen Whitlock <stephen@jshwisolutions.com>
@jshwi
Copy link
Owner

jshwi commented Nov 10, 2024

Thanks for raising this one and letting me know @JJMC89

I've added the fix, this should work for you now

Any troubles, let me know! (available v0.64.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants