Skip to content

Commit

Permalink
Merge pull request #179 from yarikoptic/enh-codespell
Browse files Browse the repository at this point in the history
Add codespell support (config, workflow) and make it fix some typos
  • Loading branch information
JR-1991 authored Apr 5, 2024
2 parents 4b8b5f3 + 661a391 commit b685040
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 10 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Codespell configuration is within setup.cfg
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies: [black==19.10b0]

- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in setup.cfg
rev: v2.2.6
hooks:
- id: codespell
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ max_line_length = 88
[pylama:pylint]
max_line_length = 88
disable = R

[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,*.svg,data
check-hidden = true
# ignore-regex =
# ignore-words-list =
2 changes: 1 addition & 1 deletion src/pyDataverse/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Api:
Base URL of Dataverse instance. Without trailing `/` at the end.
e.g. `http://demo.dataverse.org`
api_token : str
Authenication token for the api.
Authentication token for the api.
Attributes
----------
Expand Down
2 changes: 1 addition & 1 deletion src/pyDataverse/docs/source/user/csv-templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The CSV templates are licensed under `CC BY 4.0 <https://creativecommons.org/lic
Data format
-----------------------------

- Seperator: ``,``
- Separator: ``,``
- Encoding: ``utf-8``
- Quotation: ``"``. Note: In JSON strings, you have to escape with ``\`` before a quotation mark (e. g. adapt ``"`` to ``\"``).
- Boolean: we recommend using ``TRUE`` and ``FALSE`` as boolean values. Note: They can be modified, when you open it with your preferred spreadsheet software (e. g. Libre Office), depending on the software or your operating systems settings.
Expand Down
2 changes: 1 addition & 1 deletion src/pyDataverse/docs/source/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Installation
:local:

There are different options on how to install a Python package, mostly depending
on your prefered tools and what you want to do with it. The easiest
on your preferred tools and what you want to do with it. The easiest
way is in most cases to use pip (see :ref:`below <user_installation_pip>`).


Expand Down
4 changes: 2 additions & 2 deletions src/pyDataverse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,9 @@ def save_tree_data(
filename_df: str = "datafiles.json",
filename_md: str = "metadata.json",
) -> None:
"""Save lists from data returend by ``dv_tree_walker``.
"""Save lists from data returned by ``dv_tree_walker``.
Collect lists of Dataverses, Datasets and Datafiles and save them in seperated JSON files.
Collect lists of Dataverses, Datasets and Datafiles and save them in separated JSON files.
Parameters
----------
Expand Down
6 changes: 3 additions & 3 deletions tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class TestApiConnect(object):
"""Test the NativeApi() class initalization."""
"""Test the NativeApi() class initialization."""

def test_api_connect(self, native_api):
sleep(test_config["wait_time"])
Expand Down Expand Up @@ -49,7 +49,7 @@ def setup_class(cls):
cls.dataset_id = None

def test_get_request(self, native_api):
"""Test successfull `.get_request()` request."""
"""Test successful `.get_request()` request."""
# TODO: test params und auth default
base_url = os.getenv("BASE_URL").rstrip("/")
query_str = base_url + "/api/v1/info/server"
Expand All @@ -59,7 +59,7 @@ def test_get_request(self, native_api):
assert isinstance(resp, Response)

def test_get_dataverse(self, native_api):
"""Test successfull `.get_dataverse()` request`."""
"""Test successful `.get_dataverse()` request`."""
resp = native_api.get_dataverse(":root")
sleep(test_config["wait_time"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def test_file_replacement(self):
# Act
with tempfile.TemporaryDirectory() as tempdir:

orginal = open("tests/data/replace.xyz").read()
mutated = "Z" + orginal[1::]
original = open("tests/data/replace.xyz").read()
mutated = "Z" + original[1::]
mutated_path = os.path.join(tempdir, "replace.xyz")

with open(mutated_path, "w") as f:
Expand Down

0 comments on commit b685040

Please sign in to comment.