diff --git a/source/app/metrics/metadata.mjs b/source/app/metrics/metadata.mjs index 48c57be0..8200e16d 100644 --- a/source/app/metrics/metadata.mjs +++ b/source/app/metrics/metadata.mjs @@ -106,7 +106,7 @@ metadata.plugin = async function({__plugins, name, logger}) { } //Inputs checks const result = Object.fromEntries( - Object.entries(inputs).map(([key, {type, format, default:defaulted, min, max, values}]) => [ + Object.entries(inputs).map(([key, {type, format, default:defaulted, min, max, values, inherits}]) => [ //Format key metadata.to.query(key, {name}), //Format value @@ -269,25 +269,46 @@ metadata.plugin = async function({__plugins, name, logger}) { const demo = raw.match(/(?[\s\S]*?<[/]table>)/)?.groups?.demo?.replace(/<[/]?(?:table|tr)>/g, "")?.trim() ?? "" //Options table + let flags = new Set() const table = [ "| Option | Type *(format)* **[default]** *{allowed values}* | Description |", "| ------ | -------------------------------- | ----------- |", Object.entries(inputs).map(([option, {description, type, ...o}]) => { let row = [] { - const cell = [`${"`"}${option}${"`"}`] + let cell = [] + if (o.required) + cell.push("✔️"), flags.add("required") if (type === "token") - cell.push("🔐") + cell.push("🔐"), flags.add("secret") + if (o.inherits) + cell.push("⏩"), flags.add("inherits") + if (o.global) + cell.push("⏭️"), flags.add("global") + if (o.testing) + cell.push("🔧"), flags.add("testing") if (!Object.keys(previous?.inputs ?? {}).includes(option)) - cell.push("✨") + cell.push("✨"), flags.add("beta") + if (o.extras) + cell.push("🧰"), flags.add("extras") + cell = cell.map(flag => `${flag}`) + cell.unshift(`${"`"}${option}${"`"}`) row.push(cell.join(" ")) } { const cell = [`${"`"}${type}${"`"}`] if ("format" in o) - cell.push(`*(${o.format})*`) - if ("default" in o) - cell.push(`**[${o.default}]**`) + cell.push(`*(${Array.isArray(o.format) ? o.format[0] : o.format})*`) + if ("default" in o) { + let text = o.default + if (o.default === ".user.login") + text = "*→ User login*" + if (o.default === ".user.twitter") + text = "*→ User attached twitter*" + if (o.default === ".user.website") + text = "*→ User attached website*" + cell.push(`**[${text}]**`) + } if ("values" in o) cell.push(`*{${o.values.map(value => `"${value}"`).join(", ")}}*`) if ("min" in o) @@ -302,9 +323,14 @@ metadata.plugin = async function({__plugins, name, logger}) { return `| ${row.join(" | ")} |` }).join("\n"), "\n", - "Legend for option icons:", - "* 🔐 Value should be stored in repository secrets", - "* ✨ New feature currently in testing on `master`/`main`" + flags.size ? "Legend for option icons:" : "", + flags.has("required") ? "* ✔️ Value must be provided" : "", + flags.has("secret") ? "* 🔐 Value should be stored in repository secrets" : "", + flags.has("inherits") ? "* ⏩ Value inherits from its related global-level option" : "", + flags.has("global") ? "* ⏭️ Value be inherited by its related plugin-level option" : "", + flags.has("testing") ? "* 🔧 For development purposes, use with caution" : "", + flags.has("beta") ? "* ✨ Currently in beta-testing on `master`/`main`" : "", + flags.has("extras") ? "* 🧰 Must be enabled in `settings.json` (for web instances)" : "", ].flat(Infinity).filter(s => s).join("\n") //Readme descriptor diff --git a/source/plugins/activity/metadata.yml b/source/plugins/activity/metadata.yml index d4814dda..65b24bba 100644 --- a/source/plugins/activity/metadata.yml +++ b/source/plugins/activity/metadata.yml @@ -88,8 +88,10 @@ inputs: format: comma-separated default: "" example: my-repo-1, my-repo-2, owner/repo-3, ... + inherits: repositories_skipped # Ignored actors (useful to ignore bots users) plugin_activity_ignored: description: Actors to ignore - default: github-actions[bot], dependabot[bot], dependabot-preview[bot] \ No newline at end of file + default: "" + inherits: users_ignored \ No newline at end of file diff --git a/source/plugins/base/metadata.yml b/source/plugins/base/metadata.yml index b99afb34..07a118a6 100644 --- a/source/plugins/base/metadata.yml +++ b/source/plugins/base/metadata.yml @@ -29,7 +29,6 @@ inputs: default: 100 min: 0 - # Number of repositories to load at once by queries # If you encounter GitHub queries timeouts, using a lower value here may solve issues repositories_batch: @@ -66,6 +65,16 @@ inputs: format: comma-separated default: "" example: my-repo-1, my-repo-2, owner/repo-3, ... + global: yes + + # List of default ignored users + # Plugins supporting a "skip users option" will automatically append users listed in this option + users_ignored: + description: Default users to ignore + type: array + format: comma-separated + default: github-actions[bot], dependabot[bot], dependabot-preview[bot] + global: yes # List of surnames or email addresses you use when authoring commits # These are mostly used to perform commits analysis to detect ownership @@ -75,3 +84,4 @@ inputs: format: comma-seperated default: .user.login example: lowlighter, lowlighter@users.noreply.github.com + global: yes diff --git a/source/plugins/code/metadata.yml b/source/plugins/code/metadata.yml index 2aa0aab3..eab43eab 100644 --- a/source/plugins/code/metadata.yml +++ b/source/plugins/code/metadata.yml @@ -45,6 +45,7 @@ inputs: format: comma-separated default: "" example: my-repo-1, my-repo-2, owner/repo-3, ... + inherits: repositories_skipped # Restrict code snippet languages # These are guessed through linguist diff --git a/source/plugins/contributors/metadata.yml b/source/plugins/contributors/metadata.yml index ef66a512..24caa471 100644 --- a/source/plugins/contributors/metadata.yml +++ b/source/plugins/contributors/metadata.yml @@ -32,6 +32,7 @@ inputs: type: array format: comma-separated default: github-actions[bot], dependabot[bot], dependabot-preview[bot] + inherits: users_ignored # Display total contributions for each contributor plugin_contributors_contributions: @@ -65,3 +66,4 @@ inputs: "💻 Code": ["source/**", "src/**"], "#️⃣ Others": ["*"] } + extras: yes diff --git a/source/plugins/core/examples.yml b/source/plugins/core/examples.yml index 5e17cf7d..273f5fb9 100644 --- a/source/plugins/core/examples.yml +++ b/source/plugins/core/examples.yml @@ -1,4 +1,4 @@ -- name: 📗 Classic template +- name: Classic template uses: lowlighter/metrics@latest with: filename: metrics.classic.svg @@ -6,7 +6,7 @@ base: header, repositories plugin_lines: yes -- name: 📘 Repository template +- name: Repository template uses: lowlighter/metrics@latest with: template: repository @@ -19,7 +19,7 @@ plugin_projects: yes plugin_projects_repositories: lowlighter/metrics/projects/1 -- name: 📙 Terminal template +- name: Terminal template uses: lowlighter/metrics@latest with: template: terminal @@ -27,7 +27,7 @@ token: ${{ secrets.METRICS_TOKEN }} base: header, metadata -- name: 📒 Markdown template +- name: Markdown template uses: lowlighter/metrics@latest with: template: markdown @@ -36,7 +36,7 @@ config_output: markdown token: ${{ secrets.METRICS_TOKEN }} -- name: 📒 Markdown template (with plugins) +- name: Markdown template (with plugins) uses: lowlighter/metrics@latest with: template: markdown @@ -66,7 +66,7 @@ plugin_languages: yes token: ${{ secrets.METRICS_TOKEN }} -- name: 📒 Markdown template (pdf output) +- name: Markdown template (pdf output) uses: lowlighter/metrics@latest with: template: markdown @@ -81,7 +81,7 @@ config_padding: 5% token: ${{ secrets.METRICS_TOKEN }} -- name: 📕 Community templates +- name: Community templates uses: lowlighter/metrics@latest with: token: ${{ secrets.METRICS_TOKEN }} diff --git a/source/plugins/core/metadata.yml b/source/plugins/core/metadata.yml index a06e58a9..726b11ec 100644 --- a/source/plugins/core/metadata.yml +++ b/source/plugins/core/metadata.yml @@ -124,6 +124,7 @@ inputs: - comma-separated - /(?[-a-z0-9]+)[/](?[-a-z0-9]+)@(?[-a-z0-9]+):(?