razorpay / razorpay-python

Razorpay Python SDK
https://pypi.python.org/pypi/razorpay
MIT License
153 stars 81 forks source link

Consider adding black and flake8 checks #234

Open decached opened 1 year ago

decached commented 1 year ago

black and flake8 are an amazing combo to keep code clean and consistent with PEP. Given that this package has many violations according to black and flake8 (see logs below), you can consider adding checks to your CI.

$ black --check .
would reformat razorpay/constants/__init__.py
would reformat razorpay/__init__.py
would reformat razorpay/resources/__init__.py
would reformat razorpay/constants/url.py
would reformat razorpay/resources/addon.py
would reformat razorpay/resources/card.py
would reformat razorpay/resources/fund_account.py
would reformat razorpay/resources/customer.py
would reformat razorpay/resources/registration_link.py
would reformat razorpay/resources/base.py
would reformat razorpay/resources/plan.py
would reformat razorpay/resources/item.py
would reformat razorpay/resources/qrcode.py
would reformat razorpay/utility/__init__.py
would reformat razorpay/resources/refund.py
would reformat razorpay/resources/payment_link.py
would reformat razorpay/resources/invoice.py
would reformat razorpay/resources/token.py
would reformat razorpay/resources/order.py
would reformat test.py
would reformat razorpay/resources/settlement.py
would reformat setup.py
would reformat tests/test_client_card.py
would reformat tests/helpers.py
would reformat razorpay/resources/transfer.py
would reformat razorpay/resources/virtual_account.py
would reformat razorpay/resources/subscription.py
would reformat tests/test_client_addon.py
would reformat tests/test_client_fund_account.py
would reformat tests/test_client_customer.py
would reformat razorpay/client.py
would reformat razorpay/utility/utility.py
would reformat tests/test_client_item.py
would reformat tests/test_client_plan.py
would reformat tests/test_client_error.py
would reformat tests/test_client_registration_link.py
would reformat razorpay/resources/payment.py
would reformat tests/test_client_order.py
would reformat tests/test_client_refund.py
would reformat tests/test_client_qrcode.py
would reformat tests/test_client_payment_link.py
would reformat tests/test_client_token.py
would reformat tests/test_client_invoice.py
would reformat tests/test_user_agent.py
would reformat tests/test_multiple_client.py
would reformat tests/test_client_utility.py
would reformat tests/test_client_settlement.py
would reformat tests/test_client_transfer.py
would reformat tests/test_client_virtual_account.py
would reformat tests/test_client_subscription.py
would reformat tests/test_client_payment.py

Oh no! 💥 💔 💥
51 files would be reformatted, 4 files would be left unchanged.

Flake8 checks are run using the default configuration. I myself consider some errors as not so great (E501 for example. Who sticks to 80 characters per line in today's 4K world?!). You can consider ignoring some, while tightening some other warnings.

$ flake8 
./test.py:2:1: F401 'requests' imported but unused
./test.py:3:1: F401 'pprint.pprint' imported but unused
./test.py:6:80: E501 line too long (86 > 79 characters)
./test.py:8:22: E231 missing whitespace after ':'
./test.py:10:1: E265 block comment should start with '# '
./test.py:13:13: E231 missing whitespace after ':'
./test.py:13:36: W291 trailing whitespace
./test.py:18:5: E116 unexpected indentation (comment)
./test.py:19:5: E116 unexpected indentation (comment)
./test.py:20:5: E116 unexpected indentation (comment)
./test.py:22:5: E116 unexpected indentation (comment)
./test.py:23:5: E116 unexpected indentation (comment)
./test.py:24:5: E116 unexpected indentation (comment)
./test.py:25:5: E116 unexpected indentation (comment)
./test.py:27:5: E116 unexpected indentation (comment)
./test.py:29:41: W292 no newline at end of file
./test.py:29:41: W292 no newline at end of file
./test.py:29:41: W292 no newline at end of file
./setup.py:17:80: E501 line too long (85 > 79 characters)
./setup.py:26:80: E501 line too long (82 > 79 characters)
./tests/test_client_order.py:79:1: W293 blank line contains whitespace
./tests/test_client_order.py:82:80: E501 line too long (80 > 79 characters)
./tests/test_client_utility.py:14:80: E501 line too long (80 > 79 characters)
./tests/test_client_utility.py:26:80: E501 line too long (80 > 79 characters)
./tests/test_client_utility.py:34:80: E501 line too long (83 > 79 characters)
./tests/test_client_utility.py:39:80: E501 line too long (80 > 79 characters)
./tests/test_client_utility.py:47:8: E114 indentation is not a multiple of 4 (comment)
./tests/test_client_utility.py:68:80: E501 line too long (80 > 79 characters)
./tests/test_client_item.py:45:1: W293 blank line contains whitespace
./tests/test_client_item.py:45:5: W292 no newline at end of file
./tests/test_client_addon.py:33:1: W293 blank line contains whitespace
./tests/test_client_addon.py:34:5: E303 too many blank lines (2)
./tests/test_client_addon.py:40:58: W291 trailing whitespace
./tests/test_client_error.py:41:80: E501 line too long (94 > 79 characters)
./tests/test_client_error.py:60:80: E501 line too long (107 > 79 characters)
./tests/test_client_refund.py:42:20: E122 continuation line missing indentation or outdented
./tests/test_client_refund.py:42:33: E231 missing whitespace after ':'
./tests/test_client_refund.py:43:20: E122 continuation line missing indentation or outdented
./tests/test_client_refund.py:43:33: E231 missing whitespace after ':'
./tests/test_client_refund.py:47:43: E231 missing whitespace after ','
./tests/test_client_refund.py:48:80: E501 line too long (80 > 79 characters)
./tests/test_client_refund.py:50:80: E501 line too long (87 > 79 characters)
./tests/test_client_payment_link.py:12:1: W293 blank line contains whitespace
./tests/test_client_payment_link.py:19:80: E501 line too long (80 > 79 characters)
./tests/test_client_payment_link.py:21:80: E501 line too long (93 > 79 characters)
./tests/test_client_payment_link.py:24:5: E303 too many blank lines (2)
./tests/test_client_payment_link.py:29:30: E231 missing whitespace after ':'
./tests/test_client_payment_link.py:30:20: E231 missing whitespace after ':'
./tests/test_client_payment_link.py:31:13: E122 continuation line missing indentation or outdented
./tests/test_client_payment_link.py:37:80: E501 line too long (80 > 79 characters)
./tests/test_client_payment_link.py:39:80: E501 line too long (93 > 79 characters)
./tests/test_client_payment_link.py:40:1: W293 blank line contains whitespace
./tests/test_client_payment_link.py:45:80: E501 line too long (89 > 79 characters)
./tests/test_client_payment_link.py:49:80: E501 line too long (106 > 79 characters)
./tests/test_client_payment_link.py:49:82: E231 missing whitespace after ','
./tests/test_client_payment_link.py:65:80: E501 line too long (87 > 79 characters)
./tests/test_client_payment_link.py:65:80: E231 missing whitespace after ','
./tests/test_client_payment_link.py:65:88: W291 trailing whitespace
./tests/test_client_payment_link.py:75:80: E501 line too long (89 > 79 characters)
./tests/test_client_payment_link.py:75:90: W291 trailing whitespace
./tests/test_client_registration_link.py:11:80: E501 line too long (93 > 79 characters)
./tests/test_client_payment.py:80:80: E501 line too long (80 > 79 characters)
./tests/test_client_payment.py:109:1: W293 blank line contains whitespace
./tests/test_client_payment.py:119:69: E231 missing whitespace after ','
./tests/test_client_payment.py:119:80: E501 line too long (83 > 79 characters)
./tests/test_client_payment.py:119:84: W291 trailing whitespace
./tests/test_client_payment.py:127:80: E501 line too long (92 > 79 characters)
./tests/test_client_payment.py:127:93: W291 trailing whitespace
./tests/test_client_payment.py:132:80: E501 line too long (91 > 79 characters)
./tests/test_client_payment.py:134:21: E128 continuation line under-indented for visual indent
./tests/test_client_payment.py:135:80: E501 line too long (106 > 79 characters)
./tests/test_client_payment.py:135:107: W291 trailing whitespace
./tests/test_client_payment.py:148:80: E501 line too long (80 > 79 characters)
./tests/test_client_payment.py:150:78: W291 trailing whitespace
./tests/test_client_payment.py:153:5: E303 too many blank lines (2)
./tests/test_client_payment.py:159:80: E501 line too long (82 > 79 characters)
./tests/test_client_payment.py:167:70: W291 trailing whitespace
./tests/test_client_payment.py:175:80: E501 line too long (83 > 79 characters)
./tests/test_client_payment.py:175:84: W291 trailing whitespace
./tests/test_client_payment.py:176:1: W293 blank line contains whitespace
./tests/test_client_payment.py:199:1: W293 blank line contains whitespace
./tests/test_client_payment.py:204:53: E231 missing whitespace after ','
./tests/test_client_payment.py:216:56: E231 missing whitespace after ','
./tests/test_client_payment.py:232:54: E231 missing whitespace after ','
./tests/test_client_payment.py:239:66: E231 missing whitespace after ','
./tests/test_client_payment.py:239:80: E501 line too long (81 > 79 characters)
./tests/test_client_payment.py:239:82: W291 trailing whitespace
./tests/test_client_payment.py:240:1: W293 blank line contains whitespace
./tests/test_client_payment.py:244:54: E231 missing whitespace after ','
./tests/test_client_payment.py:251:76: W292 no newline at end of file
./tests/test_client_subscription.py:56:80: E501 line too long (90 > 79 characters)
./tests/test_client_subscription.py:60:80: E501 line too long (84 > 79 characters)
./tests/test_client_subscription.py:62:61: W291 trailing whitespace
./tests/test_client_subscription.py:86:28: E231 missing whitespace after ':'
./tests/test_client_subscription.py:87:38: E231 missing whitespace after ':'
./tests/test_client_subscription.py:92:80: E501 line too long (80 > 79 characters)
./tests/test_client_subscription.py:94:80: E501 line too long (89 > 79 characters)
./tests/test_client_subscription.py:94:90: W291 trailing whitespace
./tests/test_client_subscription.py:99:80: E501 line too long (94 > 79 characters)
./tests/test_client_subscription.py:116:55: W291 trailing whitespace
./tests/test_client_subscription.py:133:68: E231 missing whitespace after ','
./tests/test_client_subscription.py:133:80: E501 line too long (91 > 79 characters)
./tests/test_client_subscription.py:134:80: E501 line too long (81 > 79 characters)
./tests/test_client_subscription.py:137:71: E231 missing whitespace after ','
./tests/test_client_subscription.py:137:80: E501 line too long (95 > 79 characters)
./tests/test_client_subscription.py:139:61: W291 trailing whitespace
./tests/test_client_subscription.py:139:76: W292 no newline at end of file
./tests/test_client_virtual_account.py:2:1: F401 'json' imported but unused
./tests/test_client_virtual_account.py:107:1: W293 blank line contains whitespace
./tests/test_client_virtual_account.py:110:15: E222 multiple spaces after operator
./tests/test_client_virtual_account.py:117:80: E501 line too long (83 > 79 characters)
./tests/test_client_virtual_account.py:131:15: E222 multiple spaces after operator
./tests/test_client_virtual_account.py:139:80: E501 line too long (88 > 79 characters)
./tests/test_client_virtual_account.py:147:48: W291 trailing whitespace
./tests/test_client_virtual_account.py:151:1: W293 blank line contains whitespace
./tests/test_client_virtual_account.py:152:5: E303 too many blank lines (2)
./tests/test_client_virtual_account.py:155:80: E501 line too long (117 > 79 characters)
./tests/test_client_virtual_account.py:162:9: E122 continuation line missing indentation or outdented
./tests/test_client_virtual_account.py:162:64: E703 statement ends with a semicolon
./tests/test_client_virtual_account.py:162:65: W291 trailing whitespace
./tests/test_client_virtual_account.py:164:1: W293 blank line contains whitespace
./tests/test_client_virtual_account.py:165:1: W293 blank line contains whitespace
./tests/test_client_virtual_account.py:165:4: W292 no newline at end of file
./tests/test_client_transfer.py:50:80: E501 line too long (80 > 79 characters)
./tests/test_client_transfer.py:66:80: E501 line too long (80 > 79 characters)
./tests/test_client_invoice.py:51:80: E501 line too long (83 > 79 characters)
./tests/test_client_invoice.py:54:80: E501 line too long (97 > 79 characters)
./tests/test_client_invoice.py:68:80: E501 line too long (81 > 79 characters)
./tests/test_client_invoice.py:85:80: E501 line too long (80 > 79 characters)
./tests/test_client_invoice.py:87:80: E501 line too long (83 > 79 characters)
./tests/test_client_fund_account.py:25:27: E231 missing whitespace after ':'
./tests/test_client_fund_account.py:26:27: E231 missing whitespace after ':'
./tests/test_client_fund_account.py:27:23: E231 missing whitespace after ':'
./tests/test_client_fund_account.py:28:33: E231 missing whitespace after ':'
./tests/test_client_fund_account.py:29:23: E231 missing whitespace after ':'
./tests/test_client_fund_account.py:41:1: W293 blank line contains whitespace
./tests/test_client_fund_account.py:41:2: W292 no newline at end of file
./tests/test_client_settlement.py:36:80: E501 line too long (82 > 79 characters)
./tests/test_client_settlement.py:44:66: W291 trailing whitespace
./tests/test_client_settlement.py:57:43: E231 missing whitespace after ','
./tests/test_client_settlement.py:60:80: E501 line too long (89 > 79 characters)
./tests/test_client_settlement.py:60:90: W291 trailing whitespace
./tests/test_client_settlement.py:65:43: E231 missing whitespace after ','
./tests/test_client_settlement.py:68:80: E501 line too long (88 > 79 characters)
./tests/test_client_settlement.py:68:89: W291 trailing whitespace
./tests/test_client_settlement.py:76:80: E501 line too long (107 > 79 characters)
./tests/test_client_settlement.py:76:108: W292 no newline at end of file
./tests/test_client_qrcode.py:57:80: E501 line too long (89 > 79 characters)
./tests/test_client_qrcode.py:65:77: W292 no newline at end of file
./tests/test_client_customer.py:50:80: E501 line too long (84 > 79 characters)
./tests/test_client_customer.py:51:1: W293 blank line contains whitespace
./tests/test_client_customer.py:58:61: W292 no newline at end of file
./razorpay/client.py:69:16: E275 missing whitespace after keyword
./razorpay/client.py:86:13: E261 at least two spaces before inline comment
./razorpay/client.py:125:37: E275 missing whitespace after keyword
./razorpay/client.py:125:58: E225 missing whitespace around operator
./razorpay/client.py:125:80: E501 line too long (84 > 79 characters)
./razorpay/client.py:140:61: E261 at least two spaces before inline comment
./razorpay/client.py:140:80: E501 line too long (133 > 79 characters)
./razorpay/resources/addon.py:39:54: W291 trailing whitespace
./razorpay/resources/subscription.py:67:80: E501 line too long (85 > 79 characters)
./razorpay/resources/subscription.py:68:50: W291 trailing whitespace
./razorpay/resources/subscription.py:81:50: W291 trailing whitespace
./razorpay/resources/subscription.py:88:73: W291 trailing whitespace
./razorpay/resources/subscription.py:92:61: W291 trailing whitespace
./razorpay/resources/subscription.py:93:51: W291 trailing whitespace
./razorpay/resources/subscription.py:105:80: E501 line too long (87 > 79 characters)
./razorpay/resources/subscription.py:105:88: W291 trailing whitespace
./razorpay/resources/subscription.py:106:47: W291 trailing whitespace
./razorpay/resources/subscription.py:139:80: E501 line too long (84 > 79 characters)
./razorpay/resources/subscription.py:146:52: W291 trailing whitespace
./razorpay/resources/fund_account.py:26:80: E501 line too long (81 > 79 characters)
./razorpay/resources/fund_account.py:33:50: W292 no newline at end of file
./razorpay/resources/registration_link.py:14:80: E501 line too long (90 > 79 characters)
./razorpay/resources/registration_link.py:21:1: W293 blank line contains whitespace
./razorpay/resources/registration_link.py:26:50: W292 no newline at end of file
./razorpay/resources/settlement.py:39:49: W291 trailing whitespace
./razorpay/resources/settlement.py:48:43: E231 missing whitespace after ','
./razorpay/resources/settlement.py:58:43: E231 missing whitespace after ','
./razorpay/resources/settlement.py:63:40: W291 trailing whitespace
./razorpay/resources/order.py:37:80: E501 line too long (82 > 79 characters)
./razorpay/resources/order.py:65:80: E501 line too long (80 > 79 characters)
./razorpay/resources/order.py:72:1: W293 blank line contains whitespace
./razorpay/resources/order.py:80:1: W293 blank line contains whitespace
./razorpay/resources/order.py:87:51: W292 no newline at end of file
./razorpay/resources/__init__.py:14:1: F401 '.qrcode.Qrcode' imported but unused
./razorpay/resources/qrcode.py:31:1: W293 blank line contains whitespace
./razorpay/resources/qrcode.py:49:49: W291 trailing whitespace
./razorpay/resources/customer.py:42:1: W293 blank line contains whitespace
./razorpay/resources/customer.py:50:57: W292 no newline at end of file
./razorpay/resources/virtual_account.py:3:1: F401 'json' imported but unused
./razorpay/resources/virtual_account.py:94:50: W291 trailing whitespace
./razorpay/resources/virtual_account.py:96:80: E501 line too long (94 > 79 characters)
./razorpay/resources/virtual_account.py:104:16: W291 trailing whitespace
./razorpay/resources/virtual_account.py:106:80: E501 line too long (100 > 79 characters)
./razorpay/resources/virtual_account.py:107:52: W292 no newline at end of file
./razorpay/resources/payment.py:37:62: E261 at least two spaces before inline comment
./razorpay/resources/payment.py:37:80: E501 line too long (157 > 79 characters)
./razorpay/resources/payment.py:52:80: E501 line too long (176 > 79 characters)
./razorpay/resources/payment.py:119:1: W293 blank line contains whitespace
./razorpay/resources/payment.py:120:5: F811 redefinition of unused 'refund' from line 52
./razorpay/resources/payment.py:138:49: W291 trailing whitespace
./razorpay/resources/payment.py:148:47: W291 trailing whitespace
./razorpay/resources/payment.py:149:1: W293 blank line contains whitespace
./razorpay/resources/payment.py:156:1: W293 blank line contains whitespace
./razorpay/resources/payment.py:162:51: W291 trailing whitespace
./razorpay/resources/payment.py:163:1: W293 blank line contains whitespace
./razorpay/resources/payment.py:187:43: E231 missing whitespace after ','
./razorpay/resources/payment.py:188:47: W291 trailing whitespace
./razorpay/resources/payment.py:189:1: W293 blank line contains whitespace
./razorpay/resources/payment.py:202:1: W293 blank line contains whitespace
./razorpay/resources/payment.py:203:31: E203 whitespace before ','
./razorpay/resources/payment.py:203:32: E231 missing whitespace after ','
./razorpay/resources/payment.py:216:50: W291 trailing whitespace
./razorpay/resources/payment.py:224:53: E231 missing whitespace after ','
./razorpay/resources/payment.py:233:50: E231 missing whitespace after ','
./razorpay/resources/payment.py:242:52: E231 missing whitespace after ','
./razorpay/resources/payment.py:243:50: W291 trailing whitespace
./razorpay/resources/payment.py:253:1: W293 blank line contains whitespace
./razorpay/resources/refund.py:52:51: W291 trailing whitespace
./razorpay/resources/item.py:9:1: W293 blank line contains whitespace
./razorpay/resources/item.py:31:1: W293 blank line contains whitespace
./razorpay/resources/item.py:50:51: W291 trailing whitespace
./razorpay/resources/item.py:51:1: W293 blank line contains whitespace
./razorpay/resources/item.py:63:50: W292 no newline at end of file
./razorpay/resources/invoice.py:41:80: E501 line too long (80 > 79 characters)
./razorpay/resources/invoice.py:71:80: E501 line too long (146 > 79 characters)
./razorpay/resources/invoice.py:96:80: E501 line too long (118 > 79 characters)
./razorpay/resources/invoice.py:108:80: E501 line too long (80 > 79 characters)
./razorpay/resources/invoice.py:110:80: E501 line too long (118 > 79 characters)
./razorpay/resources/payment_link.py:29:80: E501 line too long (82 > 79 characters)
./razorpay/resources/payment_link.py:41:80: E501 line too long (85 > 79 characters)
./razorpay/resources/payment_link.py:57:80: E501 line too long (151 > 79 characters)
./razorpay/resources/payment_link.py:61:1: W293 blank line contains whitespace
./razorpay/resources/payment_link.py:67:80: E501 line too long (82 > 79 characters)
./razorpay/resources/payment_link.py:69:80: E501 line too long (92 > 79 characters)
./razorpay/resources/payment_link.py:72:1: W293 blank line contains whitespace
./razorpay/resources/payment_link.py:84:80: E501 line too long (90 > 79 characters)
./razorpay/resources/payment_link.py:85:1: W293 blank line contains whitespace
./razorpay/resources/payment_link.py:88:80: E501 line too long (81 > 79 characters)
./razorpay/resources/payment_link.py:89:48: W291 trailing whitespace
./razorpay/utility/utility.py:17:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:19:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:25:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:26:80: E501 line too long (154 > 79 characters)
./razorpay/utility/utility.py:29:80: E501 line too long (84 > 79 characters)
./razorpay/utility/utility.py:34:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:35:80: E501 line too long (111 > 79 characters)
./razorpay/utility/utility.py:36:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:37:80: E501 line too long (105 > 79 characters)
./razorpay/utility/utility.py:39:70: W291 trailing whitespace
./razorpay/utility/utility.py:40:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:43:77: W291 trailing whitespace
./razorpay/utility/utility.py:52:80: E501 line too long (105 > 79 characters)
./razorpay/utility/utility.py:55:1: W293 blank line contains whitespace
./razorpay/utility/utility.py:87:80: E501 line too long (80 > 79 characters)