This is an automated email from the ASF dual-hosted git repository.

junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new cd3bc27f54 Fix the vendor name regex for Composer #6192
     new 595fa2cf4f Merge pull request #6196 from 
junichi11/php-gh-6192-composer-vendor-name
cd3bc27f54 is described below

commit cd3bc27f546e925ac5598d518b605ef5cefea5ce
Author: Junichi Yamamoto <junich...@apache.org>
AuthorDate: Fri Jul 14 11:52:05 2023 +0900

    Fix the vendor name regex for Composer #6192
    
    - https://github.com/apache/netbeans/issues/6192
    - https://getcomposer.org/doc/04-schema.md#name
    - VendorName/PackageName: 
`^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$`
---
 .../modules/php/composer/options/ComposerOptionsValidator.java    | 3 ++-
 .../php/composer/options/ComposerOptionsValidatorTest.java        | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/php/php.composer/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidator.java
 
b/php/php.composer/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidator.java
index 043bffb6ab..ea1b056a3b 100644
--- 
a/php/php.composer/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidator.java
+++ 
b/php/php.composer/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidator.java
@@ -29,7 +29,8 @@ import org.openide.util.NbBundle;
  */
 public final class ComposerOptionsValidator {
 
-    private static final Pattern VENDOR_REGEX = 
Pattern.compile("^[a-z0-9-]+$"); // NOI18N
+    // GH-6192 : https://getcomposer.org/doc/04-schema.md#name
+    private static final Pattern VENDOR_REGEX = 
Pattern.compile("^[a-z0-9]([_.-]?[a-z0-9]+)*$"); // NOI18N
     private static final Pattern EMAIL_REGEX = 
Pattern.compile("^\\w+[\\.\\w\\-]*@\\w+[\\.\\w\\-]*\\.[a-z]{2,}$", 
Pattern.CASE_INSENSITIVE); // NOI18N
     private static final Pattern AUTHOR_NAME_REGEX = 
Pattern.compile("^[^\\d]+$"); // NOI18N
 
diff --git 
a/php/php.composer/test/unit/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidatorTest.java
 
b/php/php.composer/test/unit/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidatorTest.java
index 2643ff739f..8c0260038e 100644
--- 
a/php/php.composer/test/unit/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidatorTest.java
+++ 
b/php/php.composer/test/unit/src/org/netbeans/modules/php/composer/options/ComposerOptionsValidatorTest.java
@@ -52,11 +52,15 @@ public class ComposerOptionsValidatorTest extends 
NbTestCase {
         result = new ComposerOptionsValidator()
                 .validateVendor("my.company")
                 .getResult();
-        assertTrue(result.hasWarnings());
+        assertFalse(result.hasWarnings());
         result = new ComposerOptionsValidator()
                 .validateVendor("my_company")
                 .getResult();
-        assertTrue(result.hasWarnings());
+        assertFalse(result.hasWarnings());
+        result = new ComposerOptionsValidator()
+                .validateVendor("my-company")
+                .getResult();
+        assertFalse(result.hasWarnings());
     }
 
     public void testValidAuthorEmail() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to