---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLE0118 Name `x` is used prior to global declaration on line 7
 --> load_before_global_declaration.py:5:11
  |
3 | ###
4 | def f():
5 |     print(x)
  |           ^
6 |
7 |     global x
  |

PLE0118 Name `x` is used prior to global declaration on line 17
  --> load_before_global_declaration.py:15:11
   |
13 |     global x
14 |
15 |     print(x)
   |           ^
16 |
17 |     global x
   |

PLE0118 Name `x` is used prior to global declaration on line 25
  --> load_before_global_declaration.py:23:11
   |
22 | def f():
23 |     print(x)
   |           ^
24 |
25 |     global x, y
   |

PLE0118 Name `x` is used prior to global declaration on line 35
  --> load_before_global_declaration.py:33:11
   |
31 |     global x, y
32 |
33 |     print(x)
   |           ^
34 |
35 |     global x, y
   |

PLE0118 Name `x` is used prior to global declaration on line 43
  --> load_before_global_declaration.py:41:5
   |
40 | def f():
41 |     x = 1
   |     ^
42 |
43 |     global x
   |

PLE0118 Name `x` is used prior to global declaration on line 53
  --> load_before_global_declaration.py:51:5
   |
49 |     global x
50 |
51 |     x = 1
   |     ^
52 |
53 |     global x
   |

PLE0118 Name `x` is used prior to global declaration on line 61
  --> load_before_global_declaration.py:59:9
   |
58 | def f():
59 |     del x
   |         ^
60 |
61 |     global x, y
   |

PLE0118 Name `x` is used prior to global declaration on line 71
  --> load_before_global_declaration.py:69:9
   |
67 |     global x, y
68 |
69 |     del x
   |         ^
70 |
71 |     global x, y
   |

PLE0118 Name `x` is used prior to global declaration on line 79
  --> load_before_global_declaration.py:77:9
   |
76 | def f():
77 |     del x
   |         ^
78 |
79 |     global x
   |

PLE0118 Name `x` is used prior to global declaration on line 89
  --> load_before_global_declaration.py:87:9
   |
85 |     global x
86 |
87 |     del x
   |         ^
88 |
89 |     global x
   |

PLE0118 Name `x` is used prior to global declaration on line 97
  --> load_before_global_declaration.py:95:9
   |
94 | def f():
95 |     del x
   |         ^
96 |
97 |     global x, y
   |

PLE0118 Name `x` is used prior to global declaration on line 107
   --> load_before_global_declaration.py:105:9
    |
103 |     global x, y
104 |
105 |     del x
    |         ^
106 |
107 |     global x, y
    |

PLE0118 Name `x` is used prior to global declaration on line 114
   --> load_before_global_declaration.py:113:14
    |
112 | def f():
113 |     print(f"{x=}")
    |              ^
114 |     global x
    |

PLE0118 Name `x` is used prior to global declaration on line 163
   --> load_before_global_declaration.py:162:1
    |
161 | # surprisingly still an error, global in module scope
162 | x = None
    | ^
163 | global x
    |
