Skip to content

Commit

Permalink
Add pre-commit hooks (#154)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
namurphy and pre-commit-ci[bot] authored Feb 10, 2024
1 parent bec8cdb commit 49d3fde
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 79 deletions.
34 changes: 17 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ version: 2
jobs:
build-website:
docker:
- image: continuumio/miniconda3
- image: continuumio/miniconda3
steps:
- checkout
- run:
name: "Install nikola"
command: pip install nikola
- run:
name: "Build website with STRIP_INDEXES=False"
command: |
echo "STRIP_INDEXES=False" >> conf.py
nikola build
- store_artifacts:
path: output
- run:
name: "Built website is available at:"
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/output/index.html"; echo $DOCS_URL
- checkout
- run:
name: Install nikola
command: pip install nikola
- run:
name: Build website with STRIP_INDEXES=False
command: |
echo "STRIP_INDEXES=False" >> conf.py
nikola build
- store_artifacts:
path: output
- run:
name: 'Built website is available at:'
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/output/index.html"; echo $DOCS_URL

workflows:
version: 2
test-documentation:
jobs:
- build-website
- build-website

notify:
webhooks:
- url: https://giles.cadair.dev/circleci
- url: https://giles.cadair.dev/circleci
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
nikola_build:
runs-on: ubuntu-latest
name: 'Deploy Nikola to GitHub Pages'
name: Deploy Nikola to GitHub Pages
steps:
- name: Check out
uses: actions/checkout@v3
Expand Down
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,33 @@ repos:
rev: 0.27.4
hooks:
- id: check-github-workflows

- repo: https://github.com/sirosen/texthooks
rev: 0.6.4
hooks:
- id: fix-smartquotes
- id: fix-spaces
- id: fix-ligatures
- id: forbid-bidi-controls

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-ini
args: [--autofix]
- id: pretty-format-yaml
args: [--autofix]
# For the labeler GitHub Action, labels with spaces in them must
# be put in quotes. However, the pretty-format-yaml hook will
# remove the quotes which will break that action, so we should not
# run this hook on `labeler.yml` (or certain other files).
exclude: .github/labeler.yml|.pre-commit-search-and-replace.yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
name: ruff (see https://docs.astral.sh/ruff/rules)
args: [--fix]
- id: ruff-format
name: autoformat source code with ruff formatter
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Examples of unacceptable behavior include:
- Trolling, insulting or derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others private information, such as a physical or email
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
Expand Down Expand Up @@ -140,7 +140,7 @@ This Code of Conduct is adapted from the `Contributor Covenant`_,
version 2.1, available at
https://www.contributor-covenant.org/version/2/1/code_of_conduct\ .

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

For answers to common questions about this code of conduct, see the FAQ
Expand Down
87 changes: 44 additions & 43 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
# this pattern is also used for metadata:
# something.meta -> something.pl.meta

TRANSLATIONS_PATTERN = '{path}.{lang}.{ext}'
TRANSLATIONS_PATTERN = "{path}.{lang}.{ext}"

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

NAVIGATION_LINKS = {
DEFAULT_LANG: (
Expand All @@ -166,7 +166,10 @@
(
(
(CHAT, "Chat room"),
("https://github.com/PlasmaPy/PlasmaPy/discussions", "GitHub Discussions"),
(
"https://github.com/PlasmaPy/PlasmaPy/discussions",
"GitHub Discussions",
),
(MAILING_LIST, "Email list"),
(FEEDBACK_BOX, "Suggestion box"),
),
Expand All @@ -191,16 +194,14 @@
# Alternative navigation links. Works the same way NAVIGATION_LINKS does,
# although themes may not always support them. (translatable)
# (Bootstrap 4: right-side of navbar, Bootblog 4: right side of title)
NAVIGATION_ALT_LINKS = {
DEFAULT_LANG: ()
}
NAVIGATION_ALT_LINKS = {DEFAULT_LANG: ()}

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

# Primary color of your theme. This will be used to customize your theme.
# Must be a HEX value.
THEME_COLOR = '#5670d4'
THEME_COLOR = "#5670d4"

# Theme configuration. Fully theme-dependent. (translatable)
# Examples below are for bootblog4.
Expand Down Expand Up @@ -310,7 +311,7 @@
#
# 0 = using DATE_FORMAT and TIMEZONE
# 1 = using JS_DATE_FORMAT and local user time (via moment.js)
# 2 = using a string like 2 days ago
# 2 = using a string like "2 days ago"
#
# Your theme must support it, Bootstrap already does.
# DATE_FANCINESS = 0
Expand Down Expand Up @@ -341,18 +342,18 @@
# 'markdown' is Markdown
# 'html' assumes the file is HTML and just copies it
COMPILERS = {
"rest": ('.rst', '.txt'),
"markdown": ('.md', '.mdown', '.markdown'),
"textile": ('.textile',),
"txt2tags": ('.t2t',),
"bbcode": ('.bb',),
"wiki": ('.wiki',),
"ipynb": ('.ipynb',),
"html": ('.html', '.htm'),
"rest": (".rst", ".txt"),
"markdown": (".md", ".mdown", ".markdown"),
"textile": (".textile",),
"txt2tags": (".t2t",),
"bbcode": (".bb",),
"wiki": (".wiki",),
"ipynb": (".ipynb",),
"html": (".html", ".htm"),
# PHP files are rendered the usual way (i.e. with the full templates).
# The resulting files have .php extensions, making it possible to run
# them without reconfiguring your server to recognize them.
"php": ('.php',),
"php": (".php",),
# Pandoc detects the input from the source filename
# but is disabled by default as it would conflict
# with many of the others.
Expand Down Expand Up @@ -423,7 +424,7 @@

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

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

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

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

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

# Optional HTML that displayed on main blog index.html files.
# Optional HTML that displayed on "main" blog index.html files.
# May be used for a greeting. (translatable)
FRONT_INDEX_HEADER = {
DEFAULT_LANG: ''
}
FRONT_INDEX_HEADER = {DEFAULT_LANG: ""}

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

# The name of the remote where you wish to push to, using github_deploy.
GITHUB_REMOTE_NAME = 'origin'
GITHUB_REMOTE_NAME = "origin"

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

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

IMAGE_FOLDERS = {'images': 'images'}
IMAGE_FOLDERS = {"images": "images"}
# IMAGE_THUMBNAIL_SIZE = 400
# IMAGE_THUMBNAIL_FORMAT = '{name}.thumbnail{ext}'

Expand Down Expand Up @@ -951,10 +950,10 @@
# HTML fragments with the Read more... links.
# The following tags exist and are replaced for you:
# {link} A link to the full post page.
# {read_more} The string Read more in the current language.
# {read_more} The string "Read more" in the current language.
# {reading_time} An estimate of how long it will take to read the post.
# {remaining_reading_time} An estimate of how long it will take to read the post, sans the teaser.
# {min_remaining_read} The string {remaining_reading_time} min remaining to read in the current language.
# {min_remaining_read} The string "{remaining_reading_time} min remaining to read" in the current language.
# {paragraph_count} The amount of paragraphs in the post.
# {remaining_paragraph_count} The amount of paragraphs in the post, sans the teaser.
# {post_title} The title of the post.
Expand Down Expand Up @@ -989,9 +988,9 @@
# A small copyright notice for the page footer (in HTML).
# (translatable)
CONTENT_FOOTER = (
'Contents &copy; {date} {author}'
"Contents &copy; {date} {author}"
'- <a href="{repo}">GitHub</a> '
'- {license} '
"- {license} "
'- <a href="{facebook}">Facebook</a> '
'- <a href="{twitter}">Twitter</a> '
'- <a href="{youtube}">YouTube</a> '
Expand Down Expand Up @@ -1148,10 +1147,12 @@
# with the MarkdownExtension class and should not be added here.
# Defaults are markdown.extensions.(fenced_code|codehilite|extra)
# markdown.extensions.meta is required for Markdown metadata.
MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code',
'markdown.extensions.codehilite',
'markdown.extensions.extra',
'markdown.extensions.meta']
MARKDOWN_EXTENSIONS = [
"markdown.extensions.fenced_code",
"markdown.extensions.codehilite",
"markdown.extensions.extra",
"markdown.extensions.meta",
]

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

# If you dont like slugified file names ([a-z0-9] and a literal dash),
# If you don't like slugified file names ([a-z0-9] and a literal dash),
# and would prefer to use all the characters your file system allows.
# USE WITH CARE! This is also not guaranteed to be perfect, and may
# sometimes crash Nikola, your web server, or eat your cat.
Expand Down
8 changes: 4 additions & 4 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
Loading

0 comments on commit 49d3fde

Please sign in to comment.