From 5810fb9baa438859f8983198a1b3460a150a161a Mon Sep 17 00:00:00 2001 From: cockroacher <163405488+cockroacher@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:38:19 +0100 Subject: [PATCH] saving some work in progress --- default.py | 18 ++++++++++++- defaults/credit-sources.json | 32 ++++++++++++++++++++++++ defaults/credits.json | 19 ++++++++++++++ locales/en/LC_MESSAGES/webperf-core.mo | Bin 4778 -> 4841 bytes locales/en/LC_MESSAGES/webperf-core.po | 2 +- locales/gov/LC_MESSAGES/webperf-core.mo | Bin 4759 -> 4822 bytes locales/gov/LC_MESSAGES/webperf-core.po | 2 +- locales/sv/LC_MESSAGES/webperf-core.mo | Bin 4893 -> 4961 bytes locales/sv/LC_MESSAGES/webperf-core.po | 2 +- tests/utils.py | 1 + 10 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 defaults/credit-sources.json create mode 100644 defaults/credits.json diff --git a/default.py b/default.py index 139ae92c..6a2a3247 100644 --- a/default.py +++ b/default.py @@ -173,6 +173,20 @@ class CommandLineOptions: # pylint: disable=too-many-instance-attributes,missing def __init__(self): self.language = False + def show_credits(self, _): + """ + Prints out the webperf_core credits and exits the program. + + This function uses the provided language function to print out webperf_core credits. + After printing the help text, it ends the program. + """ + print(self.language('TEXT_CREDITS')) + # Get all websites used by get_http_content + # - get_http_content\(['"\r\n\t ]+[^"']+["'] + # Get all contributors of repo + # - https://api.github.com/repos/Webperf-se/webperf_core/contributors + sys.exit() + def show_help(self, _): """ Prints out the command usage help text and exits the program. @@ -485,6 +499,7 @@ def handle_option(self, opt, arg): ("--it", "--input-take"): self.set_input_take, ("-o", "--output"): self.set_output_filename, ("-r", "--review", "--report"): self.enable_reviews, + ("-c", "--credits", "--contributions"): self.show_credits, ("-s", "--setting"): self.set_setting, ("-ss", "--save-setting"): self.save_setting } @@ -521,10 +536,11 @@ def main(argv): options.load_language(get_config('general.language')) try: - opts, _ = getopt.getopt(argv, "hu:t:i:o:rA:D:L:s:", [ + opts, _ = getopt.getopt(argv, "hu:t:i:o:rA:D:L:s:c", [ "help", "url=", "test=", "input=", "output=", "review", "report", "addUrl=", "deleteUrl=", "language=", "input-skip=", "input-take=", + "credits", "is=", "it=", "setting=", "save-setting="]) except getopt.GetoptError: print(main.__doc__) diff --git a/defaults/credit-sources.json b/defaults/credit-sources.json new file mode 100644 index 00000000..dbb08256 --- /dev/null +++ b/defaults/credit-sources.json @@ -0,0 +1,32 @@ +{ + "package.dependencies": { + "lighthouse": "12.2.1", + "pa11y": "8.0.0", + "sitespeed.io": "35.3.0", + "vnu-jar": "23.4.11", + "yellowlabtools": "3.0.1" + }, + "websites": [ + "https://api.github.com/repos/{0}/{1}", + "https://api.github.com/repos/{0}/{1}/{2}?state=closed&per_page=100", + "https://api.github.com/repos/{0}/{1}/{2}/{3}/labels", + "https://api.websitecarbon.com/site?url={url}", + "https://developer.mozilla.org/en-US/docs/Web/HTML/Element#obsolete_and_deprecated_elements", + "https://developer.mozilla.org/en-US/docs/Web/CSS/Reference", + "https://developer.mozilla.org/en-US/docs/Web/HTML/Element", + "https://spdx.org/licenses/", + "https://nginx.org/en/security_advisories.html", + "https://www.cvedetails.com/vulnerability-list.php?vendor_id=26&product_id=3427&page=1", + "https://openssl-library.org/news/vulnerabilities/", + "https://openssl-library.org/policies/releasestrat/index.html", + "https://www.php.net/eol.php", + "https://httpd.apache.org/security/vulnerabilities_24.html", + "https://wordpress.org/plugins/{0}/advanced/", + "https://learn.microsoft.com/en-us/lifecycle/products/internet-information-services-iis", + "https://cdn.datatables.net/releases.html", + "https://nuget.optimizely.com/package/?id=EPiServer.Find", + "https://www.php.net/releases/", + "https://svn.apache.org/viewvc/httpd/httpd/tags/", + "https://mta-sts.{hostname}/.well-known/mta-sts.txt" + ] +} \ No newline at end of file diff --git a/defaults/credits.json b/defaults/credits.json new file mode 100644 index 00000000..fbef94d9 --- /dev/null +++ b/defaults/credits.json @@ -0,0 +1,19 @@ +{ + "creditors": [ + { + "name": "webperf-core", + "license": "MIT", + "usage": "", + "contributors": [ + "7h3Rabbit", + "cockroacher", + "marcusosterberg", + "flowertwig-org", + "dependabot[bot]", + "krompaco", + "puggan", + "linulas" + ] + } + ] +} \ No newline at end of file diff --git a/locales/en/LC_MESSAGES/webperf-core.mo b/locales/en/LC_MESSAGES/webperf-core.mo index def72bc27f59f45c82cc4b68c491890225affc44..a7e2b8048c00ff50a8bb0a64a4841a6d8c996f84 100644 GIT binary patch delta 465 zcmXZY&r1S97{>88l4#e=ii$$2p|Br^O$)k25MeYXY}d1!`lsrJQyM~BJvv&>B8w=5r$Zl zAg*8!ZlZ~MxPXT^g;zL?&&ZG#g{!2EWB7#w*c}!b#0ctjJS?6tmjq=3Q~rS}>I*M% z1aJNQCh8z9jNv;*(d;8M#&HNUs2iQ)5}y0tn>fe%1833b_e92-EcX95-0>}dV+M7w3xEF+b)Ywt^u~VrAhDfHu5GP1Mmz7!RnxF? zG0V!icK)bVH4I}}rHW2nRb1!T&ef_aTh6PB?Nmy(s@p2-+NxH}mQM<2B~@_T#%t(1 F@CS2~KX?ED delta 401 zcmXZY&q@MO6vy!+4T1m7Y?zRYiZR_NLGG0)q=mU~7Ou<}XdTmL-oTwJ9cbewH-XUB zb=D)a7ePXCE%ZGo4EHnlH+Swm_blvp`(qgLj}4J=Smatnrg4!&oMQt2Fp67@VVE$2 zCf?u$USSJOd_f-RG4P87c!pz4;}>S|cRybz#Fr$2!ElZl)CISw8$O_g-F@z%7Sh8q z4$#JL%;OqQ&`Rz0DPe`VgZkaWBEDe(XDMGK$IFI54@@8JETUFk#VmI45?@gZ3Q!OF uMD4&2Y6n+XLW}EaVRh8}8TDd)ZG(H?cAuPPqfvXjo17kuB9m==Y5W85perx{ diff --git a/locales/en/LC_MESSAGES/webperf-core.po b/locales/en/LC_MESSAGES/webperf-core.po index c14093a9..9a90a137 100644 --- a/locales/en/LC_MESSAGES/webperf-core.po +++ b/locales/en/LC_MESSAGES/webperf-core.po @@ -112,7 +112,7 @@ msgid "TEXT_TEST_VALID_ARGUMENTS_A11Y_STATEMENT" msgstr "-t 26\t: Accessibility Statement (Alfa)" msgid "TEXT_COMMAND_USAGE" -msgstr "\n\tWebPerf Core\n\n\tUsage:\ndefault.py -u https://webperf.se\n\n\tOptions and arguments:\n\t-h/--help\t\t\t: Help information on how to use script\n\t-u/--url \t\t: website url to test against\n\t-t/--test \t\t: run ONE test (use ? to list available tests)\n\t-r/--review\t\t\t: show reviews in terminal\n\t-i/--input \t\t: input file path (.json/.sqlite/.sitemap/.webprf)\n\t-i/--input-skip \t: number of items to skip\n\t-i/--input-take \t: number of items to take\n\t-o/--output \t\t: output file path (.json/.csv/.sql/.sqlite/.md)\n\t-A/--addUrl \t\t: website url (required in compination with -i/--input)\n\t-D/--deleteUrl \t: website url (required in compination with -i/--input)\n\t-L/--language \t: language used for output(en = default/sv)\n\t--setting =\t\t: override configuration for current run\n\t\t\t\t\t (use ? to list available settings)\n\t--save-setting \t: create own configuration from currently used configuration\n\t\t\t\t\t (You should use 'settings.json')" +msgstr "\n\tWebPerf Core\n\n\tUsage:\ndefault.py -u https://webperf.se\n\n\tOptions and arguments:\n\t-h/--help\t\t\t: Help information on how to use script\n\t-u/--url \t\t: website url to test against\n\t-t/--test \t\t: run ONE test (use ? to list available tests)\n\t-r/--review\t\t\t: show reviews in terminal\n\t-i/--input \t\t: input file path (.json/.sqlite/.sitemap/.webprf)\n\t-i/--input-skip \t: number of items to skip\n\t-i/--input-take \t: number of items to take\n\t-o/--output \t\t: output file path (.json/.csv/.sql/.sqlite/.md)\n\t-A/--addUrl \t\t: website url (required in compination with -i/--input)\n\t-D/--deleteUrl \t: website url (required in compination with -i/--input)\n\t-L/--language \t: language used for output(en = default/sv)\n\t--setting =\t\t: override configuration for current run\n\t\t\t\t\t (use ? to list available settings)\n\t--save-setting \t: create own configuration from currently used configuration\n\t\t\t\t\t (You should use 'settings.json')\n\t-c/--credits\t\t\t: Show projects and people we are thankful for" msgid "TEXT_TEST_REVIEW_OVERVIEW" msgstr "\r\n#### Overall:\r\n{0}" diff --git a/locales/gov/LC_MESSAGES/webperf-core.mo b/locales/gov/LC_MESSAGES/webperf-core.mo index 1d718f7445bccf8684e7663e9d353110c1d8f5cd..279064e12a43115bbf979da57e7fad32f3b96486 100644 GIT binary patch delta 465 zcmXZYze_?<6u|KlS@bN^qM|VKQm8e&tf3{M2n|{+NQG!A(I-~ollKfq*Jx~sAZW6s zB@h}Kf~E*+4T7e|{(x$VzL$i{`JDTMd(ORQk=Mx0MMq=HBXVts#6;xRC(@14ei4S4 zgkD_2K3qpHW^o?(a0*Xx1aFZcF9fcVcMRbt4q}gAWC(+(=W~8(2)QH(VNACVxTr5Y z#xA^UuQyRQa))tz#0Y+46hi@#VN9Yfw1W$1quy`g3_jyDegzsL6C~k*|ANbHv#2{S zV-Qbp60dL+pHLV2K>Y(hsDE&rXU$>~bz?5-^>fq>J)mUPwllkl%~Wc2BiS13YX5O(1`!&}vj760$*>zQQ>;o%bb5*WVP*uyWmMvAcRL-$ft(2=A7LUrRXgjTY H-<#(T4T?Zc delta 401 zcmXZYF-rnr9LMp0bQh?dTAoKC78R#CXbJWLq#7dBL5Fa$$zDQ3!$Fe>wYKOaPA-B& zH8uMN1i`}1E${_MegAlHJfC}h_uTXRpZ~;tbBCP`FJ_1g0wQS<`LaZ|aDid`#SpG= z8v}$vbTE%cc!E`Q@DX|Bm4RQRi%A^dE{@U0nLl5K#ghnu!ElH+>Vg95hBs*9y`MKx z3wgpbY@v%En8F{7qZwWAlfVn+=cwPCn86o3#rLQua=^=+Ko9)$b#~U3XE8y3i^uqY zd)P)jsE68tPt*>6V-8KOtA!O%^E&Fqp0y3N>$_UxvQjD)%U7fQ&3\t\t: website url to test against\n\t-t/--test \t\t: run ONE test (use ? to list available tests)\n\t-r/--review\t\t\t: show reviews in terminal\n\t-i/--input \t\t: input file path (.json/.sqlite/.sitemap/.webprf)\n\t-i/--input-skip \t: number of items to skip\n\t-i/--input-take \t: number of items to take\n\t-o/--output \t\t: output file path (.json/.csv/.sql/.sqlite/.md)\n\t-A/--addUrl \t\t: website url (required in compination with -i/--input)\n\t-D/--deleteUrl \t: website url (required in compination with -i/--input)\n\t-L/--language \t: language used for output(en = default/sv)\n\t--setting =\t\t: override configuration for current run\n\t\t\t\t\t (use ? to list available settings)\n\t--save-setting \t: create own configuration from currently used configuration\n\t\t\t\t\t (You should use 'settings.json')" +msgstr "\n\tWebPerf Core\n\n\tUsage:\ndefault.py -u https://webperf.se\n\n\tOptions and arguments:\n\t-h/--help\t\t\t: Help information on how to use script\n\t-u/--url \t\t: website url to test against\n\t-t/--test \t\t: run ONE test (use ? to list available tests)\n\t-r/--review\t\t\t: show reviews in terminal\n\t-i/--input \t\t: input file path (.json/.sqlite/.sitemap/.webprf)\n\t-i/--input-skip \t: number of items to skip\n\t-i/--input-take \t: number of items to take\n\t-o/--output \t\t: output file path (.json/.csv/.sql/.sqlite/.md)\n\t-A/--addUrl \t\t: website url (required in compination with -i/--input)\n\t-D/--deleteUrl \t: website url (required in compination with -i/--input)\n\t-L/--language \t: language used for output(en = default/sv)\n\t--setting =\t\t: override configuration for current run\n\t\t\t\t\t (use ? to list available settings)\n\t--save-setting \t: create own configuration from currently used configuration\n\t\t\t\t\t (You should use 'settings.json')\n\t-c/--credits\t\t\t: Show projects and people we are thankful for" msgid "TEXT_TEST_REVIEW_OVERVIEW" msgstr "\r\n#### Overall:\r\n{0}" diff --git a/locales/sv/LC_MESSAGES/webperf-core.mo b/locales/sv/LC_MESSAGES/webperf-core.mo index 1e70102821e22aba2d5053c774b63b43ad273785..2b68acf052c23a8621c96c9ba1a0ff790ab5708c 100644 GIT binary patch delta 470 zcmXZXKS%;$9LDiC%IJ>L%>G${Z=v=NGiZ^ZA<~AxTqIg5j#KFpHSWxzMH*{sP9eyt zmOzS{rLCd4t)?0qipIV#Iep&ez2Cj>^VY*};oDkA^{PvV8%>BgAwCi| z_X{zEQ`n0!jA8;+@gtnaOH^~uZQoIy_lrUFdH?5P7$Rr9RUsBwoUt*CkEkwuLDl>N zC$NXw5<{rIucIosi__@fEMDLuKH&`hpeh*Px$684_3U(FJH5A-N+wq~<4u3(mmb%( zh#8GUOgo#g%8sUK%W}(d40&jm4zl^OESdYV&}tNmmXj~pvSP_r!k%sWP*V8~qS K-frq{pX(1%u|n7Y delta 401 zcmXZYJxjt-6vy$SrJ$A1T3Vn&`3RZ?Z4F_z{cRC65Zv4ao&U5sI5%liO)iV+fJ$)E5DKQM($bME9BI$#2` qSjIdy@f7bdhp(tV`;FS)t\t\t: webbplatsens adress att testa\n\t-t/--test \t\t: kör ett specifikt test (ange ? för att lista tillgängliga tester)\n\t-r/--review\t\t\t: visar omdömen direkt i terminalen\n\t-i/--input \t\t: sökväg för input-fil (.json/.sqlite)\n\t-i/--input-skip \t: antal att hoppa över\n\t-i/--input-take \t: antal att testa\n\t-o/--output \t\t: sökväg till output-fil (.json/.csv/.sql/.sqlite/.md)\n\t-A/--addUrl \t\t: webbplatsens adress/url (ett krav när du använder -i/--input)\n\t-D/--deleteUrl \t: webbplats adress/url (ett krav när du använder -i/--input)\n\t-L/--language \t: språk som används för output(en = default/sv)\n\t--setting =\t: Använd inställning för nuvarande körning\n\t\t\t\t\t (ange ? för att lista tillgängliga inställningar)\n\t--save-setting \t: Skapa egen inställningsfil från nuvarande använda inställningar\n\t\t\t\t\t (Du bör använda 'settings.json')" +msgstr "\n\tWebPerf Core\n\n\tAnvänd så här:\ndefault.py -u https://webperf.se\n\n\tVal och argument:\n\t-h/--help\t\t\t: Hjälp och hur du använder skriptet\n\t-u/--url \t\t: webbplatsens adress att testa\n\t-t/--test \t\t: kör ett specifikt test (ange ? för att lista tillgängliga tester)\n\t-r/--review\t\t\t: visar omdömen direkt i terminalen\n\t-i/--input \t\t: sökväg för input-fil (.json/.sqlite)\n\t-i/--input-skip \t: antal att hoppa över\n\t-i/--input-take \t: antal att testa\n\t-o/--output \t\t: sökväg till output-fil (.json/.csv/.sql/.sqlite/.md)\n\t-A/--addUrl \t\t: webbplatsens adress/url (ett krav när du använder -i/--input)\n\t-D/--deleteUrl \t: webbplats adress/url (ett krav när du använder -i/--input)\n\t-L/--language \t: språk som används för output(en = default/sv)\n\t--setting =\t: Använd inställning för nuvarande körning\n\t\t\t\t\t (ange ? för att lista tillgängliga inställningar)\n\t--save-setting \t: Skapa egen inställningsfil från nuvarande använda inställningar\n\t\t\t\t\t (Du bör använda 'settings.json')\n\t-c/--credits\t\t\t: Visa projekt och människor vi är tacksamma för" msgid "TEXT_TEST_REVIEW_OVERVIEW" msgstr "\r\n#### Övergripande:\r\n{0}" diff --git a/tests/utils.py b/tests/utils.py index 115ae041..b7c69295 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -372,6 +372,7 @@ def get_http_content(url, allow_redirects=False, use_text_instead_of_content=Tru str or bytes: The content of the URL. """ try: + print('A\tget_http_content', url) content = get_cache_file( url, use_text_instead_of_content,