/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-semantic-version"};ruleDef.prototype.getShortDescription=function(){return"Verify the component has a valid Semver"};ruleDef.prototype.getDescription=function(){return"This rule ensures that a valid semantic version has been used for this component"};ruleDef.prototype.register=function(context){return{compjson:this._doAudit}};ruleDef.prototype._doAudit=function(context){if(context.suppData.obj){let issue;const meta=context.suppData.obj;const fullName=Utils.getComponentFullName(meta);const componentVersionValid=context.utils.semVerUtils.isValid(meta.version);if(!componentVersionValid||meta.version.toLowerCase().startsWith("v")){issue=new context.Issue(`Component ${fullName} has version number which is not in strict semantic versioning format (${meta.version})`);context.reporter.addIssue(issue,context)}}};module.exports=ruleDef;