Skip to content

Commit

Permalink
Remove Curlylint, add Black and fix ESLint (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 authored Oct 3, 2024
2 parents 32b9456 + 28f8e03 commit fa91f0e
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 135 deletions.
3 changes: 3 additions & 0 deletions .black.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 79
target-version = ["py38", "py39", "py39", "py310", "py311", "py312", "py313"]
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
count = True
ignore = E123, W504
ignore = E123, E203, W504
max-doc-length = 79
max-complexity = 15
jobs = 1
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Blacken scripts

9e75d1834b30a486e6b8d0a011be43b587e8cd2d
33 changes: 16 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# Baseline hooks and config updated 2023-11-01
# Web hooks and config updated 2023-11-01
# Docs hooks and config updated 2024-01-29
# Python hooks and config updated 2024-01-29
# Baseline hooks and config updated 2024-09-25
# Web hooks and config updated 2024-09-25
# Docs hooks and config updated 2024-09-25
# Python hooks and config updated 2024-09-25

minimum_pre_commit_version: '2.10.0'

Expand Down Expand Up @@ -102,7 +102,7 @@ repos:

# Lint and fix JavaScript
- repo: https://github.com/eslint/eslint
rev: v9.11.0
rev: v9.9.0 # Pin to fix dep conflict on install; see eslint/eslint#18956
hooks:
- id: eslint
name: Lint and fix JavaScript (ESLint)
Expand All @@ -111,7 +111,7 @@ repos:
- '[email protected]'
- '[email protected]'
- '[email protected]'
- '[email protected].5'
- '[email protected].6'

# Format JavaScript with Prettier
- repo: https://github.com/rbubley/mirrors-prettier
Expand All @@ -121,16 +121,6 @@ repos:
name: Format JavaScript (Prettier)
types: [javascript]

# Lint Jinja
- repo: https://github.com/thibaudcolas/curlylint
rev: v0.13.1
hooks:
- id: curlylint
name: Lint Jinja templates
types: [html, jinja, twig]
files: 'templates/'
require_serial: true

# Check JSON
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand All @@ -154,6 +144,15 @@ repos:
name: Lint Markdown
args: [--fix]

# Format Python
- repo: https://github.com/psf/black-pre-commit-mirror
rev: '24.8.0'
hooks:
- id: black
name: Format Python with Black
args: ['--config', '.black.toml']
exclude: '\bworkshops\b'

# Check Python
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand All @@ -170,7 +169,7 @@ repos:
exclude: '\bworkshops\b'

- repo: https://github.com/pycqa/pylint
rev: v3.3.0
rev: v3.3.1
hooks:
- id: pylint
name: Lint Python with Pylint
Expand Down
33 changes: 20 additions & 13 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

# pylint: disable-next = import-error
from docutils import nodes

# pylint: disable-next = import-error
from docutils.parsers.rst import Directive, directives

Expand Down Expand Up @@ -69,7 +70,8 @@
# General information about the project.
project = "Spyder"
copyright = ( # pylint: disable = redefined-builtin
f" 2009-{UTC_DATE.year} Spyder Doc Contributors; MIT License")
f" 2009-{UTC_DATE.year} Spyder Doc Contributors; MIT License"
)
author = "The Spyder Doc Contributors"

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -142,7 +144,8 @@
"show_version_warning_banner": True,
"switcher": {
"json_url": (
"https://docs.spyder-ide.org/current/_static/versions.json"),
"https://docs.spyder-ide.org/current/_static/versions.json"
),
"version_match": version,
},
}
Expand Down Expand Up @@ -304,12 +307,13 @@
r"https://(www\.)?software\.opensuse\.org/?.*",
r"https://(www\.)?packages\.ubuntu\.com/?.*",
r"https://(www\.)?github\.com/.+/commit/.+",
r"https://(www\.)?figshare\.com/?.*",
# Blocks GitHub Actions
r"https://(www\.)?(\w+\.)?reddit\.com/?.*",
r"https://(www\.)?(\w+\.)?(stackoverflow|stackexchange)\.com/?.*",
# Temporary until removed (flaky/no longer used)
r"https://(www\.)?openteams\.com/?.*",
]
]


# -- Additional Directives ---------------------------------------------------
Expand All @@ -327,6 +331,7 @@
# :copyright: (c) 2012 by Danilo Bargen.
# :license: BSD 3-clause


def align(argument):
"""Convert the "align" argument to one of the specified options."""
return directives.choice(argument, ("left", "center", "right"))
Expand Down Expand Up @@ -366,16 +371,18 @@ def run(self):
class Youtube(IFrameVideo):
"""A specific directive for injecting a Youtube video in a Sphinx doc."""

html = "".join([
'<div class="video-container-container">',
'<div class="video-container">',
'<iframe src="https://www.youtube.com/embed/%(video_id)s',
'?start=%(start)s" ',
'width="%(width)u" height="%(height)u" frameborder="0" ',
# pylint: disable = inconsistent-quotes
'webkitAllowFullScreen mozallowfullscreen allowfullscreen ',
'class="align-%(align)s"></iframe></div></div>',
])
html = "".join(
[
'<div class="video-container-container">',
'<div class="video-container">',
'<iframe src="https://www.youtube.com/embed/%(video_id)s',
'?start=%(start)s" ',
'width="%(width)u" height="%(height)u" frameborder="0" ',
# pylint: disable = inconsistent-quotes
"webkitAllowFullScreen mozallowfullscreen allowfullscreen ",
'class="align-%(align)s"></iframe></div></div>',
]
)


def setup(builder): # pylint: disable = unused-argument
Expand Down
Loading

0 comments on commit fa91f0e

Please sign in to comment.