Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Add codespell support (config, workflow to detect/not fix) and make it fix few typos #496

Merged
merged 4 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ repos:
language: system
entry: ruff
types: [python]

- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ on your workstation as follows::

In both cases tox -p runs in parallel the following checks:

- Buiild Spinx Documentation
- Build Spinx Documentation
- run pytest on all tests in ./tests
- run mypy linting on all files in ./src ./tests
- run pre-commit checks:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN pip install ${PIP_OPTIONS}

FROM python:3.11-slim as runtime

# Add apt-get system dependecies for runtime here if needed
# Add apt-get system dependencies for runtime here if needed

# copy the virtual environment from the build stage and put it in PATH
COPY --from=build /venv/ /venv/
Expand Down
2 changes: 1 addition & 1 deletion docs/explanations/folders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ albums:
folder. The folder names will be 'albums/YYYY/MM Original Album Name'.

Note that these are the default layouts and you can change what is downloaded
and how it is layed out with command line options. See the help for details::
and how it is laid out with command line options. See the help for details::

gphotos-sync --help

Expand Down
2 changes: 1 addition & 1 deletion docs/explanations/notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Google Photos Library in the cloud. There are two primary reasons for this:

- Even if the API allowed it, this would be a very hard problem, because
it is often hard to identify if a local photo or video matches one in the
cloud. Besides this, I would not want the resposibility of potentially
cloud. Besides this, I would not want the responsibility of potentially
trashing someone's photo collection.
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ filterwarnings = [
"error",
"ignore:.*socket.*:ResourceWarning",
# this deprecation is rather serious for gphotos-sync as it relies on sqlite
# doing date conversion quite heavily - will ignore the deprection for now
# doing date conversion quite heavily - will ignore the deprecation for now
# DeprecationWarning: The default datetime adapter is deprecated as of Python 3.12;
"ignore:.*sqlite3.*:DeprecationWarning:",
# like the above
Expand Down Expand Up @@ -129,3 +129,10 @@ select = [
"W", # pycodestyle warnings - https://beta.ruff.rs/docs/rules/#warning-w
"I001", # isort
]

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git*,*.css'
check-hidden = true
# ignore-regex = ''
ignore-words-list = 'implementors'
4 changes: 2 additions & 2 deletions src/gphotos_sync/Checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _get_max_path_length(self) -> int:
except BaseException:
# for failures choose a safe size for Windows filesystems
log.info(
f"cant determine max filepath length, defaulting to " f"{max_length}"
f"can't determine max filepath length, defaulting to " f"{max_length}"
)
log.info("Max Path Length: %d" % max_length)
return max_length
Expand All @@ -145,7 +145,7 @@ def _get_max_filename_length(self) -> int:
# for failures choose a safe size for Windows filesystems
max_filename = 248
log.info(
f"cant determine max filename length, " f"defaulting to {max_filename}"
f"can't determine max filename length, " f"defaulting to {max_filename}"
)
log.info("Max filename length: %d" % max_filename)
return max_filename
Expand Down
2 changes: 1 addition & 1 deletion src/gphotos_sync/GoogleAlbumsSync.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def create_album_content_links(self):
follow_symlinks=False,
)
except PermissionError:
log.debug(f"cant set date on {link_file}")
log.debug(f"can't set date on {link_file}")

except FileExistsError as err:
log.info("duplicate link to %s: %s", full_file_name, err)
Expand Down
4 changes: 2 additions & 2 deletions src/gphotos_sync/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self):
"--conf",
action="store",
help="use the .ini configuration file to initialise arguments. "
"Command line provided arguments will superceed the ones in the config file",
"Command line provided arguments will supersede the ones in the config file",
)
parser.add_argument(
"root_folder",
Expand Down Expand Up @@ -286,7 +286,7 @@ def __init__(self):
)
parser.add_argument(
"--max-filename",
help="Set the maxiumum filename length for target filesystem."
help="Set the maximum filename length for target filesystem."
"This overrides the automatic detection.",
default=0,
)
Expand Down
Loading