Webperf-se / webperf_core

webperf-core is an open-source testing suite tailored to help you improve your digital presence in areas like web performance, security and accessibility to email best practice using many small improvements.
https://webperf.se/articles/webperf-core/
MIT License
19 stars 31 forks source link

PyLint for Improved Code Quality - tests/tracking_validator.py #329

Open cockroacher opened 7 months ago

cockroacher commented 7 months ago

***** Module tests.tracking_validator tests/tracking_validator.py:227:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens) tests/tracking_validator.py:272:0: C0301: Line too long (103/100) (line-too-long) tests/tracking_validator.py:290:0: C0301: Line too long (118/100) (line-too-long) tests/tracking_validator.py:302:0: C0301: Line too long (123/100) (line-too-long) tests/tracking_validator.py:314:0: C0301: Line too long (123/100) (line-too-long) tests/tracking_validator.py:326:0: C0301: Line too long (123/100) (line-too-long) tests/tracking_validator.py:333:0: C0301: Line too long (107/100) (line-too-long) tests/tracking_validator.py:346:0: C0301: Line too long (104/100) (line-too-long) tests/tracking_validator.py:366:0: C0301: Line too long (120/100) (line-too-long) tests/tracking_validator.py:373:0: C0301: Line too long (106/100) (line-too-long) tests/tracking_validator.py:461:0: C0301: Line too long (104/100) (line-too-long) tests/tracking_validator.py:488:0: C0301: Line too long (116/100) (line-too-long) tests/tracking_validator.py:489:0: C0303: Trailing whitespace (trailing-whitespace) tests/tracking_validator.py:544:0: C0303: Trailing whitespace (trailing-whitespace) tests/tracking_validator.py:559:0: C0301: Line too long (103/100) (line-too-long) tests/tracking_validator.py:575:0: C0301: Line too long (115/100) (line-too-long) tests/tracking_validator.py:666:0: C0301: Line too long (102/100) (line-too-long) tests/tracking_validator.py:165:0: R0912: Too many branches (41/12) (too-many-branches) tests/tracking_validator.py:165:0: R0915: Too many statements (156/50) (too-many-statements) tests/tracking_validator.py:408:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:408:0: R0914: Too many local variables (26/15) (too-many-locals) tests/tracking_validator.py:513:4: W0621: Redefining name 'ex' from outer scope (line 9) (redefined-outer-name) tests/tracking_validator.py:513:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:420:23: E1101: Module 'json' has no 'loads' member (no-member) tests/tracking_validator.py:452:15: R1714: Consider merging these comparisons with 'in' by using 'entry_country_code in ('', '-')'. Use a set instead if elements are hashable. (consider-using-in) tests/tracking_validator.py:455:48: R1734: Consider using [] instead of list() (use-list-literal) tests/tracking_validator.py:460:81: R1734: Consider using [] instead of list() (use-list-literal) tests/tracking_validator.py:477:19: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:493:34: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:408:0: R0912: Too many branches (16/12) (too-many-branches) tests/tracking_validator.py:408:0: R0915: Too many statements (64/50) (too-many-statements) tests/tracking_validator.py:517:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:518:4: W0622: Redefining built-in 'dir' (redefined-builtin) tests/tracking_validator.py:521:16: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:523:20: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:527:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) tests/tracking_validator.py:528:16: E1101: Module 'json' has no 'load' member (no-member) tests/tracking_validator.py:532:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:532:0: R0914: Too many local variables (25/15) (too-many-locals) tests/tracking_validator.py:540:21: R1735: Consider using '{}' instead of a call to 'dict'. (use-dict-literal) tests/tracking_validator.py:557:34: R1735: Consider using '{}' instead of a call to 'dict'. (use-dict-literal) tests/tracking_validator.py:603:32: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:532:0: R0912: Too many branches (16/12) (too-many-branches) tests/tracking_validator.py:532:0: R0915: Too many statements (63/50) (too-many-statements) tests/tracking_validator.py:602:28: W0612: Unused variable 'analytics_should_count' (unused-variable) tests/tracking_validator.py:634:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:634:0: R0914: Too many local variables (17/15) (too-many-locals) tests/tracking_validator.py:647:21: W0612: Unused variable 'website_url_content' (unused-variable) tests/tracking_validator.py:705:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:705:0: R0914: Too many local variables (17/15) (too-many-locals) tests/tracking_validator.py:718:21: W0612: Unused variable 'website_url_content' (unused-variable) tests/tracking_validator.py:779:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:810:4: W0621: Redefining name 'ex' from outer scope (line 9) (redefined-outer-name) tests/tracking_validator.py:785:20: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:810:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:815:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:820:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:792:5: W0612: Unused variable 'result_folder_name' (unused-variable) tests/tracking_validator.py:825:16: C0103: Argument name "langCode" doesn't conform to snake_case naming style (invalid-name) tests/tracking_validator.py:851:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:3:0: C0411: standard import "os" should be placed before first party import "models.Rating" (wrong-import-order) tests/tracking_validator.py:4:0: C0411: standard import "json" should be placed before first party import "models.Rating" (wrong-import-order) tests/tracking_validator.py:5:0: C0411: third party import "config" should be placed before first party import "models.Rating" (wrong-import-order) tests/tracking_validator.py:6:0: C0411: standard import "re" should be placed before third party import "config" and first party import "models.Rating" (wrong-import-order) tests/tracking_validator.py:8:0: C0411: standard import "urllib.parse.urlparse" should be placed before third party import "config" and first party import "models.Rating" (wrong-import-order) tests/tracking_validator.py:10:0: C0411: standard import "datetime" should be placed before third party import "config" and first party imports "models.Rating", "tests.utils." (wrong-import-order) tests/tracking_validator.py:12:0: C0411: standard import "gettext" should be placed before third party import "config" and first party imports "models.Rating", "tests.utils.", "tests.sitespeed_base.get_result" (wrong-import-order) tests/tracking_validator.py:9:0: W0614: Unused import(s) request_timeout, useragent, use_cache, cache_time_delta, hashlib, shutil, sys, socket, ssl, time, requests, urllib, uuid, dns, IP2Location, ip2location_db, ex, googlePageSpeedApiKey, gitHubApiKey, dns_server, change_url_to_test_url, is_file_older_than, get_cache_path, get_cache_file, has_cache_file, clean_cache_files, set_cache_file, httpRequestGetContent, get_content_type, get_url_headers, has_redirect, get_guid, convert_to_seconds, is_sitemap, dns_lookup, dns_response_to_list, get_eu_countries, get_exception_countries, is_country_code_in_eu, is_country_code_in_exception_list, get_country_code_from_ip2location, BeautifulSoup, ParseResult and urlunparse from wildcard import of tests.utils (unused-wildcard-import)

7h3Rabbit commented 7 months ago

tests/tracking_validator.py:10:0: C0301: Line too long (152/100) (line-too-long) tests/tracking_validator.py:215:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens) tests/tracking_validator.py:260:0: C0301: Line too long (114/100) (line-too-long) tests/tracking_validator.py:266:0: C0301: Line too long (107/100) (line-too-long) tests/tracking_validator.py:278:0: C0301: Line too long (129/100) (line-too-long) tests/tracking_validator.py:290:0: C0301: Line too long (134/100) (line-too-long) tests/tracking_validator.py:302:0: C0301: Line too long (134/100) (line-too-long) tests/tracking_validator.py:314:0: C0301: Line too long (134/100) (line-too-long) tests/tracking_validator.py:321:0: C0301: Line too long (118/100) (line-too-long) tests/tracking_validator.py:334:0: C0301: Line too long (115/100) (line-too-long) tests/tracking_validator.py:341:0: C0301: Line too long (101/100) (line-too-long) tests/tracking_validator.py:354:0: C0301: Line too long (131/100) (line-too-long) tests/tracking_validator.py:361:0: C0301: Line too long (117/100) (line-too-long) tests/tracking_validator.py:449:0: C0301: Line too long (104/100) (line-too-long) tests/tracking_validator.py:475:0: C0301: Line too long (111/100) (line-too-long) tests/tracking_validator.py:476:0: C0301: Line too long (116/100) (line-too-long) tests/tracking_validator.py:477:0: C0303: Trailing whitespace (trailing-whitespace) tests/tracking_validator.py:483:0: C0301: Line too long (107/100) (line-too-long) tests/tracking_validator.py:489:0: C0301: Line too long (103/100) (line-too-long) tests/tracking_validator.py:493:0: C0301: Line too long (102/100) (line-too-long) tests/tracking_validator.py:532:0: C0303: Trailing whitespace (trailing-whitespace) tests/tracking_validator.py:547:0: C0301: Line too long (131/100) (line-too-long) tests/tracking_validator.py:563:0: C0301: Line too long (126/100) (line-too-long) tests/tracking_validator.py:571:0: C0301: Line too long (103/100) (line-too-long) tests/tracking_validator.py:650:0: C0301: Line too long (102/100) (line-too-long) tests/tracking_validator.py:654:0: C0301: Line too long (113/100) (line-too-long) tests/tracking_validator.py:666:0: C0301: Line too long (101/100) (line-too-long) tests/tracking_validator.py:721:0: C0301: Line too long (116/100) (line-too-long) tests/tracking_validator.py:773:0: C0301: Line too long (568/100) (line-too-long) tests/tracking_validator.py:836:0: C0301: Line too long (103/100) (line-too-long) tests/tracking_validator.py:849:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens) tests/tracking_validator.py:855:0: C0305: Trailing newlines (trailing-newlines) tests/tracking_validator.py:785:5: W0511: TODO: Read sitespeed manual on how to return localStorage (fixme) tests/tracking_validator.py:22:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:39:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:69:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:76:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:88:4: W0702: No exception type(s) specified (bare-except) tests/tracking_validator.py:89:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:94:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:110:4: W0702: No exception type(s) specified (bare-except) tests/tracking_validator.py:111:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:116:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:121:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:137:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:146:4: W0702: No exception type(s) specified (bare-except) tests/tracking_validator.py:147:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:153:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:153:0: R0914: Too many local variables (51/15) (too-many-locals) tests/tracking_validator.py:170:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:211:20: R1723: Unnecessary "elif" after "break", remove the leading "el" from "elif" (no-else-break) tests/tracking_validator.py:201:4: R1702: Too many nested blocks (7/5) (too-many-nested-blocks) tests/tracking_validator.py:223:38: C0121: Comparison 'cookie['secure'] == False' should be 'cookie['secure'] is False' if checking for the singleton value False, or 'not cookie['secure']' if testing for falsiness (singleton-comparison) tests/tracking_validator.py:233:39: C0121: Comparison 'cookie['session'] == False' should be 'cookie['session'] is False' if checking for the singleton value False, or 'not cookie['session']' if testing for falsiness (singleton-comparison) tests/tracking_validator.py:237:20: R1730: Consider using 'cookie_expires_timestamp = min(cookie_expires_timestamp, 25340230080)' instead of unnecessary if block (consider-using-min-builtin) tests/tracking_validator.py:256:8: R1731: Consider using 'nof_points = max(nof_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:274:8: R1731: Consider using 'valid_1year_points = max(valid_1year_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:286:8: R1731: Consider using 'valid_9months_points = max(valid_9months_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:298:8: R1731: Consider using 'valid_6months_points = max(valid_6months_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:310:8: R1731: Consider using 'valid_3months_points = max(valid_3months_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:330:8: R1731: Consider using 'secure_points = max(secure_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:350:8: R1731: Consider using 'analytics_points = max(analytics_points, 1.0)' instead of unnecessary if block (consider-using-max-builtin) tests/tracking_validator.py:153:0: R0912: Too many branches (41/12) (too-many-branches) tests/tracking_validator.py:153:0: R0915: Too many statements (156/50) (too-many-statements) tests/tracking_validator.py:396:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:396:0: R0914: Too many local variables (29/15) (too-many-locals) tests/tracking_validator.py:501:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/tracking_validator.py:440:15: R1714: Consider merging these comparisons with 'in' by using 'entry_country_code in ('', '-')'. Use a set instead if elements are hashable. (consider-using-in) tests/tracking_validator.py:465:30: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:481:34: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:396:0: R0912: Too many branches (16/12) (too-many-branches) tests/tracking_validator.py:396:0: R0915: Too many statements (64/50) (too-many-statements) tests/tracking_validator.py:505:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:509:16: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:511:20: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:515:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) tests/tracking_validator.py:520:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:520:0: R0914: Too many local variables (28/15) (too-many-locals) tests/tracking_validator.py:591:32: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/tracking_validator.py:520:0: R0912: Too many branches (16/12) (too-many-branches) tests/tracking_validator.py:520:0: R0915: Too many statements (63/50) (too-many-statements) tests/tracking_validator.py:590:28: W0612: Unused variable 'analytics_should_count' (unused-variable) tests/tracking_validator.py:622:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:622:0: R0914: Too many local variables (20/15) (too-many-locals) tests/tracking_validator.py:635:21: W0612: Unused variable 'website_url_content' (unused-variable) tests/tracking_validator.py:693:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:693:0: R0914: Too many local variables (20/15) (too-many-locals) tests/tracking_validator.py:706:21: W0612: Unused variable 'website_url_content' (unused-variable) tests/tracking_validator.py:767:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:773:20: C0209: Formatting a regular string which could be an f-string (consider-using-f-string) tests/trackingvalidator.py:788:73: E0602: Undefined variable '' (undefined-variable) tests/trackingvalidator.py:791:77: E0602: Undefined variable '' (undefined-variable) tests/tracking_validator.py:798:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/trackingvalidator.py:797:65: E0602: Undefined variable '' (undefined-variable) tests/tracking_validator.py:803:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/trackingvalidator.py:802:68: E0602: Undefined variable '' (undefined-variable) tests/tracking_validator.py:808:11: W0718: Catching too general exception Exception (broad-exception-caught) tests/trackingvalidator.py:807:60: E0602: Undefined variable '' (undefined-variable) tests/tracking_validator.py:780:5: W0612: Unused variable 'result_folder_name' (unused-variable) tests/tracking_validator.py:836:0: C0116: Missing function or method docstring (missing-function-docstring) tests/tracking_validator.py:836:0: R0913: Too many arguments (6/5) (too-many-arguments)