lint
authorShane Jaroch <nutratracker@protonmail.com>
Sun, 19 Jun 2022 03:03:42 +0000 (23:03 -0400)
committerShane Jaroch <nutratracker@protonmail.com>
Sun, 19 Jun 2022 03:03:42 +0000 (23:03 -0400)
.pylintrc [new file with mode: 0644]
setup.cfg [new file with mode: 0644]
sql/__init__.py

diff --git a/.pylintrc b/.pylintrc
new file mode 100644 (file)
index 0000000..6a8a02a
--- /dev/null
+++ b/.pylintrc
@@ -0,0 +1,11 @@
+[MASTER]
+
+fail-under=10
+
+
+[MESSAGES CONTROL]
+
+disable=
+    fixme,
+    consider-using-f-string,
+
diff --git a/setup.cfg b/setup.cfg
new file mode 100644 (file)
index 0000000..daec0d4
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,33 @@
+[pycodestyle]
+max-line-length = 88
+
+
+[flake8]
+per-file-ignores =
+    # Allow unused imports in __init__.py files
+    __init__.py:F401
+
+max-line-length = 88
+
+ignore =
+    W503,  # line break before binary operator
+
+
+[isort]
+line_length=88
+known_first_party=sql
+
+# See: https://copdips.com/2020/04/making-isort-compatible-with-black.html
+multi_line_output=3
+include_trailing_comma=true
+
+
+[mypy]
+ignore_missing_imports = True
+show_error_codes = True
+disable_error_code = import
+disallow_untyped_calls = True
+disallow_untyped_decorators = True
+strict_optional = False
+warn_redundant_casts = True
+warn_unused_ignores = True
index 0fe25d8a9a6853742c2f4f23f3bae32b40405959..e44d2531d559cd967d3cec82d0602ba63849c43a 100755 (executable)
@@ -9,7 +9,7 @@ NT_DB_NAME = "nt.sqlite"
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
 
 
-def build_ntsqlite(verbose=False):
+def build_ntsqlite(verbose=False) -> bool:
     """Builds and inserts stock data into nt.sqlite"""
     # cd into this script's directory
     os.chdir(SCRIPT_DIR)
@@ -39,8 +39,8 @@ def build_ntsqlite(verbose=False):
 
         # Loop over CSV files
         with open(file_path_full, encoding="utf-8") as csv_file:
-            reader = csv.DictReader(csv_file)
-            values = ",".join("?" * len(reader.fieldnames))
+            dict_reader = csv.DictReader(csv_file)
+            values = ",".join("?" * len(dict_reader.fieldnames))
             reader = csv.reader(csv_file)
             query = "INSERT INTO {0} VALUES ({1});".format(  # nosec: B608
                 table_name, values