Class Lint


  • public class Lint
    extends java.lang.Object
    A very basic utility for ensuring that the Java Doc Comment portion of a source-file does not exceed a maximum line-length.

    The class can help control the line-length of the JavaDoc portion of '.java' source code files. It has a command line interface that will scroll the thee lines of Java Doc Comments, and ask if the linter has chosen appropriate places to break the lines up.

    It has a few rules about when to insert blank comment lines.

    Related Utility:
    Note that this class "does not participate" in the general Build-Process. This class is an independent utility, to be used for the aforementioned purposes described above. None of the methods exported by this class are invoked during any of the various Build-Stages that comprise this Java-Project Build-Package.


    • Method Summary

       
      Break-up Java Doc Comment lines that are longer than 100 characters
      Modifier and Type Method
      static void lint​(String inFileOrDir)
       
      Check the Line-Lengths for each Line in Source-File(s)
      Modifier and Type Method
      static void externalHTML​(String directoryName)
       
      Tool for dealing with External-HTML File(s)
      Modifier and Type Method
      static void lineLengthChecker​(String directoryName)
       
      Command Line Main-Method
      Modifier and Type Method
      static void main​(String[] argv)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • main

        🡇     🗕  🗗  🗖
        public static void main​(java.lang.String[] argv)
                         throws java.io.IOException
        This class' operations are all performed via the command line. It asks questions of the user from the command line, and lints the Java Doc Comments parts of '.java' files to ensure that no line comment line is longer than 100 characters. This class is probably not too useful - outside of the Java HTML Library! It did help me make all of my source-code files look nice when you click on the "Hi-Lited Source Code" links.
        Throws:
        java.io.IOException
        Code:
        Exact Method Body:
         if (    ((argv.length < 2) || (argv.length > 3))
             ||  StrCmpr.equalsNAND(argv[0], "1", "2", "3")
         )
             System.out.println(man_page);
        
         else if (argv[0].equals("1")) // Java Doc Linter
         {
             if (argv.length == 2) lint(argv[1]);
             else
             {
                 if (! argv[1].equals("INNERCLASS"))
                 {
                     System.out.println(man_page);
                     System.exit(0);
                 }
        
                 JavaDocLineLengths.LONG_JD_COMMENT =
                     JavaDocLineLengths.LONG_JD_COMMENT_INNERCLASS;
        
                 JavaDocLineLengths.COMMENT_LINE_BEGINNING =
                     "    " + JavaDocLineLengths.COMMENT_LINE_BEGINNING;
        
                 lint(argv[2]);
             }
         }
        
         else if (argv[0].equals("2")) // External-HTML File Linter
             externalHTML(argv[1]);
        
         else if (argv[0].equals("3")) // External-HTML File Linter
             lineLengthChecker(argv[1]);
        
         else System.out.println(man_page);
        
      • lint

        🡅  🡇     🗕  🗗  🗖
        public static void lint​(java.lang.String inFileOrDir)
                         throws java.io.IOException
        Performs a 'LINT' on the input Java Source Code File.
        Parameters:
        inFileOrDir - This is any file or directory. If this is a directory, the entire directory will be scanned for '.java' source-files. If this is a file, then it will be the only file that is linted.
        Throws:
        FileNotFoundException - If this file or directory is not found.
        java.io.IOException
        Code:
        Exact Method Body:
         JavaDocLineLengths.lint(inFileOrDir);
        
      • externalHTML

        🡅  🡇     🗕  🗗  🗖
        public static void externalHTML​(java.lang.String directoryName)
                                 throws java.io.IOException
        This can be a really great tool for transitioning a Source-File to use External-HTML Files. This method merely scans an HTML-File for items that need to be escaped or converted to constructs that are usable in '.html' rather than '.java' files.
        Parameters:
        directoryName - The name of a directory containing '.html' files.
        Throws:
        java.io.IOException
        Code:
        Exact Method Body:
         ExternalHTML.cleanIt(directoryName);
        
      • lineLengthChecker

        🡅     🗕  🗗  🗖
        public static void lineLengthChecker​(java.lang.String directoryName)
                                      throws java.io.IOException
        This method will scan an entire directory for '.java' files, and then report if there are any lines in each of those files whose length is greater than 100.

        While not exactly a great tool for all developers, during the development of Java HTML, this has been (on occasion) extremely useful.
        Parameters:
        directoryName - The name of the directory to be scanned for '.java' files.
        Throws:
        java.io.IOException
        Code:
        Exact Method Body:
         LineLengths.check(directoryName);