[Htmlparser-cvs] htmlparser/src/org/htmlparser/tags/data CompositeTagData.java,1.31,1.32 FormData.ja
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-10 03:39:06
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/data In directory sc8-pr-cvs1:/tmp/cvs-serv24483/src/org/htmlparser/tags/data Modified Files: CompositeTagData.java FormData.java LinkData.java TagData.java Log Message: Add style checking target to ant build script: ant checkstyle It uses a jar from http://checkstyle.sourceforge.net which is dropped in the lib directory. The rules are in the file htmlparser_checks.xml in the src directory. Added lexerapplications package with Tabby as the first app. It performs whitespace manipulation on source files to follow the style rules. This reduced the number of style violations to roughly 14,000. There are a few issues with the style checker that need to be resolved before it should be taken too seriously. For example: It thinks all method arguments should be final, even if they are modified by the code (which the compiler frowns on). It complains about long lines, even when there is no possibility of wrapping the line, i.e. a URL in a comment that's more than 80 characters long. It considers all naked integers as 'magic numbers', even when they are obvious, i.e. the 4 corners of a box. It complains about whitespace following braces, even in array initializers, i.e. X[][] = { {a, b} { } } But it points out some really interesting things, even if you don't agree with the style guidelines, so it's worth a look. Index: CompositeTagData.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/data/CompositeTagData.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** CompositeTagData.java 8 Sep 2003 02:26:30 -0000 1.31 --- CompositeTagData.java 10 Sep 2003 03:38:23 -0000 1.32 *************** *** 1,27 **** // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 1,27 ---- // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 37,41 **** private Tag endTag; private NodeList children; ! public CompositeTagData( Tag startTag, Tag endTag, NodeList children) { --- 37,41 ---- private Tag endTag; private NodeList children; ! public CompositeTagData( Tag startTag, Tag endTag, NodeList children) { *************** *** 46,50 **** for (SimpleNodeIterator i = children.elements();i.hasMoreNodes();) { this.children.add(i.nextNode()); ! } } --- 46,50 ---- for (SimpleNodeIterator i = children.elements();i.hasMoreNodes();) { this.children.add(i.nextNode()); ! } } *************** *** 60,64 **** return startTag; } ! public String toString() { StringBuffer childrenString = new StringBuffer(); --- 60,64 ---- return startTag; } ! public String toString() { StringBuffer childrenString = new StringBuffer(); Index: FormData.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/data/FormData.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** FormData.java 8 Sep 2003 02:26:30 -0000 1.26 --- FormData.java 10 Sep 2003 03:38:23 -0000 1.27 *************** *** 1,27 **** // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 1,27 ---- // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 37,41 **** private Vector formInputVector; private Vector textAreaVector; ! public FormData(String formURL, String formName, String formMethod, Vector formInputVector, Vector textAreaVector) { --- 37,41 ---- private Vector formInputVector; private Vector textAreaVector; ! public FormData(String formURL, String formName, String formMethod, Vector formInputVector, Vector textAreaVector) { Index: LinkData.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/data/LinkData.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** LinkData.java 8 Sep 2003 02:26:30 -0000 1.28 --- LinkData.java 10 Sep 2003 03:38:23 -0000 1.29 *************** *** 1,27 **** // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 1,27 ---- // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 35,39 **** private boolean mailLink; private boolean javascriptLink; ! public LinkData(String link,String linkText,String accessKey,boolean mailLink, boolean javascriptLink) { --- 35,39 ---- private boolean mailLink; private boolean javascriptLink; ! public LinkData(String link,String linkText,String accessKey,boolean mailLink, boolean javascriptLink) { Index: TagData.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/data/TagData.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** TagData.java 8 Sep 2003 02:26:30 -0000 1.29 --- TagData.java 10 Sep 2003 03:38:23 -0000 1.30 *************** *** 1,27 **** // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 1,27 ---- // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 38,50 **** private String urlBeingParsed; private boolean isXmlEndTag; ! public TagData(int tagBegin, int tagEnd, String tagContents,String tagLine) { this(tagBegin, tagEnd, 0, 0, tagContents, tagLine, "", false); } ! public TagData(int tagBegin, int tagEnd, String tagContents,String tagLine, String urlBeingParsed) { this(tagBegin, tagEnd, 0, 0, tagContents, tagLine, urlBeingParsed, false); } ! public TagData(int tagBegin, int tagEnd, int startLine, int endLine, String tagContents,String tagLine, String urlBeingParsed, boolean isXmlEndTag) { this.tagBegin = tagBegin; --- 38,50 ---- private String urlBeingParsed; private boolean isXmlEndTag; ! public TagData(int tagBegin, int tagEnd, String tagContents,String tagLine) { this(tagBegin, tagEnd, 0, 0, tagContents, tagLine, "", false); } ! public TagData(int tagBegin, int tagEnd, String tagContents,String tagLine, String urlBeingParsed) { this(tagBegin, tagEnd, 0, 0, tagContents, tagLine, urlBeingParsed, false); } ! public TagData(int tagBegin, int tagEnd, int startLine, int endLine, String tagContents,String tagLine, String urlBeingParsed, boolean isXmlEndTag) { this.tagBegin = tagBegin; *************** *** 53,61 **** this.endLine = endLine; this.tagContents = tagContents; ! this.tagLine = tagLine; this.urlBeingParsed = urlBeingParsed; this.isXmlEndTag = isXmlEndTag; } ! public int getTagBegin() { return tagBegin; --- 53,61 ---- this.endLine = endLine; this.tagContents = tagContents; ! this.tagLine = tagLine; this.urlBeingParsed = urlBeingParsed; this.isXmlEndTag = isXmlEndTag; } ! public int getTagBegin() { return tagBegin; *************** *** 85,89 **** this.urlBeingParsed = baseUrl; } ! public boolean isEmptyXmlTag() { return isXmlEndTag; --- 85,89 ---- this.urlBeingParsed = baseUrl; } ! public boolean isEmptyXmlTag() { return isXmlEndTag; *************** *** 94,98 **** * will only be valid for tags created with the * <code>CompositeTagScanner</code> or a subclass of it. ! */ public int getStartLine() { return startLine; --- 94,98 ---- * will only be valid for tags created with the * <code>CompositeTagScanner</code> or a subclass of it. ! */ public int getStartLine() { return startLine; *************** *** 103,110 **** * will only be valid for tags created with the * <code>CompositeTagScanner</code> or a subclass of it. ! */ public int getEndLine() { return endLine; } ! } --- 103,110 ---- * will only be valid for tags created with the * <code>CompositeTagScanner</code> or a subclass of it. ! */ public int getEndLine() { return endLine; } ! } |