View Javadoc
1   /*
2   com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheckTest$NonTightHtmlTagTolerantCheck
3   violateExecutionOnNonTightHtml = true
4   reportVisitJavadocToken = true
5   
6   */
7   
8   package com.puppycrawl.tools.checkstyle.checks.javadoc.abstractjavadoc;
9   
10  /**
11   * <body>
12   * <p> This class is only meant for testing. </p>
13   * an ending period.'
14   * <p> In html, closing all tags is not necessary.
15   * <li> neither is opening every tag. <p>Only the first non-tight tag is logged</li>
16   * </body>
17   *
18   * @see "https://www.w3.org/TR/html51/syntax.html#optional-start-and-end-tags"
19   */
20  // violation 9 lines above 'tag BODY_TAG_START'
21  // violation 9 lines above 'tag P_TAG_START'
22  // 2 violations 8 lines above:
23  //                            'Unclosed HTML tag found: p'
24  //                            'tag P_TAG_START'
25  // 2 violations 10 lines above:
26  //                            'tag LI_TAG_START'
27  //                            'tag P_TAG_START'
28  
29  public class InputAbstractJavadocNonTightHtmlTags2 {
30      /** <p> <p> paraception </p> </p> */
31      // 3 violations above:
32      //                    'Unclosed HTML tag found: p'
33      //                    'tag P_TAG_START'
34      //                    'tag P_TAG_START'
35      private int field1;
36  
37      /**<li> paraTags should be opened</p> list isn't nested in parse tree </li>*/
38      // 2 violations above:
39      //                    'Unclosed HTML tag found: li'
40      //                    'tag LI_TAG_START'
41      private int field2;
42  
43      /**
44       * <p> this paragraph is closed and would be nested in javadoc tree </p>
45       * <li> list has an <p> unclosed para, but still the list would get nested </li>
46       */
47      // violation 3 lines above 'P_TAG_START'
48      // 3 violations 3 lines above:
49      //                    'Unclosed HTML tag found: p'
50      //                    'tag LI_TAG_START'
51      //                    'tag P_TAG_START'
52      private int field3;
53  
54      /**
55       * <li> Complete <p> nesting </p> </li>
56       * <tr> Zero </p> nesting despite `tr` is closed </tr>
57       */
58      // 2 violations 3 lines above:
59      //                            'tag LI_TAG_START'
60      //                            'tag P_TAG_START'
61      // violation 5 lines above 'Unclosed HTML tag found: tr'
62      private int field4;
63  
64      /**
65       * <p> <a href="www.something.com">something</a> paragraph with `htmlTag` </p>
66       * <p> <a href="www.something.com"/> Nested paragraph with `singletonTag` </p>
67       * <li> Outer tag <li> Inner tag nested </li> not nested </li>
68       */
69      // violation 4 lines above 'tag P_TAG_START'
70      // violation 4 lines above 'tag P_TAG_START'
71      // 3 violations 4 lines above:
72      //                            'Unclosed HTML tag found: li'
73      //                            'tag LI_TAG_START'
74      //                            'tag LI_TAG_START'
75      private int field5;
76  
77      /**
78       * <body> body <p> paragraph <li> list </li> </p> </body>
79       *
80       * @return <li> <li> outer list isn't nested in parse tree </li> </li>
81       */
82      // 3 violations 4 lines above:
83      //                            'tag BODY_TAG_START'
84      //                            'tag P_TAG_START'
85      //                            'tag LI_TAG_START'
86      // 3 violations 6 lines above:
87      //                            'Unclosed HTML tag found: li'
88      //                            'tag LI_TAG_START'
89      //                            'tag LI_TAG_START'
90      int getField1() {return field1;}
91  
92      /***/
93      int getField2() {return field2;} //method with empty javadoc
94  
95      /**
96       * <p>This is a setter method.
97       * And paraTag shall be nested in parse tree </p>
98       * @param field2 <p> setter
99       */
100     // violation 4 lines above 'tag P_TAG_START'
101     // 2 violations 3 lines above:
102     //                            'Unclosed HTML tag found: p'
103     //                            'tag P_TAG_START'
104     void setField2(int field2) {this.field2 = field2;}
105 
106     /**
107      * <p> paragraph with a <br>singletonElement. <hr> And it contains another. </p>
108      * <li> List with singletonElement
109      * <param name=mov value="~/imitation game.mp4"> <param name=allowfullscreen value=true> </li>
110      * @return <tr> tr with <base href="www.something.com"> singletonElement </tr>
111      *     <tr> nonTight </th>
112      */
113     // violation 6 lines above 'tag P_TAG_START'
114     // violation 6 lines above 'tag LI_TAG_START'
115     // violation 4 lines above 'Unclosed HTML tag found: tr'
116     private int getField3() {return field3;}
117 }