bmarwell commented on code in PR #1694:
URL: https://github.com/apache/maven-resolver/pull/1694#discussion_r2569917633


##########
src/site/markdown/remote-repository-filtering.md:
##########
@@ -181,6 +181,16 @@ Lines 1 and 2 are ignored. Line 3 means "allow 
`org.apache.maven` G and below".
 only" (so `org.apache.maven.foo.bar` is allowed due first line). Line 5 means 
"disallow `org.apache.maven.indexer` and below"
 and finally line 6 means "allow `org.apache.bar` ONLY" (so 
`org.apache.bar.foo` is NOT enabled).
 
+One can use one special entry "root" `*` (asterisk) to define the "default 
acceptance" (that without it 
+defaults to REJECTED). Similarly, adding `!*` to file defines "default 
acceptance" of FALSE/REJECTED as well, 
+and adding it to file changes nothing, as this is the default acceptance (but 
may serve some documentation purposes). 
+Be aware: In case a line with single asterisk `*` is present, the whole logic 
of Group filter is getting inverted, 
+hence there is no need to add "allowed entries" (they are allowed by default), 
but one can add "disallowed entries" by 
+adding `!com.foo` and alike.
+
+Conflicting rules: rule parser is intentionally trivial, so in case of 
conflicting rules the "first wins" strategy is 
+applied. Ideally, user should keep files sorted or handle them in a way one 
can detect conflicts in it.
+

Review Comment:
   Love it, great description.
   One question popped into my mind: Does it make a differen WHERE I place the 
`*`?
   
   So is this the same?
   
   ```
   # not org.apache from this repo
   !org.apache
   # accept everything else
   *
   ```
   
   vs
   
   ```
   # allow all, except...
   *
   # not org.apache from this repo
   !org.apache
   ```
   
   



##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
 
         assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
         assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+        assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+    }
+
+    @Test
+    void smokeWithPositiveDefault() {
+        GroupTree groupTree = new GroupTree("root");
+        groupTree.loadNodes(Stream.of(
+                "# comment",
+                "",
+                "org.apache.maven",
+                "!=org.apache.maven.foo",
+                "!org.apache.maven.bar",
+                "=org.apache.baz",
+                "*"));
+        assertTrue(groupTree.acceptedGroupId("org.apache.maven"));
+        assertTrue(groupTree.acceptedGroupId("org.apache.maven.aaa"));
+
+        assertFalse(groupTree.acceptedGroupId("org.apache.maven.foo"));
+        assertTrue(groupTree.acceptedGroupId("org.apache.maven.foo.aaa"));
+
+        assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar"));
+        assertFalse(groupTree.acceptedGroupId("org.apache.maven.bar.aaa"));
+
+        assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
+        assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+        assertTrue(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+    }
+
+    @Test
+    void smokeWithNegativeDefault() {

Review Comment:
   Test case with `!*` at top (see other comment)



##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/filter/ruletree/GroupTreeTest.java:
##########
@@ -50,5 +50,59 @@ void smoke() {
 
         assertTrue(groupTree.acceptedGroupId("org.apache.baz"));
         assertFalse(groupTree.acceptedGroupId("org.apache.baz.aaa"));
+
+        assertFalse(groupTree.acceptedGroupId("not.in.list.but.uses.default"));
+    }
+
+    @Test
+    void smokeWithPositiveDefault() {

Review Comment:
   Test case with `*` at top (see other comment)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to