Skip to content

Commit

Permalink
Add a check if plugins is an array and update README (#88)
Browse files Browse the repository at this point in the history
* docs(plugins): add a check if plugin is an array

Update README

* fix(plugins): panic if plugin entry is not an object
  • Loading branch information
QuentinLemCode authored Sep 9, 2024
1 parent d1e1719 commit 2b3a599
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ A very minimal config file can look something like this:
```js
module.exports = {
project_name: 'PROJECT_NAME',
plugins: ['loc'],
plugins: { loc: {} }, // Add metrics about number of lines of code
metrics: [
{
name: 'TODO/FIXME',
Expand Down
1 change: 1 addition & 0 deletions src/occurrences.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const runEvals = (metrics, codeOwners, quiet) => {
}

const runPlugins = async (plugins = {}, quiet) => {
if (typeof plugins !== 'object' || plugins === null) panic('Plugins should be an object')
if (!Object.keys(plugins).length) return []

if (!quiet) spinnies.add('plugins', { text: 'Running plugins...', indent: 2 })
Expand Down

0 comments on commit 2b3a599

Please sign in to comment.