move and update flake8 config
This commit is contained in:
parent
8bfc0581e7
commit
99b34f7148
6 changed files with 33 additions and 35 deletions
25
.flake8
Normal file
25
.flake8
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
[flake8]
|
||||||
|
extend-select =
|
||||||
|
# bugbear
|
||||||
|
B
|
||||||
|
# bugbear opinions
|
||||||
|
B9
|
||||||
|
# implicit str concat
|
||||||
|
ISC
|
||||||
|
extend-ignore =
|
||||||
|
# slice notation whitespace, invalid
|
||||||
|
E203
|
||||||
|
# line length, handled by bugbear B950
|
||||||
|
E501
|
||||||
|
# bare except, handled by bugbear B001
|
||||||
|
E722
|
||||||
|
# zip with strict=, requires python >= 3.10
|
||||||
|
B905
|
||||||
|
# string formatting opinion, B028 renamed to B907
|
||||||
|
B028
|
||||||
|
B907
|
||||||
|
# up to 88 allowed by bugbear B950
|
||||||
|
max-line-length = 80
|
||||||
|
per-file-ignores =
|
||||||
|
# __init__ exports names
|
||||||
|
src/flask/__init__.py: F401
|
||||||
|
|
@ -2,4 +2,4 @@ from flask import Flask
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
from js_example import views # noqa: F401
|
from js_example import views # noqa: E402, F401
|
||||||
|
|
|
||||||
27
setup.cfg
27
setup.cfg
|
|
@ -61,33 +61,6 @@ source =
|
||||||
src
|
src
|
||||||
*/site-packages
|
*/site-packages
|
||||||
|
|
||||||
[flake8]
|
|
||||||
# B = bugbear
|
|
||||||
# E = pycodestyle errors
|
|
||||||
# F = flake8 pyflakes
|
|
||||||
# W = pycodestyle warnings
|
|
||||||
# B9 = bugbear opinions
|
|
||||||
# ISC = implicit str concat
|
|
||||||
select = B, E, F, W, B9, ISC
|
|
||||||
ignore =
|
|
||||||
# slice notation whitespace, invalid
|
|
||||||
E203
|
|
||||||
# import at top, too many circular import fixes
|
|
||||||
E402
|
|
||||||
# line length, handled by bugbear B950
|
|
||||||
E501
|
|
||||||
# bare except, handled by bugbear B001
|
|
||||||
E722
|
|
||||||
# bin op line break, invalid
|
|
||||||
W503
|
|
||||||
# requires Python 3.10
|
|
||||||
B905
|
|
||||||
# up to 88 allowed by bugbear B950
|
|
||||||
max-line-length = 80
|
|
||||||
per-file-ignores =
|
|
||||||
# __init__ exports names
|
|
||||||
src/flask/__init__.py: F401
|
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
files = src/flask, tests/typing
|
files = src/flask, tests/typing
|
||||||
python_version = 3.7
|
python_version = 3.7
|
||||||
|
|
|
||||||
|
|
@ -120,14 +120,14 @@ def test_app_tearing_down_with_unhandled_exception(app, client):
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
raise Exception("dummy")
|
raise ValueError("dummy")
|
||||||
|
|
||||||
with pytest.raises(Exception, match="dummy"):
|
with pytest.raises(ValueError, match="dummy"):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
client.get("/")
|
client.get("/")
|
||||||
|
|
||||||
assert len(cleanup_stuff) == 1
|
assert len(cleanup_stuff) == 1
|
||||||
assert isinstance(cleanup_stuff[0], Exception)
|
assert isinstance(cleanup_stuff[0], ValueError)
|
||||||
assert str(cleanup_stuff[0]) == "dummy"
|
assert str(cleanup_stuff[0]) == "dummy"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from flask import Flask
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config["DEBUG"] = True
|
app.config["DEBUG"] = True
|
||||||
from blueprintapp.apps.admin import admin
|
from blueprintapp.apps.admin import admin # noqa: E402
|
||||||
from blueprintapp.apps.frontend import frontend
|
from blueprintapp.apps.frontend import frontend # noqa: E402
|
||||||
|
|
||||||
app.register_blueprint(admin)
|
app.register_blueprint(admin)
|
||||||
app.register_blueprint(frontend)
|
app.register_blueprint(frontend)
|
||||||
|
|
|
||||||
|
|
@ -1472,11 +1472,11 @@ def test_static_route_with_host_matching():
|
||||||
rv = flask.url_for("static", filename="index.html", _external=True)
|
rv = flask.url_for("static", filename="index.html", _external=True)
|
||||||
assert rv == "http://example.com/static/index.html"
|
assert rv == "http://example.com/static/index.html"
|
||||||
# Providing static_host without host_matching=True should error.
|
# Providing static_host without host_matching=True should error.
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(AssertionError):
|
||||||
flask.Flask(__name__, static_host="example.com")
|
flask.Flask(__name__, static_host="example.com")
|
||||||
# Providing host_matching=True with static_folder
|
# Providing host_matching=True with static_folder
|
||||||
# but without static_host should error.
|
# but without static_host should error.
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(AssertionError):
|
||||||
flask.Flask(__name__, host_matching=True)
|
flask.Flask(__name__, host_matching=True)
|
||||||
# Providing host_matching=True without static_host
|
# Providing host_matching=True without static_host
|
||||||
# but with static_folder=None should not error.
|
# but with static_folder=None should not error.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue