From 32c76fa2dfd2537c3a0c8a13bf84b01d1f7141ee Mon Sep 17 00:00:00 2001 From: ralphwetzel Date: Fri, 1 Apr 2022 22:05:03 +0200 Subject: [PATCH] Fix P04 node naming check --- src/libs/checkpackage.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/libs/checkpackage.js b/src/libs/checkpackage.js index dbeffa1..e1ceeed 100644 --- a/src/libs/checkpackage.js +++ b/src/libs/checkpackage.js @@ -100,16 +100,14 @@ function checkpackage(path, cli, scorecard, npm_metadata) { legacy = true } } - if (!legacy){ - if (scopedRegex.test(package.name)){ - cli.log('✅ Package uses a Scoped Name') - scorecard.P04 = { 'test' : true} - } else { - cli.warn('P04 New Packages should use a scoped name') - scorecard.P04 = { 'test' : false} - } - } - if (!scopedRegex.test(package.name)) { + + if (scopedRegex.test(package.name)){ + cli.log('✅ Package uses a Scoped Name') + scorecard.P04 = { 'test' : true} + } else if (!legacy){ + cli.warn('P04 New Packages should use a scoped name') + scorecard.P04 = { 'test' : false} + } else { const contribRegex = new RegExp('^(node-red|nodered)(?!-contrib-).*', 'i') if (!contribRegex.test(package.name)){ cli.log('✅ Package uses a valid name') @@ -121,10 +119,7 @@ function checkpackage(path, cli, scorecard, npm_metadata) { cli.warn('P04 Packages using the node-red prefix in their name must use node-red-contrib') scorecard.P04 = { 'test' : false} } - } else { - cli.log('✅ Package uses a Scoped Name') - scorecard.P04 = { 'test' : true} - } + } }) .then(() => { //Check for other package of same name in different scope, ask about fork? P08