Add PyLint as a development dependency

Use `pylint calsocial` to run the static analysis.
This commit is contained in:
2018-07-03 08:33:49 +02:00
parent 5283599da2
commit 531faa1ce7
7 changed files with 464 additions and 9 deletions

View File

@@ -32,8 +32,6 @@ def get_locale():
Selects the best locale based on values sent by the browser.
"""
from flask import request
supported_languages = ['en', 'hu']
if 'l' in request.args and request.args['l'].lower() in supported_languages:
@@ -62,7 +60,7 @@ def route(*args, **kwargs):
``**kwargs`` will be passed verbatim to `Flask.route()`.
"""
def decorator(func):
def decorator(func): # pylint: disable=missing-docstring
setattr(func, 'routing', (args, kwargs))
return func
@@ -176,7 +174,8 @@ class CalendarSocialApp(Flask):
form = RegistrationForm()
if form.validate_on_submit():
# TODO: This might become False later, if we want registrations to be confirmed via E-mail
# TODO: This might become False later, if we want registrations to be confirmed via
# e-mail
user = User(active=True)
form.populate_obj(user)

View File

@@ -30,10 +30,10 @@ def to_timestamp(func):
"""
@wraps(func)
def decorator(*args, **kwargs):
def _decorator(*args, **kwargs):
return func(*args, **kwargs).timestamp()
return decorator
return _decorator
class GregorianCalendar(CalendarSystem):

View File

@@ -55,6 +55,8 @@ class TimezoneField(SelectField):
"""
def __init__(self, *args, **kwargs):
self.data = None
kwargs.update({
'choices': [
(pytz.timezone(tz), tz.replace('_', ' '))

View File

@@ -74,6 +74,7 @@ class User(db.Model, UserMixin):
"""
__tablename__ = 'users'
# pylint: disable=invalid-name
id = db.Column(db.Integer(), primary_key=True)
#: The username of the user. This is also the display name and thus is immutable
@@ -132,11 +133,12 @@ class User(db.Model, UserMixin):
return f'<User {self.id}({self.username})>'
class Role(db.Model, RoleMixin):
class Role(db.Model, RoleMixin): # pylint: disable=too-few-public-methods
"""Database model for roles
"""
__tablename__ = 'roles'
# pylint: disable=invalid-name
id = db.Column(db.Integer(), primary_key=True)
#: The name of the role
@@ -175,6 +177,7 @@ class Event(db.Model):
"""
__tablename__ = 'events'
# pylint: disable=invalid-name
id = db.Column(db.Integer(), primary_key=True)
#: The ID of the user who created the event