From b571720b086663a98583e85ce326dbb12a35a509 Mon Sep 17 00:00:00 2001
From: thomahl <thomahl@stud.ntnu.no>
Date: Mon, 16 Mar 2020 12:03:40 +0100
Subject: [PATCH] #54 lint fix

---
 soitool/soi.py   | 15 ++++++++++++---
 test/test_soi.py |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/soitool/soi.py b/soitool/soi.py
index 5f55858..c283844 100644
--- a/soitool/soi.py
+++ b/soitool/soi.py
@@ -194,7 +194,9 @@ class SOI:
     # simple as possible. The proper thing would probably be to put the
     # properties in separate data classes (auto-placement stuff in one class,
     # styling in another, etc).
-    # pylint: disable=r0913
+    # Ignoring pylint's r0914 "Too many local variables" for the same reason as
+    # r0913
+    # pylint: disable=r0913,r0914
     def __init__(
         self,
         title="Default SOI title",
@@ -210,8 +212,8 @@ class SOI:
         algorithm_bin="BFF",
         algorithm_pack="MaxRectsBl",
         algorithm_sort="area",
-        modules=[],
-        attachments=[],
+        modules=None,
+        attachments=None,
     ):
 
         # populate date-related arguments if they are not supplied by the user
@@ -225,6 +227,13 @@ class SOI:
         if valid_to is None:
             valid_to = date
 
+        # reason to not just set to [] as default argument:
+        # https://stackoverflow.com/questions/9526465/best-practice-for-setting-the-default-value-of-a-parameter-thats-supposed-to-be
+        if modules is None:
+            modules = []
+        if attachments is None:
+            attachments = []
+
         self.title = title
         self.description = description
         self.version = version
diff --git a/test/test_soi.py b/test/test_soi.py
index c065e59..732cd61 100644
--- a/test/test_soi.py
+++ b/test/test_soi.py
@@ -69,7 +69,7 @@ class TestModule(ModuleBase, QWidget, metaclass=Meta):
 # 'wide_module' have the same area, but 'tall_module' should come first
 # because sorting should be stable
 # https://en.wikipedia.org/wiki/Category:Stable_sorts
-# FIXME the only meta information necessary here is "name", if we assume
+# NOTE the only meta information necessary here is "name", if we assume
 #      automatic sorting..
 TEST_MODULES = [
     {
-- 
GitLab