Skip to content

Commit

Permalink
Merge pull request #620 from ZeitOnline/maint/ruff
Browse files Browse the repository at this point in the history
MAINT: Enable "undefined name" lint
  • Loading branch information
wosc authored Feb 14, 2024
2 parents 4df323a + f031fb1 commit 4e5ab0b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 64 deletions.
21 changes: 11 additions & 10 deletions core/src/zeit/cms/browser/resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: F821
import importlib.resources
import os.path
import sys
Expand Down Expand Up @@ -93,7 +94,7 @@ def __init__(self, filename, *args, **kw):


SplitDirResource('namespace.js')
SplitDirResource('logging.js', depends=[namespace_js, mochikit, jquery]) # noqa
SplitDirResource('logging.js', depends=[namespace_js, mochikit, jquery])
SplitDirResource('draganddrop.js', depends=[mochikit])
SplitDirResource(
'base.js',
Expand All @@ -102,7 +103,7 @@ def __init__(self, filename, *args, **kw):
draganddrop_js,
mochikit,
jquery,
jqueryui, # noqa
jqueryui,
underscore,
select2_de,
],
Expand All @@ -112,25 +113,25 @@ def __init__(self, filename, *args, **kw):
[
namespace_js,
logging_js,
base_js, # noqa
base_js,
cms_css,
forms_css,
tables_css,
lightbox_css, # noqa
lightbox_css,
cms_widgets_css,
object_details_css, # noqa
object_details_css,
]
)

SplitDirResource('objectbrowser.js', depends=[base])
SplitDirResource('tooltip.js', depends=[base])
SplitDirResource('view.js', depends=[base])
SplitDirResource('form.js', depends=[view_js, base]) # noqa
SplitDirResource('lightbox.js', depends=[form_js, base]) # noqa
SplitDirResource('form.js', depends=[view_js, base])
SplitDirResource('lightbox.js', depends=[form_js, base])
SplitDirResource('counter.js', depends=[base])
SplitDirResource('details.js', depends=[base])
SplitDirResource('dnd.js', depends=[base])
SplitDirResource('object_reference.js', depends=[lightbox_js, base]) # noqa
SplitDirResource('object_reference.js', depends=[lightbox_js, base])
SplitDirResource('object_sequence.js', depends=[base])
SplitDirResource('restructuredtext.js', depends=[base])
SplitDirResource('autocomplete.js', depends=[base])
Expand All @@ -139,8 +140,8 @@ def __init__(self, filename, *args, **kw):
SplitDirResource('xeyes.js', depends=[base])
SplitDirResource('menu.js', depends=[base])
SplitDirResource('json-template.js', depends=[base])
SplitDirResource('messages.js', depends=[base, view_js]) # noqa
SplitDirResource('tab.js', depends=[base, view_js]) # noqa
SplitDirResource('messages.js', depends=[base, view_js])
SplitDirResource('tab.js', depends=[base, view_js])
SplitDirResource('tree.js', depends=[base])
SplitDirResource('filteringtable.js', depends=[base])
SplitDirResource('panelHandlers.js', depends=[base])
Expand Down
5 changes: 3 additions & 2 deletions core/src/zeit/content/gallery/browser/resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: F821
import fanstatic

from zeit.cms.browser.resources import Library, Resource
Expand All @@ -7,7 +8,7 @@
lib = Library('zeit.content.gallery', 'resources')
Resource('gallery.css')

Resource('details.js', depends=[zeit.cms.browser.resources.base, gallery_css]) # noqa
Resource('details.js', depends=[zeit.cms.browser.resources.base, gallery_css])

swfupload = fanstatic.Resource(lib, 'SWFUpload/swfupload.js')
Resource(
Expand All @@ -18,4 +19,4 @@
swfupload,
gallery_css,
],
) # noqa
)
3 changes: 2 additions & 1 deletion core/src/zeit/content/image/browser/resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: F821
from js.backbone import backbone
from js.cropper import cropper
from js.handlebars import handlebars
Expand All @@ -14,7 +15,7 @@
'variant.js',
depends=[
variant_css,
zeit.cms.browser.resources.base, # noqa
zeit.cms.browser.resources.base,
backbone,
cropper,
handlebars,
Expand Down
27 changes: 14 additions & 13 deletions core/src/zeit/edit/browser/resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: F821
from zeit.cms.browser.resources import Library, SplitDirResource
import zeit.cms.browser.resources
import zeit.find.browser.resources
Expand All @@ -17,34 +18,34 @@
zeit.cms.browser.resources.base,
zeit.cms.browser.resources.tab_js,
zeit.find.browser.resources.find_js,
json_js, # noqa
editor_css, # noqa
json_js,
editor_css,
],
)

SplitDirResource('context.js', depends=[zeit.cms.browser.resources.base, edit_js]) # noqa
SplitDirResource('context.js', depends=[zeit.cms.browser.resources.base, edit_js])

SplitDirResource(
'drop.js',
depends=[zeit.cms.browser.resources.base, zeit.cms.browser.resources.dnd_js, context_js],
) # noqa
)
SplitDirResource(
'sortable.js',
depends=[
zeit.cms.browser.resources.base,
context_js, # noqa
context_js,
drop_js,
],
) # noqa
)

SplitDirResource(
'inlineform.js',
depends=[
zeit.cms.browser.resources.base,
zeit.cms.browser.resources.view_js,
zeit.cms.browser.resources.form_js,
edit_js, # noqa
editor_css, # noqa
edit_js,
editor_css,
],
)

Expand All @@ -54,9 +55,9 @@
zeit.cms.browser.resources.base,
zeit.cms.browser.resources.lightbox_js,
zeit.cms.browser.resources.tab_js,
context_js, # noqa
edit_js, # noqa
editor_css, # noqa
context_js,
edit_js,
editor_css,
],
)

Expand All @@ -66,7 +67,7 @@
zeit.cms.browser.resources.base,
zeit.cms.browser.resources.view_js,
zeit.cms.browser.resources.tab_js,
drop_js, # noqa
editor_css, # noqa
drop_js,
editor_css,
],
)
56 changes: 18 additions & 38 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,26 @@ exclude = [

[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# # pyupgrade
# "UP",
# # flake8-bugbear
# "B",
# # flake8-simplify
# "SIM",
# isort
"I",
"E", # pycodestyle
"F", # Pyflakes
# "UP", # pyupgrade
# "B", # flake8-bugbear
# "SIM", # flake8-simplify
"I", # isort
]
ignore = [
# builtin-variable-shadowing
"A001",
# builtin-argument-shadowing
"A002",
# builtin-attribute-shadowing
"A003",
# one-blank-line-after-class
"D204",
# triple-single-quotes
"D300",
# indentation-with-invalid-multiple
"E111",
# indentation-with-invalid-multiple-comment
"E114",
# over-indented
"E117",
# lambda-assignment
"E731",
# undefined-name
"F821",
# flake8-logging-format
"G",
# bad-quotes-inline-string
"Q000",
# bad-quotes-multiline-string
"Q001",
"A001", # builtin-variable-shadowing
"A002", # builtin-argument-shadowing
"A003", # builtin-attribute-shadowing
"D204", # one-blank-line-after-class
"D300", # triple-single-quotes
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"E731", # lambda-assignment
"G", # flake8-logging-format
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
]

# Allow fix for all enabled rules (when `--fix`) is provided.
Expand Down

0 comments on commit 4e5ab0b

Please sign in to comment.