|
| 1 | +--- |
| 2 | +source: crates/ruff_linter/src/rules/ruff/mod.rs |
| 3 | +--- |
| 4 | +RUF066 `Annotated[]` type must not be nested within another type |
| 5 | + --> RUF066.py:4:4 |
| 6 | + | |
| 7 | +3 | # Errors |
| 8 | +4 | a: Union[Annotated[int, "An integer"], None] = 5 |
| 9 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 10 | +5 | b: Annotated[Union[int, str], "An integer or string"] | None = "World" |
| 11 | +6 | c: Optional[Annotated[float, "A float"]] = 2.71 |
| 12 | + | |
| 13 | + |
| 14 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 15 | + --> RUF066.py:5:4 |
| 16 | + | |
| 17 | +3 | # Errors |
| 18 | +4 | a: Union[Annotated[int, "An integer"], None] = 5 |
| 19 | +5 | b: Annotated[Union[int, str], "An integer or string"] | None = "World" |
| 20 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 21 | +6 | c: Optional[Annotated[float, "A float"]] = 2.71 |
| 22 | +7 | d: Union[Annotated[int, "An integer"], Annotated[str, "A string"]] |
| 23 | + | |
| 24 | + |
| 25 | +RUF066 `Annotated[]` type must not be nested within another type |
| 26 | + --> RUF066.py:6:4 |
| 27 | + | |
| 28 | +4 | a: Union[Annotated[int, "An integer"], None] = 5 |
| 29 | +5 | b: Annotated[Union[int, str], "An integer or string"] | None = "World" |
| 30 | +6 | c: Optional[Annotated[float, "A float"]] = 2.71 |
| 31 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 32 | +7 | d: Union[Annotated[int, "An integer"], Annotated[str, "A string"]] |
| 33 | + | |
| 34 | + |
| 35 | +RUF066 `Annotated[]` type must not be nested within another type |
| 36 | + --> RUF066.py:7:4 |
| 37 | + | |
| 38 | +5 | b: Annotated[Union[int, str], "An integer or string"] | None = "World" |
| 39 | +6 | c: Optional[Annotated[float, "A float"]] = 2.71 |
| 40 | +7 | d: Union[Annotated[int, "An integer"], Annotated[str, "A string"]] |
| 41 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 42 | +8 | |
| 43 | +9 | def f1(x: Union[Annotated[int, "An integer"], None]) -> None: |
| 44 | + | |
| 45 | + |
| 46 | +RUF066 `Annotated[]` type must not be nested within another type |
| 47 | + --> RUF066.py:7:4 |
| 48 | + | |
| 49 | +5 | b: Annotated[Union[int, str], "An integer or string"] | None = "World" |
| 50 | +6 | c: Optional[Annotated[float, "A float"]] = 2.71 |
| 51 | +7 | d: Union[Annotated[int, "An integer"], Annotated[str, "A string"]] |
| 52 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 53 | +8 | |
| 54 | +9 | def f1(x: Union[Annotated[int, "An integer"], None]) -> None: |
| 55 | + | |
| 56 | + |
| 57 | +RUF066 `Annotated[]` type must not be nested within another type |
| 58 | + --> RUF066.py:9:11 |
| 59 | + | |
| 60 | + 7 | d: Union[Annotated[int, "An integer"], Annotated[str, "A string"]] |
| 61 | + 8 | |
| 62 | + 9 | def f1(x: Union[Annotated[int, "An integer"], None]) -> None: |
| 63 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 64 | +10 | pass |
| 65 | + | |
| 66 | + |
| 67 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 68 | + --> RUF066.py:12:11 |
| 69 | + | |
| 70 | +10 | pass |
| 71 | +11 | |
| 72 | +12 | def f2(y: Annotated[Union[int, str], "An integer or string"] | None) -> None: |
| 73 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 74 | +13 | pass |
| 75 | + | |
| 76 | + |
| 77 | +RUF066 `Annotated[]` type must not be nested within another type |
| 78 | + --> RUF066.py:15:11 |
| 79 | + | |
| 80 | +13 | pass |
| 81 | +14 | |
| 82 | +15 | def f3(z: Optional[Annotated[float, "A float"]]) -> None: |
| 83 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 84 | +16 | pass |
| 85 | + | |
| 86 | + |
| 87 | +RUF066 `Annotated[]` type must not be nested within another type |
| 88 | + --> RUF066.py:18:4 |
| 89 | + | |
| 90 | +16 | pass |
| 91 | +17 | |
| 92 | +18 | e: Annotated[Annotated[int, "An integer"], "Another annotation"] |
| 93 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 94 | +19 | |
| 95 | +20 | l: TypeAlias = Annotated[int, "An integer"] | None |
| 96 | + | |
| 97 | + |
| 98 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 99 | + --> RUF066.py:20:16 |
| 100 | + | |
| 101 | +18 | e: Annotated[Annotated[int, "An integer"], "Another annotation"] |
| 102 | +19 | |
| 103 | +20 | l: TypeAlias = Annotated[int, "An integer"] | None |
| 104 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 105 | +21 | m: TypeAlias = Union[Annotated[int, "An integer"], str] |
| 106 | +22 | n: TypeAlias = Optional[Annotated[float, "A float"]] |
| 107 | + | |
| 108 | + |
| 109 | +RUF066 `Annotated[]` type must not be nested within another type |
| 110 | + --> RUF066.py:21:16 |
| 111 | + | |
| 112 | +20 | l: TypeAlias = Annotated[int, "An integer"] | None |
| 113 | +21 | m: TypeAlias = Union[Annotated[int, "An integer"], str] |
| 114 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 115 | +22 | n: TypeAlias = Optional[Annotated[float, "A float"]] |
| 116 | +23 | o: TypeAlias = "Annotated[str, 'A string'] | None" |
| 117 | + | |
| 118 | + |
| 119 | +RUF066 `Annotated[]` type must not be nested within another type |
| 120 | + --> RUF066.py:22:16 |
| 121 | + | |
| 122 | +20 | l: TypeAlias = Annotated[int, "An integer"] | None |
| 123 | +21 | m: TypeAlias = Union[Annotated[int, "An integer"], str] |
| 124 | +22 | n: TypeAlias = Optional[Annotated[float, "A float"]] |
| 125 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 126 | +23 | o: TypeAlias = "Annotated[str, 'A string'] | None" |
| 127 | + | |
| 128 | + |
| 129 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 130 | + --> RUF066.py:23:17 |
| 131 | + | |
| 132 | +21 | m: TypeAlias = Union[Annotated[int, "An integer"], str] |
| 133 | +22 | n: TypeAlias = Optional[Annotated[float, "A float"]] |
| 134 | +23 | o: TypeAlias = "Annotated[str, 'A string'] | None" |
| 135 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 136 | +24 | |
| 137 | +25 | p: None | Annotated[int, "An integer"] |
| 138 | + | |
| 139 | + |
| 140 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 141 | + --> RUF066.py:25:4 |
| 142 | + | |
| 143 | +23 | o: TypeAlias = "Annotated[str, 'A string'] | None" |
| 144 | +24 | |
| 145 | +25 | p: None | Annotated[int, "An integer"] |
| 146 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 147 | +26 | |
| 148 | +27 | q = Annotated[int | str, "An integer or string"] | None |
| 149 | + | |
| 150 | + |
| 151 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 152 | + --> RUF066.py:27:5 |
| 153 | + | |
| 154 | +25 | p: None | Annotated[int, "An integer"] |
| 155 | +26 | |
| 156 | +27 | q = Annotated[int | str, "An integer or string"] | None |
| 157 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 158 | +28 | r = Optional[Annotated[float | None, "A float or None"]] |
| 159 | + | |
| 160 | + |
| 161 | +RUF066 `Annotated[]` type must not be nested within another type |
| 162 | + --> RUF066.py:28:5 |
| 163 | + | |
| 164 | +27 | q = Annotated[int | str, "An integer or string"] | None |
| 165 | +28 | r = Optional[Annotated[float | None, "A float or None"]] |
| 166 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 167 | +29 | |
| 168 | +30 | @some_decorator() |
| 169 | + | |
| 170 | + |
| 171 | +RUF066 `Annotated[]` type must not be nested within a PEP604 type union (|) |
| 172 | + --> RUF066.py:31:13 |
| 173 | + | |
| 174 | +30 | @some_decorator() |
| 175 | +31 | def func(x: Annotated[str, "A string"] | None) -> None: |
| 176 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 177 | +32 | pass |
| 178 | + | |
0 commit comments