Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

Commit 072094a

Browse files
author
MarcoGorelli
committed
put file back
1 parent 9b0dc97 commit 072094a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://github.com/pandas-dev/pandas-dev-flaker/workflows/tox/badge.svg)](https://github.com/pandas-dev/pandas-dev-flaker/actions?workflow=tox)
1+
![Build Status](https://github.com/pandas-dev/pandas-dev-flaker/workflows/tox/badge.svg)](https://github.com/pandas-dev/pandas-dev-flaker/actions?workflow=tox)
22
[![Coverage](https://codecov.io/gh/pandas-dev/pandas-dev-flaker/branch/main/graph/badge.svg)](https://codecov.io/gh/pandas-dev/pandas-dev-flaker)
33

44
pandas-dev-flaker
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import ast
2+
from typing import Iterator, Tuple
3+
4+
from pandas_dev_flaker._data_tree import State, register
5+
6+
MSG = "PDF023 found assignment to single-letter variable"
7+
8+
9+
@register(ast.Assign)
10+
def visit_Assign(
11+
state: State,
12+
node: ast.Assign,
13+
parent: ast.AST,
14+
) -> Iterator[Tuple[int, int, str]]:
15+
16+
# Unpacking is represented by putting a Tuple or List within targets
17+
if isinstance(node.targets[0], (ast.Tuple, ast.List)):
18+
assignment_names = node.targets[0].elts
19+
else:
20+
assignment_names = node.targets
21+
22+
for item in assignment_names:
23+
if isinstance(item, ast.Name) and item.id != "_" and len(item.id) == 1:
24+
yield item.lineno, item.col_offset, MSG

0 commit comments

Comments
 (0)