Skip to content

Commit bb2d5e1

Browse files
fix: enable PLC0415 lint rule for openlibrary/fastapi/ directory (#12291)
Co-authored-by: RayBB <RayBB@users.noreply.github.com>
1 parent b9b42f1 commit bb2d5e1

1 file changed

Lines changed: 43 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ lint.ignore = [
8282
# openlibrary/plugins/upstream/utils.py - unclear but it's huge
8383
# scripts/tests/test_affiliate_server.py - probably needed for side effects
8484
# scripts/tests/test_solr_updater.p - probably needed for side effects
85-
"PLC0415", # import-outside-top-level we really need to turn this on but it's a decently big change
8685
]
8786
line-length = 162
8887
lint.select = [
@@ -175,15 +174,15 @@ max-statements = 70
175174
"openlibrary/core/stats.py" = ["BLE001"]
176175
"openlibrary/core/vendors.py" = ["B009"]
177176
"openlibrary/coverstore/code.py" = ["E722"]
178-
"openlibrary/i18n/__init__.py" = ["BLE001"]
177+
"openlibrary/i18n/__init__.py" = ["BLE001", "PLC0415"]
179178
"openlibrary/plugins/admin/code.py" = ["E722"]
180179
"openlibrary/plugins/admin/mem.py" = ["E722"]
181180
"openlibrary/plugins/admin/memory.py" = ["E722"]
182181
"openlibrary/plugins/admin/services.py" = ["BLE001"]
183182
"openlibrary/plugins/books/dynlinks.py" = ["E722"]
184-
"openlibrary/plugins/books/readlinks.py" = ["E722"]
183+
"openlibrary/plugins/books/readlinks.py" = ["E722", "PLC0415"]
185184
"openlibrary/plugins/importapi/code.py" = ["BLE001"]
186-
"openlibrary/plugins/ol_infobase.py" = ["BLE001"]
185+
"openlibrary/plugins/ol_infobase.py" = ["BLE001", "PLC0415"]
187186
"openlibrary/plugins/openlibrary/code.py" = ["BLE001", "E722"]
188187
"openlibrary/plugins/openlibrary/connection.py" = ["E722"]
189188
"openlibrary/plugins/openlibrary/stats.py" = ["BLE001"]
@@ -196,17 +195,55 @@ max-statements = 70
196195
"openlibrary/utils/open_syllabus_project.py" = ["BLE001"]
197196
"openlibrary/utils/schema.py" = ["PERF402"]
198197
"openlibrary/utils/tests/test_retry.py" = ["PT012", "PT017"]
199-
"scripts/affiliate_server*.py" = ["SIM105"]
198+
"scripts/affiliate_server*.py" = ["SIM105", "PLC0415"]
200199
"scripts/copydocs.py" = ["BLE001", "PYI024"]
201200
"scripts/delete_import_items.py" = ["BLE001"]
202201
"scripts/import_book_covers.py" = ["BLE001"]
203202
"scripts/lc_marc_update.py" = ["E722"]
204-
"scripts/manage-imports.py" = ["BLE001"]
203+
"scripts/manage-imports.py" = ["BLE001", "PLC0415"]
205204
"scripts/sitemaps/sitemap.py" = ["BLE001"]
206205
"scripts/solr_builder/solr_builder/solr_builder.py" = ["PYI024", "PLR0913"]
207206
"scripts/tests/test_obfi.py" = ["E501"]
208207
"tests/*" = ["S101"]
209208

209+
# All these rules are about imports not at the top level of a file
210+
# TODO: Slowly move the imports to the top of the files and add noqa statements where we can't move them up
211+
# Then remove the line here
212+
"openlibrary/admin/*.py" = ["PLC0415"]
213+
"openlibrary/core/*.py" = ["PLC0415"]
214+
"openlibrary/coverstore/*.py" = ["PLC0415"]
215+
"openlibrary/plugins/admin/*.py" = ["PLC0415"]
216+
"openlibrary/plugins/importapi/*.py" = ["PLC0415"]
217+
"openlibrary/plugins/openlibrary/*.py" = ["PLC0415"]
218+
"openlibrary/plugins/upstream/*.py" = ["PLC0415"]
219+
"openlibrary/plugins/upstream/tests/*.py" = ["PLC0415"]
220+
"openlibrary/plugins/worksearch/*.py" = ["PLC0415"]
221+
"openlibrary/plugins/worksearch/tests/*.py" = ["PLC0415"]
222+
"openlibrary/plugins/worksearch/schemes/*.py" = ["PLC0415"]
223+
"openlibrary/plugins/worksearch/schemes/tests/*.py" = ["PLC0415"]
224+
"openlibrary/tests/fastapi/*.py" = ["PLC0415"]
225+
"openlibrary/accounts/model.py" = ["PLC0415"]
226+
"openlibrary/asgi_app.py" = ["PLC0415"]
227+
"openlibrary/book_providers.py" = ["PLC0415"]
228+
"openlibrary/catalog/add_book/__init__.py" = ["PLC0415"]
229+
"openlibrary/code.py" = ["PLC0415"]
230+
"openlibrary/conftest.py" = ["PLC0415"]
231+
"openlibrary/core/lists/model.py" = ["PLC0415"]
232+
"openlibrary/coverstore/tests/test_coverstore.py" = ["PLC0415"]
233+
"openlibrary/mocks/mock_infobase.py" = ["PLC0415"]
234+
"openlibrary/solr/data_provider.py" = ["PLC0415"]
235+
"openlibrary/tests/core/test_models.py" = ["PLC0415"]
236+
"openlibrary/utils/tests/test_request_context.py" = ["PLC0415"]
237+
"openlibrary/views/showmarc.py" = ["PLC0415"]
238+
"scripts/coverstore-server" = ["PLC0415"]
239+
"scripts/infobase-server" = ["PLC0415"]
240+
"scripts/openlibrary-server" = ["PLC0415"]
241+
"scripts/monitoring/monitor.py" = ["PLC0415"]
242+
"scripts/solr_updater/solr_updater.py" = ["PLC0415"]
243+
"scripts/utils/scheduler.py" = ["PLC0415"]
244+
"tests/test_docker_compose.py" = ["PLC0415"]
245+
246+
210247
[tool.sqlfluff.core]
211248
dialect = "postgres"
212249
# ── Rule Exclusions ──────────────────────────────────────────────────

0 commit comments

Comments
 (0)