bdheath / Big-Cases

The basic code behind the @big_cases Twitter bot
107 stars 20 forks source link

Format all Python files consistently #7

Closed jabagawee closed 6 years ago

jabagawee commented 6 years ago

The files in this repository currently follow no formatting standards, which causes inconsistencies in things like using tabs or spaces for indentation. We use yapf to format every file in the repository with the following command:

yapf -i -r .

This normalizes all of the code in the repository to follow a single standard and also makes it easy for future contributors to ensure that they are following the formatting standards (they simply have to run yapf themselves before committing).

Sorry if this commit causes a lot of churn to the code, but it should be safe given that yapf is very battle-tested and has been used for countless other Python projects.

johnhawkinson commented 6 years ago

Does not pass flake8 for PEP-8.

pb3:big-cases jhawk$ git rev-parse @
67887788e13e0ea992ac33e2e7c13c7459bc5208
pb3:big-cases jhawk$ flake8
./bigcases.py:15:80: E501 line too long (103 > 79 characters)
./bigcases.py:19:80: E501 line too long (89 > 79 characters)
./bigcases.py:44:13: W291 trailing whitespace
./bigcases.py:45:1: E101 indentation contains mixed spaces and tabs
./bigcases.py:45:1: W191 indentation contains tabs
./bigcases.py:46:1: W191 indentation contains tabs
./bigcases.py:47:1: W191 indentation contains tabs
./bigcases.py:48:1: W191 indentation contains tabs
./bigcases.py:49:1: E101 indentation contains mixed spaces and tabs
./bigcases.py:57:1: E101 indentation contains mixed spaces and tabs
./bigcases.py:57:1: W191 indentation contains tabs
./bigcases.py:58:1: W191 indentation contains tabs
./bigcases.py:60:1: E101 indentation contains mixed spaces and tabs
./bigcases.py:83:80: E501 line too long (81 > 79 characters)
./bigcases.py:96:80: E501 line too long (83 > 79 characters)
./bigcases_list.py:7:27: W292 no newline at end of file
./bigcases_scrape_docs.py:14:1: F401 'urlparse.urljoin' imported but unused
./bigcases_scrape_docs.py:32:80: E501 line too long (92 > 79 characters)
./bigcases_scrape_docs.py:41:80: E501 line too long (85 > 79 characters)
./bigcases_scrape_docs.py:85:80: E501 line too long (95 > 79 characters)
./bigcases_scrape_docs.py:114:9: E265 block comment should start with '# '
./bigcases_scrape_docs.py:129:13: F841 local variable 'dcid' is assigned to but never used
./bigcases_scrape_docs.py:131:80: E501 line too long (84 > 79 characters)
./bigcases_scrape_docs.py:147:1: E101 indentation contains mixed spaces and tabs
./bigcases_scrape_docs.py:147:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:148:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:149:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:150:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:151:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:152:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:153:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:154:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:155:1: E101 indentation contains mixed spaces and tabs
./bigcases_scrape_docs.py:162:13: F841 local variable 'recap' is assigned to but never used
./bigcases_scrape_docs.py:168:80: E501 line too long (85 > 79 characters)
./bigcases_scrape_docs.py:174:1: E101 indentation contains mixed spaces and tabs
./bigcases_scrape_docs.py:174:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:175:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:177:1: E101 indentation contains mixed spaces and tabs
./bigcases_scrape_docs.py:187:1: E101 indentation contains mixed spaces and tabs
./bigcases_scrape_docs.py:187:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:188:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:189:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:190:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:191:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:192:1: W191 indentation contains tabs
./bigcases_scrape_docs.py:193:1: E101 indentation contains mixed spaces and tabs
./bigcases_settings.py:7:80: E501 line too long (89 > 79 characters)
./bigcases_settings.py:8:80: E501 line too long (97 > 79 characters)
./dbconnect.py:1:1: E266 too many leading '#' for block comment
./dbconnect.py:34:9: F841 local variable '_is_connected' is assigned to but never used
./dbconnect.py:198:61: W291 trailing whitespace
./dbconnect.py:199:1: E101 indentation contains mixed spaces and tabs
./dbconnect.py:199:1: W191 indentation contains tabs
./dbconnect.py:200:1: W191 indentation contains tabs
./dbconnect.py:200:26: W291 trailing whitespace
./dbconnect.py:201:1: W191 indentation contains tabs
./dbconnect.py:202:1: W191 indentation contains tabs
./dbconnect.py:202:7: E101 indentation contains mixed spaces and tabs
./dbconnect.py:203:1: E101 indentation contains mixed spaces and tabs
./dbconnect.py:212:61: W291 trailing whitespace
./dbconnect.py:213:1: E101 indentation contains mixed spaces and tabs
./dbconnect.py:213:1: W191 indentation contains tabs
./dbconnect.py:214:1: W191 indentation contains tabs
./dbconnect.py:215:1: W191 indentation contains tabs
./dbconnect.py:215:11: W291 trailing whitespace
./dbconnect.py:216:1: W191 indentation contains tabs
./dbconnect.py:217:1: E101 indentation contains mixed spaces and tabs
./pacer-rss.py:6:1: F401 'sys' imported but unused
./pacer-rss.py:58:80: E501 line too long (89 > 79 characters)
./pacer-rss.py:59:80: E501 line too long (91 > 79 characters)
./pacer-rss.py:63:80: E501 line too long (120 > 79 characters)
./pacer-rss.py:64:1: E101 indentation contains mixed spaces and tabs
./pacer-rss.py:64:1: W191 indentation contains tabs
./pacer-rss.py:65:1: E101 indentation contains mixed spaces and tabs
./pacer-rss.py:71:1: E101 indentation contains mixed spaces and tabs
./pacer-rss.py:71:1: W191 indentation contains tabs
./pacer-rss.py:72:1: W191 indentation contains tabs
./pacer-rss.py:73:1: E101 indentation contains mixed spaces and tabs
./pacer_rss_feeds.py:8:80: E501 line too long (88 > 79 characters)
./pacer_rss_feeds.py:14:80: E501 line too long (88 > 79 characters)
./pacer_rss_feeds.py:20:80: E501 line too long (87 > 79 characters)
./pacer_rss_feeds.py:26:80: E501 line too long (88 > 79 characters)
./pacer_rss_feeds.py:32:80: E501 line too long (88 > 79 characters)
pb3:big-cases jhawk$ 
jabagawee commented 6 years ago

Fixed tabs in another commit. Taking a look at the other problems. Seems that the "line too long" errors refers to extremely long string constants, but stay tuned for more.

jabagawee commented 6 years ago

Note: this PR looks best when viewed in split mode.

jabagawee commented 6 years ago

Thanks for all your feedback, @johnhawkinson. I will take a look to see if there's a better way to handle all of the inconsistencies that you pointed out.

mlissner commented 6 years ago

If we're going to play this game, may I suggest that we add an editorconfig file as well?