---
source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs
---
PTH210_1.py:13:5: PTH210 Invalid suffix passed to `.with_suffix()`
   |
11 | def test_path(p: Path) -> None:
12 |     ## Errors
13 |     p.with_suffix(".")
   |     ^^^^^^^^^^^^^^^^^^ PTH210
14 |     p.with_suffix("py")
15 |     p.with_suffix(r"s")
   |
   = help: Remove "." or extend to valid suffix

PTH210_1.py:14:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
12 |     ## Errors
13 |     p.with_suffix(".")
14 |     p.with_suffix("py")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
15 |     p.with_suffix(r"s")
16 |     p.with_suffix(u'' "json")
   |
   = help: Add a leading dot

ℹ Unsafe fix
11 11 | def test_path(p: Path) -> None:
12 12 |     ## Errors
13 13 |     p.with_suffix(".")
14    |-    p.with_suffix("py")
   14 |+    p.with_suffix(".py")
15 15 |     p.with_suffix(r"s")
16 16 |     p.with_suffix(u'' "json")
17 17 |     p.with_suffix(suffix="js")

PTH210_1.py:15:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
13 |     p.with_suffix(".")
14 |     p.with_suffix("py")
15 |     p.with_suffix(r"s")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
16 |     p.with_suffix(u'' "json")
17 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
12 12 |     ## Errors
13 13 |     p.with_suffix(".")
14 14 |     p.with_suffix("py")
15    |-    p.with_suffix(r"s")
   15 |+    p.with_suffix(r".s")
16 16 |     p.with_suffix(u'' "json")
17 17 |     p.with_suffix(suffix="js")
18 18 | 

PTH210_1.py:16:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
14 |     p.with_suffix("py")
15 |     p.with_suffix(r"s")
16 |     p.with_suffix(u'' "json")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
17 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
13 13 |     p.with_suffix(".")
14 14 |     p.with_suffix("py")
15 15 |     p.with_suffix(r"s")
16    |-    p.with_suffix(u'' "json")
   16 |+    p.with_suffix(u'.' "json")
17 17 |     p.with_suffix(suffix="js")
18 18 | 
19 19 |     ## No errors

PTH210_1.py:17:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
15 |     p.with_suffix(r"s")
16 |     p.with_suffix(u'' "json")
17 |     p.with_suffix(suffix="js")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
18 |
19 |     ## No errors
   |
   = help: Add a leading dot

ℹ Unsafe fix
14 14 |     p.with_suffix("py")
15 15 |     p.with_suffix(r"s")
16 16 |     p.with_suffix(u'' "json")
17    |-    p.with_suffix(suffix="js")
   17 |+    p.with_suffix(suffix=".js")
18 18 | 
19 19 |     ## No errors
20 20 |     p.with_suffix()

PTH210_1.py:31:5: PTH210 Invalid suffix passed to `.with_suffix()`
   |
29 | def test_posix_path(p: PosixPath) -> None:
30 |     ## Errors
31 |     p.with_suffix(".")
   |     ^^^^^^^^^^^^^^^^^^ PTH210
32 |     p.with_suffix("py")
33 |     p.with_suffix(r"s")
   |
   = help: Remove "." or extend to valid suffix

PTH210_1.py:32:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
30 |     ## Errors
31 |     p.with_suffix(".")
32 |     p.with_suffix("py")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
33 |     p.with_suffix(r"s")
34 |     p.with_suffix(u'' "json")
   |
   = help: Add a leading dot

ℹ Unsafe fix
29 29 | def test_posix_path(p: PosixPath) -> None:
30 30 |     ## Errors
31 31 |     p.with_suffix(".")
32    |-    p.with_suffix("py")
   32 |+    p.with_suffix(".py")
33 33 |     p.with_suffix(r"s")
34 34 |     p.with_suffix(u'' "json")
35 35 |     p.with_suffix(suffix="js")

PTH210_1.py:33:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
31 |     p.with_suffix(".")
32 |     p.with_suffix("py")
33 |     p.with_suffix(r"s")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
34 |     p.with_suffix(u'' "json")
35 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
30 30 |     ## Errors
31 31 |     p.with_suffix(".")
32 32 |     p.with_suffix("py")
33    |-    p.with_suffix(r"s")
   33 |+    p.with_suffix(r".s")
34 34 |     p.with_suffix(u'' "json")
35 35 |     p.with_suffix(suffix="js")
36 36 | 

PTH210_1.py:34:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
32 |     p.with_suffix("py")
33 |     p.with_suffix(r"s")
34 |     p.with_suffix(u'' "json")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
35 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
31 31 |     p.with_suffix(".")
32 32 |     p.with_suffix("py")
33 33 |     p.with_suffix(r"s")
34    |-    p.with_suffix(u'' "json")
   34 |+    p.with_suffix(u'.' "json")
35 35 |     p.with_suffix(suffix="js")
36 36 | 
37 37 |     ## No errors

PTH210_1.py:35:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
33 |     p.with_suffix(r"s")
34 |     p.with_suffix(u'' "json")
35 |     p.with_suffix(suffix="js")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
36 |
37 |     ## No errors
   |
   = help: Add a leading dot

ℹ Unsafe fix
32 32 |     p.with_suffix("py")
33 33 |     p.with_suffix(r"s")
34 34 |     p.with_suffix(u'' "json")
35    |-    p.with_suffix(suffix="js")
   35 |+    p.with_suffix(suffix=".js")
36 36 | 
37 37 |     ## No errors
38 38 |     p.with_suffix()

PTH210_1.py:49:5: PTH210 Invalid suffix passed to `.with_suffix()`
   |
47 | def test_pure_path(p: PurePath) -> None:
48 |     ## Errors
49 |     p.with_suffix(".")
   |     ^^^^^^^^^^^^^^^^^^ PTH210
50 |     p.with_suffix("py")
51 |     p.with_suffix(r"s")
   |
   = help: Remove "." or extend to valid suffix

PTH210_1.py:50:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
48 |     ## Errors
49 |     p.with_suffix(".")
50 |     p.with_suffix("py")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
51 |     p.with_suffix(r"s")
52 |     p.with_suffix(u'' "json")
   |
   = help: Add a leading dot

ℹ Unsafe fix
47 47 | def test_pure_path(p: PurePath) -> None:
48 48 |     ## Errors
49 49 |     p.with_suffix(".")
50    |-    p.with_suffix("py")
   50 |+    p.with_suffix(".py")
51 51 |     p.with_suffix(r"s")
52 52 |     p.with_suffix(u'' "json")
53 53 |     p.with_suffix(suffix="js")

PTH210_1.py:51:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
49 |     p.with_suffix(".")
50 |     p.with_suffix("py")
51 |     p.with_suffix(r"s")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
52 |     p.with_suffix(u'' "json")
53 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
48 48 |     ## Errors
49 49 |     p.with_suffix(".")
50 50 |     p.with_suffix("py")
51    |-    p.with_suffix(r"s")
   51 |+    p.with_suffix(r".s")
52 52 |     p.with_suffix(u'' "json")
53 53 |     p.with_suffix(suffix="js")
54 54 | 

PTH210_1.py:52:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
50 |     p.with_suffix("py")
51 |     p.with_suffix(r"s")
52 |     p.with_suffix(u'' "json")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
53 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
49 49 |     p.with_suffix(".")
50 50 |     p.with_suffix("py")
51 51 |     p.with_suffix(r"s")
52    |-    p.with_suffix(u'' "json")
   52 |+    p.with_suffix(u'.' "json")
53 53 |     p.with_suffix(suffix="js")
54 54 | 
55 55 |     ## No errors

PTH210_1.py:53:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
51 |     p.with_suffix(r"s")
52 |     p.with_suffix(u'' "json")
53 |     p.with_suffix(suffix="js")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
54 |
55 |     ## No errors
   |
   = help: Add a leading dot

ℹ Unsafe fix
50 50 |     p.with_suffix("py")
51 51 |     p.with_suffix(r"s")
52 52 |     p.with_suffix(u'' "json")
53    |-    p.with_suffix(suffix="js")
   53 |+    p.with_suffix(suffix=".js")
54 54 | 
55 55 |     ## No errors
56 56 |     p.with_suffix()

PTH210_1.py:67:5: PTH210 Invalid suffix passed to `.with_suffix()`
   |
65 | def test_pure_posix_path(p: PurePosixPath) -> None:
66 |     ## Errors
67 |     p.with_suffix(".")
   |     ^^^^^^^^^^^^^^^^^^ PTH210
68 |     p.with_suffix("py")
69 |     p.with_suffix(r"s")
   |
   = help: Remove "." or extend to valid suffix

PTH210_1.py:68:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
66 |     ## Errors
67 |     p.with_suffix(".")
68 |     p.with_suffix("py")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
69 |     p.with_suffix(r"s")
70 |     p.with_suffix(u'' "json")
   |
   = help: Add a leading dot

ℹ Unsafe fix
65 65 | def test_pure_posix_path(p: PurePosixPath) -> None:
66 66 |     ## Errors
67 67 |     p.with_suffix(".")
68    |-    p.with_suffix("py")
   68 |+    p.with_suffix(".py")
69 69 |     p.with_suffix(r"s")
70 70 |     p.with_suffix(u'' "json")
71 71 |     p.with_suffix(suffix="js")

PTH210_1.py:69:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
67 |     p.with_suffix(".")
68 |     p.with_suffix("py")
69 |     p.with_suffix(r"s")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
70 |     p.with_suffix(u'' "json")
71 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
66 66 |     ## Errors
67 67 |     p.with_suffix(".")
68 68 |     p.with_suffix("py")
69    |-    p.with_suffix(r"s")
   69 |+    p.with_suffix(r".s")
70 70 |     p.with_suffix(u'' "json")
71 71 |     p.with_suffix(suffix="js")
72 72 | 

PTH210_1.py:70:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
68 |     p.with_suffix("py")
69 |     p.with_suffix(r"s")
70 |     p.with_suffix(u'' "json")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
71 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
67 67 |     p.with_suffix(".")
68 68 |     p.with_suffix("py")
69 69 |     p.with_suffix(r"s")
70    |-    p.with_suffix(u'' "json")
   70 |+    p.with_suffix(u'.' "json")
71 71 |     p.with_suffix(suffix="js")
72 72 | 
73 73 |     ## No errors

PTH210_1.py:71:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
69 |     p.with_suffix(r"s")
70 |     p.with_suffix(u'' "json")
71 |     p.with_suffix(suffix="js")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
72 |
73 |     ## No errors
   |
   = help: Add a leading dot

ℹ Unsafe fix
68 68 |     p.with_suffix("py")
69 69 |     p.with_suffix(r"s")
70 70 |     p.with_suffix(u'' "json")
71    |-    p.with_suffix(suffix="js")
   71 |+    p.with_suffix(suffix=".js")
72 72 | 
73 73 |     ## No errors
74 74 |     p.with_suffix()

PTH210_1.py:85:5: PTH210 Invalid suffix passed to `.with_suffix()`
   |
83 | def test_pure_windows_path(p: PureWindowsPath) -> None:
84 |     ## Errors
85 |     p.with_suffix(".")
   |     ^^^^^^^^^^^^^^^^^^ PTH210
86 |     p.with_suffix("py")
87 |     p.with_suffix(r"s")
   |
   = help: Remove "." or extend to valid suffix

PTH210_1.py:86:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
84 |     ## Errors
85 |     p.with_suffix(".")
86 |     p.with_suffix("py")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
87 |     p.with_suffix(r"s")
88 |     p.with_suffix(u'' "json")
   |
   = help: Add a leading dot

ℹ Unsafe fix
83 83 | def test_pure_windows_path(p: PureWindowsPath) -> None:
84 84 |     ## Errors
85 85 |     p.with_suffix(".")
86    |-    p.with_suffix("py")
   86 |+    p.with_suffix(".py")
87 87 |     p.with_suffix(r"s")
88 88 |     p.with_suffix(u'' "json")
89 89 |     p.with_suffix(suffix="js")

PTH210_1.py:87:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
85 |     p.with_suffix(".")
86 |     p.with_suffix("py")
87 |     p.with_suffix(r"s")
   |     ^^^^^^^^^^^^^^^^^^^ PTH210
88 |     p.with_suffix(u'' "json")
89 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
84 84 |     ## Errors
85 85 |     p.with_suffix(".")
86 86 |     p.with_suffix("py")
87    |-    p.with_suffix(r"s")
   87 |+    p.with_suffix(r".s")
88 88 |     p.with_suffix(u'' "json")
89 89 |     p.with_suffix(suffix="js")
90 90 | 

PTH210_1.py:88:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
86 |     p.with_suffix("py")
87 |     p.with_suffix(r"s")
88 |     p.with_suffix(u'' "json")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
89 |     p.with_suffix(suffix="js")
   |
   = help: Add a leading dot

ℹ Unsafe fix
85 85 |     p.with_suffix(".")
86 86 |     p.with_suffix("py")
87 87 |     p.with_suffix(r"s")
88    |-    p.with_suffix(u'' "json")
   88 |+    p.with_suffix(u'.' "json")
89 89 |     p.with_suffix(suffix="js")
90 90 | 
91 91 |     ## No errors

PTH210_1.py:89:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
   |
87 |     p.with_suffix(r"s")
88 |     p.with_suffix(u'' "json")
89 |     p.with_suffix(suffix="js")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
90 |
91 |     ## No errors
   |
   = help: Add a leading dot

ℹ Unsafe fix
86 86 |     p.with_suffix("py")
87 87 |     p.with_suffix(r"s")
88 88 |     p.with_suffix(u'' "json")
89    |-    p.with_suffix(suffix="js")
   89 |+    p.with_suffix(suffix=".js")
90 90 | 
91 91 |     ## No errors
92 92 |     p.with_suffix()

PTH210_1.py:103:5: PTH210 Invalid suffix passed to `.with_suffix()`
    |
101 | def test_windows_path(p: WindowsPath) -> None:
102 |     ## Errors
103 |     p.with_suffix(".")
    |     ^^^^^^^^^^^^^^^^^^ PTH210
104 |     p.with_suffix("py")
105 |     p.with_suffix(r"s")
    |
    = help: Remove "." or extend to valid suffix

PTH210_1.py:104:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
    |
102 |     ## Errors
103 |     p.with_suffix(".")
104 |     p.with_suffix("py")
    |     ^^^^^^^^^^^^^^^^^^^ PTH210
105 |     p.with_suffix(r"s")
106 |     p.with_suffix(u'' "json")
    |
    = help: Add a leading dot

ℹ Unsafe fix
101 101 | def test_windows_path(p: WindowsPath) -> None:
102 102 |     ## Errors
103 103 |     p.with_suffix(".")
104     |-    p.with_suffix("py")
    104 |+    p.with_suffix(".py")
105 105 |     p.with_suffix(r"s")
106 106 |     p.with_suffix(u'' "json")
107 107 |     p.with_suffix(suffix="js")

PTH210_1.py:105:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
    |
103 |     p.with_suffix(".")
104 |     p.with_suffix("py")
105 |     p.with_suffix(r"s")
    |     ^^^^^^^^^^^^^^^^^^^ PTH210
106 |     p.with_suffix(u'' "json")
107 |     p.with_suffix(suffix="js")
    |
    = help: Add a leading dot

ℹ Unsafe fix
102 102 |     ## Errors
103 103 |     p.with_suffix(".")
104 104 |     p.with_suffix("py")
105     |-    p.with_suffix(r"s")
    105 |+    p.with_suffix(r".s")
106 106 |     p.with_suffix(u'' "json")
107 107 |     p.with_suffix(suffix="js")
108 108 | 

PTH210_1.py:106:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
    |
104 |     p.with_suffix("py")
105 |     p.with_suffix(r"s")
106 |     p.with_suffix(u'' "json")
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
107 |     p.with_suffix(suffix="js")
    |
    = help: Add a leading dot

ℹ Unsafe fix
103 103 |     p.with_suffix(".")
104 104 |     p.with_suffix("py")
105 105 |     p.with_suffix(r"s")
106     |-    p.with_suffix(u'' "json")
    106 |+    p.with_suffix(u'.' "json")
107 107 |     p.with_suffix(suffix="js")
108 108 | 
109 109 |     ## No errors

PTH210_1.py:107:5: PTH210 [*] Dotless suffix passed to `.with_suffix()`
    |
105 |     p.with_suffix(r"s")
106 |     p.with_suffix(u'' "json")
107 |     p.with_suffix(suffix="js")
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ PTH210
108 |
109 |     ## No errors
    |
    = help: Add a leading dot

ℹ Unsafe fix
104 104 |     p.with_suffix("py")
105 105 |     p.with_suffix(r"s")
106 106 |     p.with_suffix(u'' "json")
107     |-    p.with_suffix(suffix="js")
    107 |+    p.with_suffix(suffix=".js")
108 108 | 
109 109 |     ## No errors
110 110 |     p.with_suffix()
