Skip to content

Commit

Permalink
fix code style checks
Browse files Browse the repository at this point in the history
  • Loading branch information
aspedrosa committed Sep 13, 2021
1 parent 9b8e95c commit 7c66f54
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 10 deletions.
111 changes: 111 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[MESSAGES CONTROL]

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=unnecessary-semicolon,
superfluous-parens,
bad-mcs-classmethod-argument,
too-many-lines,
bad-whitespace,
I0014,
relative-import,
E1103,
C0322,
fixme,
too-many-instance-attributes,
no-init,
C0323,
trailing-whitespace,
property-on-old-class,
too-few-public-methods,
invalid-name,
exec-used,
assignment-from-none,
C0324,
abstract-class-little-used,
pointless-except,
redefined-outer-name,
star-args,
missing-final-newline,
bad-mcs-method-argument,
empty-docstring,
no-name-in-module,
global-variable-undefined,
too-many-return-statements,
W0701,
bad-builtin,
W5103,
deprecated-lambda,
abstract-method,
no-member,
unused-format-string-key,
no-self-use,
wildcard-import,
too-many-public-methods,
broad-except,
bad-classmethod-argument,
bad-continuation,
attribute-defined-outside-init,
W0713,
ungrouped-imports,
anomalous-backslash-in-string,
too-many-ancestors,
wrong-import-order,
multiple-statements,
missing-docstring,
no-self-argument,
global-statement,
super-init-not-called,
raise-missing-from,
protected-access,
invalid-str-returned,
invalid-repr-returned,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=


[FORMAT]

# Maximum number of characters on a single line.
max-line-length=159

# Maximum number of lines in a module.
max-module-lines=1000


[DESIGN]

# Maximum number of attributes for a class (see R0902).
max-attributes=7

# Maximum number of branch for function / method body.
max-branches=15

# Maximum number of locals for function / method body.
max-locals=15

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=20

# Maximum number of return / yield for function / method body.
max-returns=6

# Maximum number of statements in function / method body.
max-statements=60

# Minimum number of public methods for a class (see R0903).
min-public-methods=1
2 changes: 1 addition & 1 deletion dashboard_viewer/dashboard_viewer/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def _set_eager():
class CeleryTestSuiteRunner(DiscoverRunner):
def setup_test_environment(self, **kwargs):
_set_eager()
super(CeleryTestSuiteRunner, self).setup_test_environment(**kwargs)
super().setup_test_environment(**kwargs)
2 changes: 1 addition & 1 deletion dashboard_viewer/dashboard_viewer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.template import loader


def server_error(request):
def server_error(_request):
template = loader.get_template("500.html")
context = {
"constance_config": constance.config,
Expand Down
2 changes: 1 addition & 1 deletion dashboard_viewer/tabsManager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_menu():


class APITabsView(rest_views.APIView):
def get(self, request):
def get(self, _request):
return Response(get_menu())


Expand Down
8 changes: 4 additions & 4 deletions dashboard_viewer/uploader/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def upload_achilles_results(request, *args, **kwargs):
)


def get_upload_task_status(request, data_source, upload_id):
def get_upload_task_status(_request, data_source, upload_id):
data_source = get_object_or_404(DataSource, hash=data_source)

try:
Expand Down Expand Up @@ -128,7 +128,7 @@ def _get_fields_initial_values(request, initial):
def _leave_valid_fields_values_only(request, initial, aux_form):
for field_name, field in SourceForm.base_fields.items():
if isinstance(field, fields.MultiValueField):
decompressed = list()
decompressed = []

for i in range(len(field.widget.widgets)):
generated_field_name = f"{field_name}_{i}"
Expand All @@ -137,7 +137,7 @@ def _leave_valid_fields_values_only(request, initial, aux_form):
del initial[generated_field_name]
decompressed.append(value)
else:
decompressed = list()
decompressed = []
break

if decompressed:
Expand All @@ -156,7 +156,7 @@ def _leave_valid_fields_values_only(request, initial, aux_form):
def create_data_source(request, *_, **kwargs):
data_source = kwargs.get("data_source")
if request.method == "GET":
initial = dict()
initial = {}
if data_source is not None:
initial["hash"] = data_source

Expand Down
6 changes: 3 additions & 3 deletions dashboard_viewer/uploader/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class ListTextWidget(forms.TextInput):
"""

def __init__(self, query_obj, *args, **kwargs):
super(ListTextWidget, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.query_obj = query_obj

def render(self, name, value, attrs=None, renderer=None):
attrs.update({"list": f"{name}_list", "autocomplete": "off"})
text_html = super(ListTextWidget, self).render(name, value, attrs=attrs)
text_html = super().render(name, value, attrs=attrs)
data_list = f'<datalist id="{name}_list">'
for item in self.query_obj.all():
data_list += f'<option value="{item}">'
Expand Down Expand Up @@ -59,7 +59,7 @@ def __init__(self, *args, map_height=500, **kwargs):
super().__init__(widgets, *args, **kwargs)

def render(self, name, value, attrs=None, renderer=None):
text_inputs = super(CoordinatesWidget, self).render(
text_inputs = super().render(
name, value, attrs, renderer
)

Expand Down

0 comments on commit 7c66f54

Please sign in to comment.