diff --git a/Makefile b/Makefile index 3fcab6575ad..9cc8db42795 100644 --- a/Makefile +++ b/Makefile @@ -64,12 +64,14 @@ format: black $(FORMAT_FILES) blackdoc $(FORMAT_FILES) ruff check --fix $(FORMAT_FILES) + ruff format $(FORMAT_FILES) check: docformatter --check $(FORMAT_FILES) black --check $(FORMAT_FILES) blackdoc --check $(FORMAT_FILES) ruff check $(FORMAT_FILES) + ruff format --check $(FORMAT_FILES) codespell: @codespell diff --git a/pygmt/tests/test_basemap.py b/pygmt/tests/test_basemap.py index 340d19c2647..a78d909cd40 100644 --- a/pygmt/tests/test_basemap.py +++ b/pygmt/tests/test_basemap.py @@ -79,7 +79,8 @@ def test_basemap_utm_projection(projection): works. """ projection = projection.replace( - "EPSG_", "EPSG:" # workaround Windows not allowing colons in filenames + "EPSG_", + "EPSG:", # workaround Windows not allowing colons in filenames ) fig = Figure() fig.basemap(region=[-52, -50, -12, -11], projection=projection, frame="afg") diff --git a/pygmt/tests/test_clib_loading.py b/pygmt/tests/test_clib_loading.py index f3871b5c7b4..8e295632497 100644 --- a/pygmt/tests/test_clib_loading.py +++ b/pygmt/tests/test_clib_loading.py @@ -156,9 +156,9 @@ def test_two_broken_libraries(self, mock_ctypes): # pylint: disable=unused-argu with pytest.raises(GMTCLibNotFoundError, match=msg_regex): load_libgmt(lib_fullnames=lib_fullnames) - def test_load_brokenlib_invalidpath( + def test_load_brokenlib_invalidpath( # pylint: disable=unused-argument self, mock_ctypes - ): # pylint: disable=unused-argument + ): """ Case 2: broken library + invalid path. @@ -176,36 +176,36 @@ def test_load_brokenlib_invalidpath( with pytest.raises(GMTCLibNotFoundError, match=msg_regex): load_libgmt(lib_fullnames=lib_fullnames) - def test_brokenlib_invalidpath_workinglib( + def test_brokenlib_invalidpath_workinglib( # pylint: disable=unused-argument self, mock_ctypes - ): # pylint: disable=unused-argument + ): """ Case 3: broken library + invalid path + working library. """ lib_fullnames = [self.faked_libgmt1, self.invalid_path, self.loaded_libgmt] assert check_libgmt(load_libgmt(lib_fullnames=lib_fullnames)) is None - def test_invalidpath_brokenlib_workinglib( + def test_invalidpath_brokenlib_workinglib( # pylint: disable=unused-argument self, mock_ctypes - ): # pylint: disable=unused-argument + ): """ Case 4: invalid path + broken library + working library. """ lib_fullnames = [self.invalid_path, self.faked_libgmt1, self.loaded_libgmt] assert check_libgmt(load_libgmt(lib_fullnames=lib_fullnames)) is None - def test_workinglib_brokenlib_invalidpath( + def test_workinglib_brokenlib_invalidpath( # pylint: disable=unused-argument self, mock_ctypes - ): # pylint: disable=unused-argument + ): """ Case 5: working library + broken library + invalid path. """ lib_fullnames = [self.loaded_libgmt, self.faked_libgmt1, self.invalid_path] assert check_libgmt(load_libgmt(lib_fullnames=lib_fullnames)) is None - def test_brokenlib_brokenlib_workinglib( + def test_brokenlib_brokenlib_workinglib( # pylint: disable=unused-argument self, mock_ctypes - ): # pylint: disable=unused-argument + ): """ Case 6: repeating broken libraries + working library. """ diff --git a/pyproject.toml b/pyproject.toml index 9414f2a557b..850664d0db9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,6 +89,11 @@ wrap-descriptions = 79 [tool.ruff] line-length = 88 # E501 (line-too-long) show-source = true + +[tool.ruff.format] +line-ending = "lf" # Use UNIX `\n` line endings for all files + +[tool.ruff.lint] select = [ "E", # pycodestyle "F", # pyflakes @@ -99,14 +104,14 @@ select = [ ] ignore = ["E501"] # Avoid enforcing line-length violations -[tool.ruff.pycodestyle] -max-doc-length = 79 +[tool.ruff.lint.isort] +known-third-party = ["pygmt"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"] # Ignore `F401` (unused-import) in all `__init__.py` files -[tool.ruff.isort] -known-third-party = ["pygmt"] +[tool.ruff.lint.pycodestyle] +max-doc-length = 79 [tool.pytest.ini_options] minversion = "6.0"