Skip to content

Commit a73bac9

Browse files
committed
Add python lint
1 parent 6b60f85 commit a73bac9

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.github/workflows/ci.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,11 @@ jobs:
5454
run: cargo fmt --all -- --check
5555
- name: run clippy
5656
run: cargo clippy --all --all-features -- -Dwarnings
57+
58+
- uses: actions/setup-python@v4
59+
with:
60+
python-version: "3.11"
61+
- name: install ruff
62+
run: python -m pip install ruff
63+
- name: run python lint
64+
run: ruff --ignore=E501 ast --show-source

ast/asdl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def visitConstructor(self, cons, name):
176176

177177
def visitField(self, field, name):
178178
key = str(field.type)
179-
l = self.types.setdefault(key, [])
179+
l = self.types.setdefault(key, []) # noqa
180180
l.append(name)
181181

182182
def visitProduct(self, prod, name):
@@ -193,7 +193,7 @@ def check(mod):
193193
v.visit(mod)
194194

195195
for t in v.types:
196-
if t not in mod.types and not t in builtin_types:
196+
if t not in mod.types and t not in builtin_types:
197197
v.errors += 1
198198
uses = ", ".join(v.types[t])
199199
print('Undefined type {}, used in {}'.format(t, uses))

ast/asdl_rs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def gen_classdef(self, name, fields, attrs, depth, base="AstNode"):
447447
self.emit(f"struct {structname};", depth)
448448
self.emit("#[pyclass(flags(HAS_DICT, BASETYPE))]", depth)
449449
self.emit(f"impl {structname} {{", depth)
450-
self.emit(f"#[extend_class]", depth + 1)
450+
self.emit("#[extend_class]", depth + 1)
451451
self.emit(
452452
"fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {",
453453
depth + 1,

0 commit comments

Comments
 (0)