Repository: anuraghazra/github-readme-stats
Pull request #2833 (2023-06-16 04:22:57)

Fixed docstring for trimTopLanguages function
Function arguments was reordered because optional parameter cannot be previously than non-optional.

vercel[bot]: [vc]: #hBMRy6y0/juVMNEi+dBP8cvk0jvQz7etFF4tIanOmkc=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzL0dWanFkb203Wmk4Rmk5RVdnZmdWNzhNWWRYS0wiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtZml4ZWRkby0wYmUxODQtZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQifV19
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated (UTC) |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | ✅ Ready ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/GVjqdom7Zi8Fi9EWgfgV78MYdXKL)) | [Visit Preview](https://github-readme-stats-git-fixeddo-0be184-github-readme-stats-team.vercel.app) | Jun 16, 2023 4:23am |


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2833?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) Report
Patch coverage: **`100.00`**% and no project coverage change.
> Comparison is base [(`22a12e1`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/commit/22a12e1adeeeab9010b242f953f02a83a0772dd5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.61% compared to head [(`3af4ab8`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2833?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.61%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #2833   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files          24       24           
  Lines        4871     4871           
  Branches      449      449           
=======================================
  Hits         4755     4755           
  Misses        115      115           
  Partials        1        1           
```


| [Impacted Files](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2833?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) | Coverage Δ | |
|---|---|---|
| [src/cards/top-languages-card.js](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2833?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra#diff-c3JjL2NhcmRzL3RvcC1sYW5ndWFnZXMtY2FyZC5qcw==) | `100.00% <100.00%> (ø)` | |


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/2833?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).


Patch:
diff --git a/readme.md b/readme.md
index 4e4de58..0e843a8 100644
--- a/readme.md
+++ b/readme.md
@@ -235,15 +235,15 @@ You can use [GitHub's new media feature](https://github.blog/changelog/2022-05-1
 
 ```html
 <picture>
-<source
-  srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark"
-  media="(prefers-color-scheme: dark)"
-/>
-<source
-  srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true"
-  media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
-/>
-<img src="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true" />
+  <source
+    srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark"
+    media="(prefers-color-scheme: dark)"
+  />
+  <source
+    srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true"
+    media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
+  />
+  <img src="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true" />
 </picture>
 ```
 
@@ -635,7 +635,7 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
 ## On other platforms
 
 > **Warning**
-> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. #2341). The support for this method, therefore, is limited.
+> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. [#2341](https://github.com/anuraghazra/github-readme-stats/discussions/2341)). The support for this method, therefore, is limited.
 
 <details>
 <summary><b>:hammer_and_wrench: Step-by-step guide for deploying on other platforms</b></summary>
diff --git a/src/cards/stats-card.js b/src/cards/stats-card.js
index 30f85f7..9b5763e 100644
--- a/src/cards/stats-card.js
+++ b/src/cards/stats-card.js
@@ -160,6 +160,16 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
     value: totalPRs,
     id: "prs",
   };
+
+  if (show_total_reviews) {
+    STATS.reviews = {
+      icon: icons.reviews,
+      label: i18n.t("statcard.reviews"),
+      value: totalReviews,
+      id: "reviews",
+    };
+  }
+
   STATS.issues = {
     icon: icons.issues,
     label: i18n.t("statcard.issues"),
@@ -173,16 +183,6 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
     id: "contribs",
   };
 
-  // Extra stats items.
-  if (show_total_reviews) {
-    STATS.reviews = {
-      icon: icons.reviews,
-      label: i18n.t("statcard.reviews"),
-      value: totalReviews,
-      id: "reviews",
-    };
-  }
-
   const longLocales = [
     "cn",
     "es",
diff --git a/src/cards/top-languages-card.js b/src/cards/top-languages-card.js
index a757114..90f5a56 100644
--- a/src/cards/top-languages-card.js
+++ b/src/cards/top-languages-card.js
@@ -163,11 +163,11 @@ const donutCenterTranslation = (totalLangs) => {
  * Trim top languages to lang_count while also hiding certain languages.
  *
  * @param {Record<string, Lang>} topLangs Top languages.
- * @param {string[]} hide Languages to hide.
  * @param {string} langs_count Number of languages to show.
- * @returns {{topLangs: Record<string, Lang>, totalSize: number}} Trimmed top languages and total size.
+ * @param {string[]=} hide Languages to hide.
+ * @returns {{ langs: Lang[], totalLanguageSize: number }} Trimmed top languages and total size.
  */
-const trimTopLanguages = (topLangs, hide, langs_count) => {
+const trimTopLanguages = (topLangs, langs_count, hide) => {
   let langs = Object.values(topLangs);
   let langsToHide = {};
   let langsCount = clampValue(parseInt(langs_count), 1, 10);
@@ -733,8 +733,8 @@ const renderTopLanguages = (topLangs, options = {}) => {
 
   const { langs, totalLanguageSize } = trimTopLanguages(
     topLangs,
-    hide,
     String(langs_count),
+    hide,
   );
 
   let width = isNaN(card_width)
diff --git a/src/translations.js b/src/translations.js
index 01da0a8..d6d173e 100644
--- a/src/translations.js
+++ b/src/translations.js
@@ -199,30 +199,34 @@ const statCardLocales = ({ name, apostrophe }) => {
       se: "Bidragit till (förra året)",
     },
     "statcard.reviews": {
-      ar: "إجمالي مراجعات العلاقات العامة",
-      cn: "公关评论总数",
-      cs: "Celkové PR recenze",
-      de: "Gesamtzahl der PR-Bewertungen",
-      en: "Total PR reviews",
-      bn: "মোট জনসংযোগ পর্যালোচনা",
-      es: "Revisiones de relaciones públicas totales",
-      fr: "Total des revues de relations publiques",
-      hu: "Összes PR értékelés",
-      it: "Totale recensioni di pubbliche relazioni",
-      ja: "PRレビューの合計",
-      kr: "총 PR 리뷰",
-      nl: "Totale PR-recensies",
-      "pt-pt": "Total de avaliações de relações públicas",
-      "pt-br": "Total de avaliações de relações públicas",
-      np: "कुल PR समीक्षाहरू",
-      el: "Συνολικές κριτικές δημοσίων σχέσεων",
-      ru: "Всего PR отзывов",
-      "uk-ua": "Тотальний PR оглядів",
-      id: "Ulasan PR total",
-      my: "စုစုပေါင်း PR သုံးသပ်ချက်",
-      sk: "Celkové hodnotenia PR",
-      tr: "Toplam halkla ilişkiler incelemesi",
-      pl: "Razem recenzje PR",
+      ar: "تمت مراجعة إجمالي العلاقات العامة",
+      cn: "審查的 PR 總數",
+      "zh-tw": "审查的 PR 总数",
+      cs: "Celkový počet PR",
+      de: "Insgesamt überprüfte PRs",
+      en: "Total PRs reviewed",
+      bn: "সর্বমোট পুনরালোচনা করা PR",
+      es: "PR totales revisados",
+      fr: "Nombre total de PR examinés",
+      hu: "Összes ellenőrzött PR",
+      it: "PR totali esaminati",
+      ja: "レビューされた PR の総数",
+      kr: "검토된 총 PR",
+      nl: "Totaal beoordeelde PR's",
+      "pt-pt": "Total de PRs revistos",
+      "pt-br": "Total de PRs revisados",
+      np: "कुल पीआर समीक्षित",
+      el: "Σύνολο Αναθεωρημένων PR",
+      ru: "Всего pull request`ов проверено",
+      "uk-ua": "Всього pull request`iв перевірено",
+      id: "Total PR yang Direview",
+      my: "Jumlah PR Dikaji Semula",
+      sk: "Celkový počet PR",
+      tr: "İncelenen toplam PR",
+      pl: "Łącznie sprawdzonych PR",
+      uz: "Koʻrib chiqilgan PR-lar soni",
+      vi: "Tổng Số PR Đã Xem Xét",
+      se: "Totalt antal granskade PR",
     },
   };
 };


Test patch:
diff --git a/tests/renderTopLanguages.test.js b/tests/renderTopLanguages.test.js
index e9e43f2..fb42fbb 100644
--- a/tests/renderTopLanguages.test.js
+++ b/tests/renderTopLanguages.test.js
@@ -310,21 +310,19 @@ describe("Test renderTopLanguages helper functions", () => {
       langs: [langs.javascript],
       totalLanguageSize: 200,
     });
-    expect(
-      trimTopLanguages([langs.javascript, langs.HTML], [], 5),
-    ).toStrictEqual({
+    expect(trimTopLanguages([langs.javascript, langs.HTML], 5)).toStrictEqual({
       langs: [langs.javascript, langs.HTML],
       totalLanguageSize: 400,
     });
-    expect(trimTopLanguages(langs, [], 5)).toStrictEqual({
+    expect(trimTopLanguages(langs, 5)).toStrictEqual({
       langs: Object.values(langs),
       totalLanguageSize: 500,
     });
-    expect(trimTopLanguages(langs, [], 2)).toStrictEqual({
+    expect(trimTopLanguages(langs, 2)).toStrictEqual({
       langs: Object.values(langs).slice(0, 2),
       totalLanguageSize: 400,
     });
-    expect(trimTopLanguages(langs, ["javascript"], 5)).toStrictEqual({
+    expect(trimTopLanguages(langs, 5, ["javascript"])).toStrictEqual({
       langs: [langs.HTML, langs.css],
       totalLanguageSize: 300,
     });