adafruit / cookiecutter-adafruit-circuitpython

Cookiecutter template for Adafruit's CircuitPython libraries.
MIT License
22 stars 37 forks source link

pre-commit exempts docs/conf.py and setup.py locally only #175

Closed tannewt closed 2 years ago

tannewt commented 2 years ago

The CI runs on all files that checks those files.

The fix is to change .pre-commit-config.yaml so that the local version also reformats those files.

askpatrickw commented 2 years ago

@tannewt I thought this was done so people making a code change didn't have to fix docs (and the STEEP Sphinx learning curve) if they weren't actually changing docs.

tannewt commented 2 years ago

I'm not sure how that's related. I didn't have to run Sphinx myself. I needed to rerun pylint locally with -a to reformat the exempt files.

askpatrickw commented 2 years ago

I tested what happens when you let it run on conf.py and setup.py by modifying the precommit config, running the cookiecutter and running precommit.

pre-commit run --all-files
black....................................................................Passed
reuse....................................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
pylint (library code)....................................................Failed
- hook id: pylint
- exit code: 20

************* Module conf
docs/conf.py:49:0: W0622: Redefining built-in 'copyright' (redefined-builtin)
docs/conf.py:1:0: C0114: Missing module docstring (missing-module-docstring)
docs/conf.py:37:0: C0103: Constant name "autoclass_content" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:42:0: C0103: Constant name "source_suffix" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:45:0: C0103: Constant name "master_doc" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:48:0: C0103: Constant name "project" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:49:0: C0103: Constant name "copyright" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:50:0: C0103: Constant name "author" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:57:0: C0103: Constant name "version" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:59:0: C0103: Constant name "release" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:66:0: C0103: Constant name "language" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:82:0: C0103: Constant name "default_role" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:86:0: C0103: Constant name "add_function_parentheses" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:89:0: C0103: Constant name "pygments_style" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:92:0: C0103: Constant name "todo_include_todos" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:95:0: C0103: Constant name "todo_emit_warnings" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:97:0: C0103: Constant name "napoleon_numpy_docstring" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:112:4: W0702: No exception type(s) specified (bare-except)
docs/conf.py:110:8: C0103: Constant name "html_theme" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:113:8: C0103: Constant name "html_theme" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:127:0: C0103: Constant name "html_favicon" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)
docs/conf.py:130:0: C0103: Constant name "htmlhelp_basename" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern (invalid-name)

-----------------------------------
Your code has been rated at 4.63/10

pylint (examples code)...................................................Passed
pylint (tests code)......................................................Passed
tannewt commented 2 years ago

Ah! I think this is could have been my mistake. This is the failure: https://github.com/adafruit/Adafruit_CircuitPython_TT21100/runs/5504459655?check_suite_focus=true

I probably committed these files before that run though. That way my local black skipped it because it was unchanged.

Thanks for humoring me. I don't think we need to change anything.