Skip to content

Commit

Permalink
Ruff lint and format, isort, codespell (#152)
Browse files Browse the repository at this point in the history
* Ruff lint and format, isort, codespell
  • Loading branch information
samaloney authored Jun 21, 2024
1 parent 45c147e commit 3a9a4a4
Show file tree
Hide file tree
Showing 39 changed files with 4,650 additions and 2,602 deletions.
63 changes: 23 additions & 40 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
repos:
# The warnings/errors we check for here are:
# E901 - SyntaxError or IndentationError
# E902 - IOError
# F822 - undefined name in __all__
# F823 - local variable name referenced before assignment
# Others are taken care of by autopep8
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
# This should be before any formatting hooks like isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
hooks:
- id: flake8
args:
[
"--count",
"--select",
"E901,E902,F822,F823",
]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|cm/__init__.py|sunpy/extern|sunpy/visualization/colormaps/color_tables.py)$"
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|__init__.py|docs/conf.py)$"
- id: ruff
args: ["--fix"]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--sp", "setup.cfg"]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|cm/__init__.py|docs/conf.py)$"
- repo: https://github.com/hhatto/autopep8
rev: v2.2.0
hooks:
- id: autopep8
args: ["--in-place", "--max-line-length", "200"]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|cm/__init__.py)$"
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*)$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v4.5.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.txt)$"
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
args: ["--enforce-all", "--maxkb=1054"]
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.txt|tca.*)$"
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.txt|tca.*)$"
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
args: ["--write-changes"]
exclude: ".ipynb"

ci:
autofix_prs: false
autofix_prs: false
autoupdate_schedule: "quarterly"
75 changes: 36 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -12,33 +11,34 @@
import pathlib

from sunkit_spex import __version__
project = 'sunkit-spex'
copyright = '2020, The SunPy Community'
author = 'The SunPy Community'

project = "sunkit-spex"
copyright = "2020, The SunPy Community"
author = "The SunPy Community"

# The full version, including alpha/beta/rc tags
release = __version__
is_development = '.dev' in __version__
is_development = ".dev" in __version__

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver',
'sphinx_changelog',
'sphinx_gallery.gen_gallery'
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.mathjax",
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
"sphinx_changelog",
"sphinx_gallery.gen_gallery",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -47,33 +47,30 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The reST default role (used for this markup: `text`) to use for all
# documents. Set to the "smart" one.
default_role = 'obj'
default_role = "obj"

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3/',
(None, 'http://data.astropy.org/intersphinx/python3.inv')),
'numpy': ('https://docs.scipy.org/doc/numpy/',
(None, 'http://data.astropy.org/intersphinx/numpy.inv')),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/',
(None, 'http://data.astropy.org/intersphinx/scipy.inv')),
'matplotlib': ('https://matplotlib.org/',
(None, 'http://data.astropy.org/intersphinx/matplotlib.inv')),
'astropy': ('http://docs.astropy.org/en/stable/', None),
'sunpy': ('https://docs.sunpy.org/en/stable/', None)}
"python": ("https://docs.python.org/3/", (None, "http://data.astropy.org/intersphinx/python3.inv")),
"numpy": ("https://docs.scipy.org/doc/numpy/", (None, "http://data.astropy.org/intersphinx/numpy.inv")),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", (None, "http://data.astropy.org/intersphinx/scipy.inv")),
"matplotlib": ("https://matplotlib.org/", (None, "http://data.astropy.org/intersphinx/matplotlib.inv")),
"astropy": ("http://docs.astropy.org/en/stable/", None),
"sunpy": ("https://docs.sunpy.org/en/stable/", None),
}

# -- Options for HTML output -------------------------------------------------

Expand All @@ -83,7 +80,7 @@
try:
from sunpy_sphinx_theme.conf import *
except ImportError:
html_theme = 'default'
html_theme = "default"


# Add any paths that contain custom static files (such as style sheets) here,
Expand All @@ -95,12 +92,12 @@
graphviz_output_format = "svg"

graphviz_dot_args = [
'-Nfontsize=10',
'-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif',
'-Efontsize=10',
'-Efontname=Helvetica Neue, Helvetica, Arial, sans-serif',
'-Gfontsize=10',
'-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif'
"-Nfontsize=10",
"-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif",
"-Efontsize=10",
"-Efontname=Helvetica Neue, Helvetica, Arial, sans-serif",
"-Gfontsize=10",
"-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif",
]

# -- Options for the Sphinx gallery -------------------------------------------
Expand Down
17 changes: 0 additions & 17 deletions examples/example.py

This file was deleted.

Loading

0 comments on commit 3a9a4a4

Please sign in to comment.