A Flake8 plugin to ensure an expression can be written in one line without exceeding the maximum length limit
Project description
A Flake8 plugin to ensure an expression can be written in one line without exceeding the maximum length (160 characters by default) limit.
Reported errors
Code |
Rule |
---|---|
FOL001 |
import statement can be written in one line |
FOL002 |
function call can be written in one line |
FOL003 |
assignment can be written in one line |
FOL004 |
return statement can be written in one line |
FOL005 |
function definition can be written in one line |
Used options
max_line_length - option from Flake8, length limit for line
skip-std-names - ignore tuple(), list(), set(), dict() calls (used by default)
skip-multiline-arguments - ignore function calls with arguments on multiple lines (used by default)
Examples
Imports:
# wrong:
import sys, \
argparse
from random import randint as rand_int, \
sample, choice as \
random_choice
# right:
import sys, argparse
from random import randint as rand_int, sample, choice as random_choice
Calls and assignments
# wrong:
f(1, 2, 3,
4, 5, 6, 7,
8, 9)
# right:
f(1, 2, 3, 4, 5, 6, 7, 8, 9)
# wrong:
some_var = foo(1,
a=3,
b=42)
# right:
some_var = foo(1, a=3, b=42)
# wrong:
def f(a: int, b: int) -> int:
return f1(a,
b,
a + b)
# right:
def f(a: int, b: int) -> int:
return f1(a, b, a + b)
Function definitions
# wrong
def f(a,
b,
c):
return a + b * c
# right:
def f(a, b, c):
return a + b * c
# wrong
def f2(
a: str,
b: tuple, *some_args,
**kwargs_name
) -> str:
pass
# right:
def f2(a: str, b: tuple, *some_args, **kwargs_name) -> str:
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for flake8-fill-one-line-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e49e937c9c9ed5b040bcb73060ca49232799d3ac8abdbcbc3ddea9c451b73cb8 |
|
MD5 | 153179f80f8db2e7c8d69417781123b3 |
|
BLAKE2b-256 | 99f9f038ac5131727ed19bf573f22dd54500f51998c9abc55744522d49d2198e |