Skip to content

Commit 77dec50

Browse files
authored
Add --min-severity=warn to pyrefly command (#2230)
1 parent 173483b commit 77dec50

File tree

4 files changed

+24
-27
lines changed

4 files changed

+24
-27
lines changed
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
conformant = "Unsupported"
2-
conformance_automated = "Fail"
1+
conformant = "Pass"
2+
conformance_automated = "Pass"
33
errors_diff = """
4-
Line 18: Expected 1 errors
5-
Line 24: Expected 1 errors
6-
Line 25: Expected 1 errors
7-
Line 30: Expected 1 errors
8-
Line 41: Expected 1 errors
9-
Line 42: Expected 1 errors
10-
Line 44: Expected 1 errors
11-
Line 47: Expected 1 errors
12-
Line 48: Expected 1 errors
13-
Line 58: Expected 1 errors
14-
Line 69: Expected 1 errors
15-
Line 98: Expected 1 errors
164
"""
175
output = """
6+
WARN directives_deprecated.py:18:44-47: `Ham` is deprecated [deprecated]
7+
WARN directives_deprecated.py:24:1-23: `_directives_deprecated_library.norwegian_blue` is deprecated [deprecated]
8+
WARN directives_deprecated.py:25:5-27: `_directives_deprecated_library.norwegian_blue` is deprecated [deprecated]
9+
WARN directives_deprecated.py:30:12-15: Call to deprecated overload `_directives_deprecated_library.foo` [deprecated]
10+
WARN directives_deprecated.py:41:5-13: `+` is not supported between `Spam` and `Literal[1]` [deprecated]
11+
WARN directives_deprecated.py:42:1-10: `+=` is not supported between `Spam` and `Literal[1]` [deprecated]
12+
WARN directives_deprecated.py:44:1-12: `_directives_deprecated_library.Spam.greasy` is deprecated [deprecated]
13+
WARN directives_deprecated.py:47:1-11: `_directives_deprecated_library.Spam.shape` is deprecated [deprecated]
14+
WARN directives_deprecated.py:48:1-11: `_directives_deprecated_library.Spam.shape` is deprecated [deprecated]
15+
WARN directives_deprecated.py:58:1-10: `Invocable.__call__` is deprecated [deprecated]
16+
WARN directives_deprecated.py:69:1-6: `lorem` is deprecated [deprecated]
17+
WARN directives_deprecated.py:98:5-10: `SupportsFoo1.foo` is deprecated [deprecated]
1818
"""
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
conformant = "Partial"
2-
notes = """
3-
Does not detect Protocol type parameters with wrong variance.
4-
"""
5-
conformance_automated = "Fail"
1+
conformant = "Pass"
2+
conformance_automated = "Pass"
63
errors_diff = """
7-
Line 21: Expected 1 errors
8-
Line 40: Expected 1 errors
9-
Line 56: Expected 1 errors
10-
Line 66: Expected 1 errors
11-
Line 104: Expected 1 errors
124
"""
135
output = """
6+
WARN protocols_variance.py:21:7-17: Type variable `T1` in class `AnotherBox` is declared as invariant, but could be covariant based on its usage [variance-mismatch]
7+
WARN protocols_variance.py:40:7-16: Type variable `T3` in class `Protocol2` is declared as invariant, but could be contravariant based on its usage [variance-mismatch]
8+
WARN protocols_variance.py:56:7-16: Type variable `T1` in class `Protocol4` is declared as invariant, but could be contravariant based on its usage [variance-mismatch]
149
ERROR protocols_variance.py:62:9-11: Type variable `T1_co` is Covariant but is used in contravariant position [invalid-variance]
10+
WARN protocols_variance.py:66:7-16: Type variable `T1` in class `Protocol6` is declared as invariant, but could be covariant based on its usage [variance-mismatch]
1511
ERROR protocols_variance.py:72:9-11: Type variable `T1_contra` is Contravariant but is used in covariant position [invalid-variance]
12+
WARN protocols_variance.py:104:7-17: Type variable `T1` in class `Protocol12` is declared as invariant, but could be covariant based on its usage [variance-mismatch]
1613
"""

conformance/results/results.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ <h3>Python Type System Conformance Test Results</h3>
683683
<th class="column col2 conformant">Pass</th>
684684
<th class="column col2 conformant">Pass</th>
685685
<th class="column col2 conformant">Pass</th>
686-
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not detect Protocol type parameters with wrong variance.</p></span></div></th>
686+
<th class="column col2 conformant">Pass</th>
687687
<th class="column col2 not-conformant">Unsupported</th>
688688
</tr>
689689
<tr><th class="column" colspan="6">
@@ -1164,7 +1164,7 @@ <h3>Python Type System Conformance Test Results</h3>
11641164
<th class="column col2 conformant">Pass</th>
11651165
<th class="column col2 conformant">Pass</th>
11661166
<th class="column col2 conformant">Pass</th>
1167-
<th class="column col2 not-conformant">Unsupported</th>
1167+
<th class="column col2 conformant">Pass</th>
11681168
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not detect calls to deprecated overloads.</p><p>Does not detect implicit calls to deprecated dunder methods, for example via operators.</p><p>Does not detect accesses of, or attempts to set, deprecated properties.</p></span></div></th>
11691169
</tr>
11701170
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directives_no_type_check</th>

conformance/src/type_checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def get_version(self) -> str:
326326

327327
def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
328328
proc = run(
329-
["pyrefly", "check", "--output-format", "min-text", "--summary=none"],
329+
["pyrefly", "check", "--output-format", "min-text", "--summary=none", "--min-severity=warn"],
330330
stdout=PIPE,
331331
text=True,
332332
encoding="utf-8",

0 commit comments

Comments
 (0)