]> git.cworth.org Git - turbot/commitdiff
Add a "make flake" recipe and clean up some style bugs flake8 noticed
authorCarl Worth <cworth@cworth.org>
Wed, 30 Dec 2020 20:17:43 +0000 (13:17 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 30 Dec 2020 20:17:43 +0000 (13:17 -0700)
We also ignore some rules about whether or not there's a space on
either side of some operators, since I fundmanetally disagree with
flake8 on some of these.

.flake8
Makefile
turbot/interaction.py
turbot/sheets.py

diff --git a/.flake8 b/.flake8
index f9291543cd5a0ff2b109ad19b7130770b0fc86f1..f31fa665927abbd3a03330abc4ebb009ccf8f1f0 100644 (file)
--- a/.flake8
+++ b/.flake8
@@ -1,2 +1,2 @@
 [flake8]
-ignore = E251, E305, E302, W503, E201, E202
+ignore = E251, E305, E302, W503, E201, E202, E225, E226, E203
index c0984d9916fd3636cd8c76f559add992889251a8..606418e25071788b47ff4459e983045e2c571602 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,10 @@ ifndef VIRTUAL_ENV
        $(error "No virtualenv active. Try '. ./env/bin/activate'")
 endif
 
+.PHONY: flake
+flake:
+       flake8 --exclude=env,.deploy*
+
 .PHONY: bootstrap
 bootstrap:
        @echo "=== Creating python virtual environment ==="
index 5549aa851563493b860a25c1687f7cd18eb6bd49..343eca623461b74da4fbe8d8f0b9a5001b59a58a 100644 (file)
@@ -482,7 +482,8 @@ def solved(turb, body, args):
     set_channel_topic(turb, puzzle)
 
     # And rename the sheet to prefix with "SOLVED: "
-    turbot.sheets.renameSheet(turb, puzzle['sheet_url'], 'SOLVED: ' + puzzle['name'])
+    turbot.sheets.renameSheet(turb, puzzle['sheet_url'],
+                              'SOLVED: ' + puzzle['name'])
 
     # Finally, rename the Slack channel to add the suffix '-solved'
     channel_name = "{}-{}-solved".format(
index 806ba193bd2e60cc32de7577a7100c3f37ef5b7e..bc7c7c68ceb777a2e0cd86b366264ae1e47da3ae 100644 (file)
@@ -61,7 +61,10 @@ def sheets_create_for_puzzle(turb, puzzle):
         insertDataOption='INSERT_ROWS',
         body={
             'range': 'A1:A2',
-            'values': [['=HYPERLINK("'+url_link+'","'+url_text+'")'], ['=HYPERLINK("'+channel_url_link+'","'+channel_url_text+'")']]
+            'values': [
+                ['=HYPERLINK("'+url_link+'","'+url_text+'")'],
+                ['=HYPERLINK("'+channel_url_link+'","'+channel_url_text+'")']
+            ]
         }).execute()
 
     # Copy some sheets from the Template spreadsheet
@@ -100,8 +103,8 @@ def renameSheet(turb, url, newName):
                             ).execute()
 
 def extractIdFromSheetUrl(url):
-    # Google sheet ids are between the /d/ and /edit in the url, like https://docs.google.com/spreadsheets/d/1dxHBzjenjhCAJQ8lM0skJO2mxlup8aWZm0-LaXeVPrg/edit#gid=0
+    # Google sheet ids are between the /d/ and /edit in the url, like
+    # https://docs.google.com/spreadsheets/d/1dxHBzjen...-LaXeVPrg/edit#gid=0
     startIndex = url.find('/d/') + 3
     endIndex = url.find('/edit')
     return url[startIndex : endIndex]
-    
\ No newline at end of file