diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6c3d4780..46d53e970 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: name: Validating CITATION.cff using 'cffconvert' - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 6.0.1 hooks: - id: isort name: Sorting Python import lines using 'isort' @@ -17,26 +17,26 @@ repos: - "--diff" - repo: https://github.com/regebro/pyroma - rev: "4.2" + rev: "5.0" hooks: - id: pyroma name: Assessing the package metadata using 'pyroma' - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.278 + rev: v0.12.9 hooks: - id: ruff name: Linting using 'ruff' - repo: https://github.com/PyCQA/prospector - rev: 1.10.2 + rev: v1.17.3 hooks: - id: prospector name: Linting the code base using 'prospector' args: ["--profile-path", ".prospector.yml"] - repo: https://github.com/tcort/markdown-link-check - rev: bde6fd2675901c55f8a356a67475257d44af51ae # 3.11.2 + rev: v3.13.7 hooks: - id: markdown-link-check args: [-q] diff --git a/pyproject.toml b/pyproject.toml index 5b819f115..3ac361044 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,10 +132,14 @@ testpaths = [ [tool.ruff] line-length = 120 + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +[tool.ruff.lint] select = ["E", "F", "W", "C901", "Q"] # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -[tool.ruff.flake8-quotes] +[tool.ruff.lint.flake8-quotes] docstring-quotes = "double" inline-quotes = "double" diff --git a/src/cffconvert/cli/rawify_url.py b/src/cffconvert/cli/rawify_url.py index e40d4e73d..48b10b840 100644 --- a/src/cffconvert/cli/rawify_url.py +++ b/src/cffconvert/cli/rawify_url.py @@ -20,7 +20,7 @@ def rawify_url(url): # Proceed with making the call without authenticating -- stricter rate limits apply pass else: - headers.update({"Authorization": f"Bearer { token }"}) + headers.update({"Authorization": f"Bearer {token}"}) try: response = requests.get(repos_api, headers=headers, timeout=10) diff --git a/src/cffconvert/cli/read_from_url.py b/src/cffconvert/cli/read_from_url.py index e481986f5..2fc558833 100644 --- a/src/cffconvert/cli/read_from_url.py +++ b/src/cffconvert/cli/read_from_url.py @@ -15,7 +15,7 @@ def read_from_url(url): # Proceed with making the call without authenticating -- stricter rate limits apply pass else: - headers.update({"Authorization": f"Bearer { token }"}) + headers.update({"Authorization": f"Bearer {token}"}) response = requests.get(url_raw, headers=headers, timeout=30) if response.ok: return response.text diff --git a/src/cffconvert/lib/cff_1_x_x/authors/ris.py b/src/cffconvert/lib/cff_1_x_x/authors/ris.py index d019d83c8..824898b43 100644 --- a/src/cffconvert/lib/cff_1_x_x/authors/ris.py +++ b/src/cffconvert/lib/cff_1_x_x/authors/ris.py @@ -138,19 +138,19 @@ def __init__(self, author): } def _from_alias(self): - return f"AU - { self._author.get('alias') }\n" + return f"AU - {self._author.get('alias')}\n" def _from_given_and_last(self): - return f"AU - { self._get_full_last_name() }, { self._author.get('given-names') }\n" + return f"AU - {self._get_full_last_name()}, {self._author.get('given-names')}\n" def _from_given(self): - return f"AU - { self._author.get('given-names') }\n" + return f"AU - {self._author.get('given-names')}\n" def _from_last(self): - return f"AU - { self._get_full_last_name() }\n" + return f"AU - {self._get_full_last_name()}\n" def _from_name(self): - return f"AU - { self._author.get('name') }\n" + return f"AU - {self._author.get('name')}\n" def as_string(self): key = self._get_key() diff --git a/src/cffconvert/lib/cff_1_x_x/urls/bibtex.py b/src/cffconvert/lib/cff_1_x_x/urls/bibtex.py index 72a624de5..053ad33d3 100644 --- a/src/cffconvert/lib/cff_1_x_x/urls/bibtex.py +++ b/src/cffconvert/lib/cff_1_x_x/urls/bibtex.py @@ -44,24 +44,24 @@ def __init__(self, cffobj): def _from_identifiers_url(self): urls = self._get_urls_from_identifiers() if len(urls) > 0: - return f"url = { '{' + urls[0].get('value') + '}' }" + return f"url = {{{urls[0].get('value')}}}" return None def _from_repository(self): - return f"url = { '{' + self._cffobj.get('repository') + '}' }" + return f"url = {{{self._cffobj.get('repository')}}}" def _from_repository_artifact(self): - return f"url = { '{' + self._cffobj.get('repository-artifact') + '}' }" + return f"url = {{{self._cffobj.get('repository-artifact')}}}" def _from_repository_code(self): - return f"url = { '{' + self._cffobj.get('repository-code') + '}' }" + return f"url = {{{self._cffobj.get('repository-code')}}}" @staticmethod def _from_thin_air(): return None def _from_url(self): - return f"url = { '{' + self._cffobj.get('url') + '}' }" + return f"url = {{{self._cffobj.get('url')}}}" def as_string(self): key = "".join([ diff --git a/src/cffconvert/lib/cff_1_x_x/urls/ris.py b/src/cffconvert/lib/cff_1_x_x/urls/ris.py index 40e9a947e..885ba0eb1 100644 --- a/src/cffconvert/lib/cff_1_x_x/urls/ris.py +++ b/src/cffconvert/lib/cff_1_x_x/urls/ris.py @@ -44,24 +44,24 @@ def __init__(self, cffobj): def _from_identifiers_url(self): urls = self._get_urls_from_identifiers() if len(urls) > 0: - return f"UR - { urls[0].get('value') }\n" + return f"UR - {urls[0].get('value')}\n" return None def _from_repository(self): - return f"UR - { self._cffobj.get('repository') }\n" + return f"UR - {self._cffobj.get('repository')}\n" def _from_repository_artifact(self): - return f"UR - { self._cffobj.get('repository-artifact') }\n" + return f"UR - {self._cffobj.get('repository-artifact')}\n" def _from_repository_code(self): - return f"UR - { self._cffobj.get('repository-code') }\n" + return f"UR - {self._cffobj.get('repository-code')}\n" @staticmethod def _from_thin_air(): return None def _from_url(self): - return f"UR - { self._cffobj.get('url') }\n" + return f"UR - {self._cffobj.get('url')}\n" def as_string(self): key = "".join([