You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/11/15 13:49:27 UTC

[GitHub] [netbeans] ebarboni opened a new pull request, #4969: apidoc check and improvement

ebarboni opened a new pull request, #4969:
URL: https://github.com/apache/netbeans/pull/4969

   This PR is a modification of apidoc generation to prepare the cleanup #4450
   
   Compared to #4450, only do a full verification if parameter apidocfullcheck is set to true. 
   
   Disallowedlinks is anticipated fixed #4450 generate txt file to list rejected/accepted to later processing (linkchecker)
   Fixed xsl to new website.
   linelength 240
   check all html file not only arch.
   anchor regexp should also scan for id
   build.properties revised to match level stability and also master/release branding dependencies
   
   Javadoc indexer changed to json and parse more information to get interface #4699
   
   This PR should be put in each release branch later.
   
   Hope this is shorter to review :D and so next PR 


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ebarboni commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
ebarboni commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1024030222


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;
+                        if (accept) {
+                            dummyName = "acceptednetbeans.txt";
+                        } else {
+                            dummyName = "rejectednetbeans.txt";
+                        }
+                        Path dumppath = externallinksdump.toPath().resolve(dummyName);
+                        if (Files.notExists(dumppath)) {
+                            Files.createDirectories(dumppath.getParent());
+                            Files.createFile(dumppath);
+                        }
+                        List<String> existingEntries = Files.readAllLines(externallinksdump.toPath().resolve(dummyName));
+                        Set<String> sortedEntries = new TreeSet<>(existingEntries);
+                        sortedEntries.add(u.toString());
+                        StringBuilder sb = new StringBuilder();
+                        for (String sortedEntry : sortedEntries) {
+                            sb.append(sortedEntry).append(System.lineSeparator());
+                        }
+                        Files.write(dumppath, sb.toString().getBytes(), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);

Review Comment:
   +1



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lbownik commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
lbownik commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023979714


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;
+                        if (accept) {
+                            dummyName = "acceptednetbeans.txt";
+                        } else {
+                            dummyName = "rejectednetbeans.txt";
+                        }
+                        Path dumppath = externallinksdump.toPath().resolve(dummyName);
+                        if (Files.notExists(dumppath)) {
+                            Files.createDirectories(dumppath.getParent());
+                            Files.createFile(dumppath);
+                        }
+                        List<String> existingEntries = Files.readAllLines(externallinksdump.toPath().resolve(dummyName));

Review Comment:
   existing entries variable seems unneeded.
   would
   Set<String> sortedEntries = new TreeSet<>(Files.readAllLines(externallinksdump.toPath().resolve(dummyName)));
   rork?



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ebarboni commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
ebarboni commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023988774


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;

Review Comment:
   for file name sorry didn't understand first



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lbownik commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
lbownik commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023985014


##########
nbbuild/antsrc/org/netbeans/nbbuild/JavadocIndex.java:
##########
@@ -85,90 +91,72 @@ public void execute() throws BuildException {
         } catch (IOException ex) {
             throw new BuildException (ex);
         }
-    }    
+    }
+
+
 
-    
-    
     /** Stores parsed info in classes variable */
     private void parseForClasses (File f) throws BuildException {
         log ("Parsing file: " + f, Project.MSG_DEBUG);
         try {
-            BufferedReader is = new BufferedReader (new FileReader (f));
-            
-            
             String urlPrefix;
             try {
                 String fullDir = f.getParentFile ().getCanonicalPath ();
                 String fullTgz = target.getParentFile ().getCanonicalPath ();
-                
+
                 if (!fullDir.startsWith (fullTgz)) {
                     throw new BuildException ("The directory of target file must be above all parsed files. Directory: " + fullTgz + " the file dir: " + fullDir);
                 }
-                
+
                 urlPrefix = fullDir.substring (fullTgz.length () + 1);
             } catch (IOException ex) {
                 throw new BuildException (ex);
             }
-            
-            // parse following string
-            // <A HREF="org/openide/xml/XMLUtil.html" title="class in org.openide.xml">XMLUtil</A
-            String mask = ".*<A HREF=\"([^\"]*)\" title=\"(class|interface|annotation) in ([^\"]*)\"[><I]*>([\\p{Alnum}\\.]*)</.*A>.*";
-            Pattern p = Pattern.compile (mask, Pattern.CASE_INSENSITIVE);
-            // group 1: relative URL to a class or interface
-            // group 2: interface, class or annotation string
-            // group 3: name of package
-            // group 4: name of class
-            
+
+            Document doc = Jsoup.parse(f, "UTF-8", "");
+            Elements ul = doc.getElementsByTag("ul");
+            // should be only one list
+            if (ul.size() != 1) {
+                throw new BuildException("File is not valid for parsing classes : " + f);
+            }
             int matches = 0;
-            for (;;) {
-                String line = is.readLine ();
-                if (line == null) break;
-                
-                Matcher m = p.matcher (line);
-                if (m.matches ()) {
+            for (Element li : ul.first().getElementsByTag("li")) {
+                // class Name is the only text in all the tag
+                String className = li.text();
+                // we need anchor to get the inforation
+                Element anchor = li.getElementsByTag("a").first();
+                // left of title is type of element (interface,annotation,class,enum ....)
+                // right of title is package of element
+                String[] title = anchor.attr("title").split(" in ");
+                if (title.length == 2) {
                     matches++;
-                    log ("Accepted line: " + line, Project.MSG_DEBUG);
-                    
-                    if (m.groupCount () != 4) {
-                        StringBuffer sb = new StringBuffer ();
-                        sb.append ("Line " + line + " has " + m.groupCount () + " groups and not four");
-                        for (int i = 0; i <= m.groupCount (); i++) {
-                            sb.append ("\n  " + i + " grp: " + m.group (i));
-                        }
-                        throw new BuildException (sb.toString ());
-                    }
-                   
-                    Clazz c = new Clazz (
-                        m.group (3),
-                        m.group (4),
-                        "interface".equals (m.group (2)),
-                        urlPrefix + "/" + m.group (1)
+                    Clazz c = new Clazz(
+                            title[1].trim(),
+                            className,
+                            "interface".equals(title[0].trim()),
+                            urlPrefix + "/" + anchor.attr("href")
                     );
-                    if (c.name == null) throw new NullPointerException ("Null name for " + line + "\nclass: " + c);
-                    if (c.name.length () == 0) throw new IllegalStateException ("Empty name for " + line + "\nclass: " + c);
-                    
-                    log ("Adding class: " + c, Project.MSG_DEBUG);
-                    
+                    if (c.name.length() == 0) {

Review Comment:
   how about 
   if(c.name.isEmpty()) {



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lbownik commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
lbownik commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023977646


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;

Review Comment:
   Wouldn't ternary operator be more readable here?



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ebarboni merged pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
ebarboni merged PR #4969:
URL: https://github.com/apache/netbeans/pull/4969


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ebarboni commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
ebarboni commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023988774


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;

Review Comment:
   for what ? the log line is in all cases and unmodified from previous workflow.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lbownik commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
lbownik commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023983158


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;
+                        if (accept) {
+                            dummyName = "acceptednetbeans.txt";
+                        } else {
+                            dummyName = "rejectednetbeans.txt";
+                        }
+                        Path dumppath = externallinksdump.toPath().resolve(dummyName);
+                        if (Files.notExists(dumppath)) {
+                            Files.createDirectories(dumppath.getParent());
+                            Files.createFile(dumppath);
+                        }
+                        List<String> existingEntries = Files.readAllLines(externallinksdump.toPath().resolve(dummyName));
+                        Set<String> sortedEntries = new TreeSet<>(existingEntries);
+                        sortedEntries.add(u.toString());
+                        StringBuilder sb = new StringBuilder();
+                        for (String sortedEntry : sortedEntries) {
+                            sb.append(sortedEntry).append(System.lineSeparator());
+                        }
+                        Files.write(dumppath, sb.toString().getBytes(), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);

Review Comment:
   Wouldn't 
   Files.write(dumbpath, sortedEntries, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
   be more efficient?



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ebarboni commented on a diff in pull request #4969: apidoc check and improvement

Posted by GitBox <gi...@apache.org>.
ebarboni commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023988993


##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
                 throw new BuildException ("Each filter must have pattern attribute");
             }
             
-            if (pattern.matcher (u.toString ()).matches ()) {
-                log ("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+            if (pattern.matcher(u.toString()).matches()) {
+                log("Matched " + u + " accepted: " + accept, org.apache.tools.ant.Project.MSG_VERBOSE);
+                if (externallinksdump != null) {
+                    try {
+                        String dummyName;
+                        if (accept) {
+                            dummyName = "acceptednetbeans.txt";
+                        } else {
+                            dummyName = "rejectednetbeans.txt";
+                        }
+                        Path dumppath = externallinksdump.toPath().resolve(dummyName);
+                        if (Files.notExists(dumppath)) {
+                            Files.createDirectories(dumppath.getParent());
+                            Files.createFile(dumppath);
+                        }
+                        List<String> existingEntries = Files.readAllLines(externallinksdump.toPath().resolve(dummyName));

Review Comment:
   will change that thanks



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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