Skip to content

Commit 49d3fde

Browse files
Add pre-commit hooks (#154)
* Update pre-commit hooks * Apply pre-commit hooks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert a change * Add uptodate to codespell ignore list --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bec8cdb commit 49d3fde

File tree

8 files changed

+112
-79
lines changed

8 files changed

+112
-79
lines changed

.circleci/config.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ version: 2
22
jobs:
33
build-website:
44
docker:
5-
- image: continuumio/miniconda3
5+
- image: continuumio/miniconda3
66
steps:
7-
- checkout
8-
- run:
9-
name: "Install nikola"
10-
command: pip install nikola
11-
- run:
12-
name: "Build website with STRIP_INDEXES=False"
13-
command: |
14-
echo "STRIP_INDEXES=False" >> conf.py
15-
nikola build
16-
- store_artifacts:
17-
path: output
18-
- run:
19-
name: "Built website is available at:"
20-
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/output/index.html"; echo $DOCS_URL
7+
- checkout
8+
- run:
9+
name: Install nikola
10+
command: pip install nikola
11+
- run:
12+
name: Build website with STRIP_INDEXES=False
13+
command: |
14+
echo "STRIP_INDEXES=False" >> conf.py
15+
nikola build
16+
- store_artifacts:
17+
path: output
18+
- run:
19+
name: 'Built website is available at:'
20+
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/output/index.html"; echo $DOCS_URL
2121

2222
workflows:
2323
version: 2
2424
test-documentation:
2525
jobs:
26-
- build-website
26+
- build-website
2727

2828
notify:
2929
webhooks:
30-
- url: https://giles.cadair.dev/circleci
30+
- url: https://giles.cadair.dev/circleci

.github/workflows/deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
nikola_build:
1111
runs-on: ubuntu-latest
12-
name: 'Deploy Nikola to GitHub Pages'
12+
name: Deploy Nikola to GitHub Pages
1313
steps:
1414
- name: Check out
1515
uses: actions/checkout@v3

.pre-commit-config.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,33 @@ repos:
3232
rev: 0.27.4
3333
hooks:
3434
- id: check-github-workflows
35+
36+
- repo: https://github.com/sirosen/texthooks
37+
rev: 0.6.4
38+
hooks:
39+
- id: fix-smartquotes
40+
- id: fix-spaces
41+
- id: fix-ligatures
42+
- id: forbid-bidi-controls
43+
44+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
45+
rev: v2.12.0
46+
hooks:
47+
- id: pretty-format-ini
48+
args: [--autofix]
49+
- id: pretty-format-yaml
50+
args: [--autofix]
51+
# For the labeler GitHub Action, labels with spaces in them must
52+
# be put in quotes. However, the pretty-format-yaml hook will
53+
# remove the quotes which will break that action, so we should not
54+
# run this hook on `labeler.yml` (or certain other files).
55+
exclude: .github/labeler.yml|.pre-commit-search-and-replace.yaml
56+
57+
- repo: https://github.com/astral-sh/ruff-pre-commit
58+
rev: v0.2.1
59+
hooks:
60+
- id: ruff
61+
name: ruff (see https://docs.astral.sh/ruff/rules)
62+
args: [--fix]
63+
- id: ruff-format
64+
name: autoformat source code with ruff formatter

CODE_OF_CONDUCT.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Examples of unacceptable behavior include:
4040
- Trolling, insulting or derogatory comments, and personal or political
4141
attacks
4242
- Public or private harassment
43-
- Publishing others private information, such as a physical or email
43+
- Publishing others' private information, such as a physical or email
4444
address, without their explicit permission
4545
- Other conduct which could reasonably be considered inappropriate in a
4646
professional setting
@@ -140,7 +140,7 @@ This Code of Conduct is adapted from the `Contributor Covenant`_,
140140
version 2.1, available at
141141
https://www.contributor-covenant.org/version/2/1/code_of_conduct\ .
142142

143-
Community Impact Guidelines were inspired by `Mozillas code of conduct
143+
Community Impact Guidelines were inspired by `Mozilla's code of conduct
144144
enforcement ladder <https://github.com/mozilla/inclusion>`__.
145145

146146
For answers to common questions about this code of conduct, see the FAQ

conf.py

+44-43
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
# this pattern is also used for metadata:
124124
# something.meta -> something.pl.meta
125125

126-
TRANSLATIONS_PATTERN = '{path}.{lang}.{ext}'
126+
TRANSLATIONS_PATTERN = "{path}.{lang}.{ext}"
127127

128128
# Links for the sidebar / navigation bar. (translatable)
129129
# This is a dict. The keys are languages, and values are tuples.
@@ -146,9 +146,9 @@
146146
# may present issues if the menu is too large.
147147
# (in Bootstrap, the navbar can grow too large and cover contents.)
148148
# WARNING: If you link to directories, make sure to follow
149-
# ``STRIP_INDEXES``. If its set to ``True``, end your links
149+
# ``STRIP_INDEXES``. If it's set to ``True``, end your links
150150
# with a ``/``, otherwise end them with ``/index.html`` — or
151-
# else they wont be highlighted when active.
151+
# else they won't be highlighted when active.
152152

153153
NAVIGATION_LINKS = {
154154
DEFAULT_LANG: (
@@ -166,7 +166,10 @@
166166
(
167167
(
168168
(CHAT, "Chat room"),
169-
("https://github.com/PlasmaPy/PlasmaPy/discussions", "GitHub Discussions"),
169+
(
170+
"https://github.com/PlasmaPy/PlasmaPy/discussions",
171+
"GitHub Discussions",
172+
),
170173
(MAILING_LIST, "Email list"),
171174
(FEEDBACK_BOX, "Suggestion box"),
172175
),
@@ -191,16 +194,14 @@
191194
# Alternative navigation links. Works the same way NAVIGATION_LINKS does,
192195
# although themes may not always support them. (translatable)
193196
# (Bootstrap 4: right-side of navbar, Bootblog 4: right side of title)
194-
NAVIGATION_ALT_LINKS = {
195-
DEFAULT_LANG: ()
196-
}
197+
NAVIGATION_ALT_LINKS = {DEFAULT_LANG: ()}
197198

198199
# Name of the theme to use.
199200
THEME = "bootstrap4"
200201

201202
# Primary color of your theme. This will be used to customize your theme.
202203
# Must be a HEX value.
203-
THEME_COLOR = '#5670d4'
204+
THEME_COLOR = "#5670d4"
204205

205206
# Theme configuration. Fully theme-dependent. (translatable)
206207
# Examples below are for bootblog4.
@@ -310,7 +311,7 @@
310311
#
311312
# 0 = using DATE_FORMAT and TIMEZONE
312313
# 1 = using JS_DATE_FORMAT and local user time (via moment.js)
313-
# 2 = using a string like 2 days ago
314+
# 2 = using a string like "2 days ago"
314315
#
315316
# Your theme must support it, Bootstrap already does.
316317
# DATE_FANCINESS = 0
@@ -341,18 +342,18 @@
341342
# 'markdown' is Markdown
342343
# 'html' assumes the file is HTML and just copies it
343344
COMPILERS = {
344-
"rest": ('.rst', '.txt'),
345-
"markdown": ('.md', '.mdown', '.markdown'),
346-
"textile": ('.textile',),
347-
"txt2tags": ('.t2t',),
348-
"bbcode": ('.bb',),
349-
"wiki": ('.wiki',),
350-
"ipynb": ('.ipynb',),
351-
"html": ('.html', '.htm'),
345+
"rest": (".rst", ".txt"),
346+
"markdown": (".md", ".mdown", ".markdown"),
347+
"textile": (".textile",),
348+
"txt2tags": (".t2t",),
349+
"bbcode": (".bb",),
350+
"wiki": (".wiki",),
351+
"ipynb": (".ipynb",),
352+
"html": (".html", ".htm"),
352353
# PHP files are rendered the usual way (i.e. with the full templates).
353354
# The resulting files have .php extensions, making it possible to run
354355
# them without reconfiguring your server to recognize them.
355-
"php": ('.php',),
356+
"php": (".php",),
356357
# Pandoc detects the input from the source filename
357358
# but is disabled by default as it would conflict
358359
# with many of the others.
@@ -423,7 +424,7 @@
423424

424425
# Set descriptions for tag pages to make them more interesting. The
425426
# default is no description. The value is used in the meta description
426-
# and displayed underneath the tag list or index pages title.
427+
# and displayed underneath the tag list or index page's title.
427428
# TAG_DESCRIPTIONS = {
428429
# DEFAULT_LANG: {
429430
# "blogging": "Meta-blog posts about blogging.",
@@ -442,7 +443,7 @@
442443
# If you do not want to display a tag publicly, you can mark it as hidden.
443444
# The tag will not be displayed on the tag list page and posts.
444445
# Tag pages will still be generated.
445-
HIDDEN_TAGS = ['mathjax']
446+
HIDDEN_TAGS = ["mathjax"]
446447

447448
# Only include tags on the tag list/overview page if there are at least
448449
# TAGLIST_MINIMUM_POSTS number of posts or more with every tag. Every tag
@@ -496,7 +497,7 @@
496497

497498
# Set descriptions for category pages to make them more interesting. The
498499
# default is no description. The value is used in the meta description
499-
# and displayed underneath the category list or index pages title.
500+
# and displayed underneath the category list or index page's title.
500501
# CATEGORY_DESCRIPTIONS = {
501502
# DEFAULT_LANG: {
502503
# "blogging": "Meta-blog posts about blogging.",
@@ -575,7 +576,7 @@
575576

576577
# Set descriptions for author pages to make them more interesting. The
577578
# default is no description. The value is used in the meta description
578-
# and displayed underneath the author list or index pages title.
579+
# and displayed underneath the author list or index page's title.
579580
# AUTHOR_PAGES_DESCRIPTIONS = {
580581
# DEFAULT_LANG: {
581582
# "Juanjo Conti": "Python coder and writer.",
@@ -587,18 +588,16 @@
587588
# If you do not want to display an author publicly, you can mark it as hidden.
588589
# The author will not be displayed on the author list page and posts.
589590
# Tag pages will still be generated.
590-
HIDDEN_AUTHORS = ['Guest']
591+
HIDDEN_AUTHORS = ["Guest"]
591592

592593
# Final location for the main blog page and sibling paginated pages is
593594
# output / TRANSLATION[lang] / INDEX_PATH / index-*.html
594595
# (translatable)
595596
INDEX_PATH = "news/"
596597

597-
# Optional HTML that displayed on main blog index.html files.
598+
# Optional HTML that displayed on "main" blog index.html files.
598599
# May be used for a greeting. (translatable)
599-
FRONT_INDEX_HEADER = {
600-
DEFAULT_LANG: ''
601-
}
600+
FRONT_INDEX_HEADER = {DEFAULT_LANG: ""}
602601

603602
# Create per-month archives instead of per-year
604603
# CREATE_MONTHLY_ARCHIVE = False
@@ -697,11 +696,11 @@
697696
# For more details, read the manual:
698697
# https://getnikola.com/handbook.html#deploying-to-github
699698
# You will need to configure the deployment branch on GitHub.
700-
GITHUB_SOURCE_BRANCH = 'src'
701-
GITHUB_DEPLOY_BRANCH = 'main'
699+
GITHUB_SOURCE_BRANCH = "src"
700+
GITHUB_DEPLOY_BRANCH = "main"
702701

703702
# The name of the remote where you wish to push to, using github_deploy.
704-
GITHUB_REMOTE_NAME = 'origin'
703+
GITHUB_REMOTE_NAME = "origin"
705704

706705
# Whether or not github_deploy should commit to the source branch automatically
707706
# before deploying.
@@ -734,7 +733,7 @@
734733
# argument.
735734
#
736735
# By default, only .php files uses filters to inject PHP into
737-
# Nikolas templates. All other filters must be enabled through FILTERS.
736+
# Nikola's templates. All other filters must be enabled through FILTERS.
738737
#
739738
# Many filters are shipped with Nikola. A list is available in the manual:
740739
# <https://getnikola.com/handbook.html#post-processing-filters>
@@ -858,15 +857,15 @@
858857
#
859858
# .. image:: /images/tesla.jpg
860859
#
861-
# See the Nikola Handbook for details (in the Embedding Images and
862-
# Thumbnails sections)
860+
# See the Nikola Handbook for details (in the "Embedding Images" and
861+
# "Thumbnails" sections)
863862

864863
# Images will be scaled down according to IMAGE_THUMBNAIL_SIZE and MAX_IMAGE_SIZE
865864
# options, but will have to be referenced manually to be visible on the site
866865
# (the thumbnail has ``.thumbnail`` added before the file extension by default,
867866
# but a different naming template can be configured with IMAGE_THUMBNAIL_FORMAT).
868867

869-
IMAGE_FOLDERS = {'images': 'images'}
868+
IMAGE_FOLDERS = {"images": "images"}
870869
# IMAGE_THUMBNAIL_SIZE = 400
871870
# IMAGE_THUMBNAIL_FORMAT = '{name}.thumbnail{ext}'
872871

@@ -951,10 +950,10 @@
951950
# HTML fragments with the Read more... links.
952951
# The following tags exist and are replaced for you:
953952
# {link} A link to the full post page.
954-
# {read_more} The string Read more in the current language.
953+
# {read_more} The string "Read more" in the current language.
955954
# {reading_time} An estimate of how long it will take to read the post.
956955
# {remaining_reading_time} An estimate of how long it will take to read the post, sans the teaser.
957-
# {min_remaining_read} The string {remaining_reading_time} min remaining to read in the current language.
956+
# {min_remaining_read} The string "{remaining_reading_time} min remaining to read" in the current language.
958957
# {paragraph_count} The amount of paragraphs in the post.
959958
# {remaining_paragraph_count} The amount of paragraphs in the post, sans the teaser.
960959
# {post_title} The title of the post.
@@ -989,9 +988,9 @@
989988
# A small copyright notice for the page footer (in HTML).
990989
# (translatable)
991990
CONTENT_FOOTER = (
992-
'Contents &copy; {date} {author}'
991+
"Contents &copy; {date} {author}"
993992
'- <a href="{repo}">GitHub</a> '
994-
'- {license} '
993+
"- {license} "
995994
'- <a href="{facebook}">Facebook</a> '
996995
'- <a href="{twitter}">Twitter</a> '
997996
'- <a href="{youtube}">YouTube</a> '
@@ -1148,10 +1147,12 @@
11481147
# with the MarkdownExtension class and should not be added here.
11491148
# Defaults are markdown.extensions.(fenced_code|codehilite|extra)
11501149
# markdown.extensions.meta is required for Markdown metadata.
1151-
MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code',
1152-
'markdown.extensions.codehilite',
1153-
'markdown.extensions.extra',
1154-
'markdown.extensions.meta']
1150+
MARKDOWN_EXTENSIONS = [
1151+
"markdown.extensions.fenced_code",
1152+
"markdown.extensions.codehilite",
1153+
"markdown.extensions.extra",
1154+
"markdown.extensions.meta",
1155+
]
11551156

11561157
# Options to be passed to markdown extensions (See https://python-markdown.github.io/reference/)
11571158
# Default is {} (no config at all)
@@ -1402,7 +1403,7 @@
14021403
# (defaults to 1.)
14031404
# DEMOTE_HEADERS = 1
14041405

1405-
# If you dont like slugified file names ([a-z0-9] and a literal dash),
1406+
# If you don't like slugified file names ([a-z0-9] and a literal dash),
14061407
# and would prefer to use all the characters your file system allows.
14071408
# USE WITH CARE! This is also not guaranteed to be perfect, and may
14081409
# sometimes crash Nikola, your web server, or eat your cat.

dependabot.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33

4-
- package-ecosystem: "github-actions"
5-
directory: "/"
6-
schedule:
7-
interval: "weekly"
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: weekly

0 commit comments

Comments
 (0)