Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix P04 node naming check #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions src/libs/checkpackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand Down