Skip to content

Commit

Permalink
chore: fix typos and add codespell check to CI (#163)
Browse files Browse the repository at this point in the history
This fixes a few typos and adds a configuration for codespell, which is also run in CI.

The ruff configuration is simplified (and re-ordered) to remove target-version and include, but the rules are not revised.
  • Loading branch information
mwtoews authored Nov 29, 2024
1 parent 6f84edb commit 7c5b178
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ jobs:
- name: Install Python packages
run: pip install ".[lint]"

- name: Run ruff
run: ruff check .

- name: Run ruff check
run: ruff check

- name: Run ruff format
run: ruff format --check

- name: Check spelling
run: codespell

build:
name: Build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion autotest/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_get_packages_fails_on_invalid_namefile(module_tmpdir):
f.write(line + os.linesep)
assert set(get_packages(namefile_path)) == {"gwf", "tdis", "ims"}

# entirely unparseable namefile - result should be empty
# entirely unparsable namefile - result should be empty
lines = open(namefile_path, "r").read().splitlines()
with open(namefile_path, "w") as f:
for _ in lines:
Expand Down
2 changes: 1 addition & 1 deletion modflow_devtools/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def run_py_script(script, *args, verbose=False):
def get_current_branch() -> str:
"""
Tries to determine the name of the current branch, first by the GITHUB_REF
environent variable, then by asking ``git`` if GITHUB_REF is not set.
environment variable, then by asking ``git`` if GITHUB_REF is not set.
Returns
-------
Expand Down
30 changes: 15 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dynamic = ["version"]

[project.optional-dependencies]
lint = [
"codespell[toml]",
"ruff"
]
test = [
Expand Down Expand Up @@ -73,20 +74,6 @@ docs = [
"Bug Tracker" = "https://github.com/MODFLOW-USGS/modflow-devtools/issues"
"Source Code" = "https://github.com/MODFLOW-USGS/modflow-devtools"

[tool.ruff]
target-version = "py38"
include = [
"pyproject.toml",
"modflow_devtools/**/*.py",
"autotest/**/*.py",
"docs/**/*.py",
"scripts/**/*.py",
".github/**/*.py",
]

[tool.ruff.lint]
select = ["F", "E", "I001"]

[tool.setuptools]
packages = ["modflow_devtools"]
include-package-data = true
Expand All @@ -98,5 +85,18 @@ version = {file = "version.txt"}
[tool.setuptools_scm]
fallback_version = "999"

[tool.codespell]
skip = "cliff.toml"
ignore-words-list = [
"nam",
"wel",
]

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["F", "E", "I001"]

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
addopts = ["--import-mode=importlib"]

0 comments on commit 7c5b178

Please sign in to comment.