Skip to content

Commit

Permalink
fix: style override on Windows (#422)
Browse files Browse the repository at this point in the history
* fix: use dot-slash also in Windows
* docs: for Windows users
  • Loading branch information
andreoliwa authored Jan 13, 2022
1 parent 6af77c4 commit e7d2897
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,6 @@ Use ``./`` to indicate the local style:
"https://example.com/on/the/web/remote-style.toml",
"./my-local-style.toml",
]
For Windows users: even though the path separator is a backslash, use the example above as-is.
The "dot-slash" is a convention for Nitpick_ to know this is a local style file.
7 changes: 3 additions & 4 deletions src/nitpick/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""Constants."""
import os

import jmespath

PROJECT_OWNER = "andreoliwa"
Expand Down Expand Up @@ -61,9 +59,10 @@
NITPICK_STYLES_INCLUDE_JMEX = jmespath.compile("nitpick.styles.include")
NITPICK_MINIMUM_VERSION_JMEX = jmespath.compile("nitpick.minimum_version")

#: Dot/slash is used to indicate a local style file
# Dot/slash is just a convention to indicate a local style file;
# the same pair of characters should be used on Windows, even though the path separator is different
DOT = "."
SLASH = os.path.sep
SLASH = "/"
DOT_SLASH = f"{DOT}{SLASH}"

GIT_AT_REFERENCE = "@"
Expand Down
1 change: 0 additions & 1 deletion tests/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ def test_relative_style_on_urls(tmp_path):


@responses.activate
@XFAIL_ON_WINDOWS
def test_local_style_should_override_settings(tmp_path):
"""Don't build relative URLs from local file names (starting with "./")."""
remote_url = "https://example.com/remote-style.toml"
Expand Down

0 comments on commit e7d2897

Please sign in to comment.