Add linter and minor bug fixes (#107)

This commit is contained in:
Simon Lecoq
2021-02-05 23:45:48 +01:00
committed by GitHub
parent 61e2f6e1a1
commit 882a93dea5
74 changed files with 1544 additions and 712 deletions

View File

@@ -1,5 +1,5 @@
//Setup
export default async function ({login, data, imports, q, account}, {enabled = false} = {}) {
export default async function({login, data, imports, q, account}, {enabled = false} = {}) {
//Plugin execution
try {
//Check if plugin is enabled and requirements are met
@@ -42,7 +42,7 @@
//Compute languages stats
console.debug(`metrics/compute/${login}/plugins > languages > computing stats`)
languages.favorites = Object.entries(languages.stats).sort(([an, a], [bn, b]) => b - a).slice(0, 8).map(([name, value]) => ({name, value, size:value, color:languages.colors[name], x:0})).filter(({value}) => value/languages.total > threshold)
languages.favorites = Object.entries(languages.stats).sort(([_an, a], [_bn, b]) => b - a).slice(0, 8).map(([name, value]) => ({name, value, size:value, color:languages.colors[name], x:0})).filter(({value}) => value/languages.total > threshold)
const visible = {total:Object.values(languages.favorites).map(({size}) => size).reduce((a, b) => a + b, 0)}
for (let i = 0; i < languages.favorites.length; i++) {
languages.favorites[i].value /= visible.total

View File

@@ -18,6 +18,7 @@ inputs:
type: array
format: comma-separated
default: ""
example: html, css, ...
# List of repositories that will be skipped
plugin_languages_skipped:
@@ -25,6 +26,7 @@ inputs:
type: array
format: comma-separated
default: ""
example: my-repo-1, my-repo-2, ...
# Overrides default languages colors
# Use `${n}:${color}` to change the color of the n-th most used language (e.g. "0:red" to make your most used language red)
@@ -38,6 +40,7 @@ inputs:
- comma-separated
- /((?<index>[0-9])|(?<language>[-+a-z0-9#])):(?<color>#?[-a-z0-9]+)/
default: github
example: javascript:red, 0:blue, 1:#ff00aa
# Languages additional details
plugin_languages_details:
@@ -48,6 +51,7 @@ inputs:
- bytes-size # Languages total size written in bytes
- percentage # Languages proportions in %
default: ""
example: bytes-size, percentage
# Minimum threshold (in percentage) to reach for languages to be displayed
plugin_languages_threshold: