我正在为课堂上的小组项目工作,我们正在尝试CheckStyle.
我对Java非常熟悉,但在此之前从未接触过JDBC或完成任何数据库工作.
我想知道是否有一种优雅的方法来避免prepareStatement调用中的幻数错误,请考虑:
        preparedStatement = connect.prepareStatement("INSERT INTO shows "
                + "(showid, showtitle, showinfo, genre, youtube)"
                + "values (default, ?, ?, ?, ?);");
        preparedStatement.setString(1, title);
        preparedStatement.setString(2, info);
        preparedStatement.setString(3, genre);
        preparedStatement.setString(4, youtube);
        result = preparedStatement.executeUpdate();
该方法了setString得到标记为神奇数字,到目前为止,我刚添加的数字3-10左右忽略列表为神奇数字,但我不知道是否有更好的方法去了解这些插入值到语句.我还恳求你看到任何其他的建议,我想避免发现任何讨厌的习惯,例如我应该使用Statement还是PreparedStatement?那会让我参考列名吗?那是理想的吗?等等...
谢谢!
有没有人在netbeans 7中使用checkstyle?我安装了插件,我选择了我的配置文件,但我没有看到任何错误或承诺的"注释".有什么建议?为了让它开始工作,我需要做些什么吗?我在插件菜单中激活了插件.
我可以看到一个Checkstyle信息,上面写着 - Wrong order for import, org.apache.log4j.Logger.我无法获得有关我为什么会这样做的信息.任何帮助,将不胜感激.以下是代码段 - 
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.Label;
import jxl.write.WritableCell;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import org.apache.log4j.Logger;
import com.company.department.team.test.Configuration;
我刚刚获得了一项新任务,看起来它将成为一项有趣的挑战.
客户希望为其内部(即将开源)编程语言开发代码样式检查工具,该编程语言在JVM上运行.语言语法非常像Java.
顾客基本上希望我生产像checkstyle这样的东西.
所以我的问题是,你将如何处理这个问题?鉴于一个清晰的平台,您会向客户提出哪些建议?
我想我有3个选择
从头开始写点东西.我宁愿不这样做,因为似乎这种代码分析工具问题已经解决了很多次,必须有一个更"框架"或"平台"的方法.
分叉现有的代码样式检查工具并修改解析以适应这种新语言等
扩展或插入现有的静态代码分析工具.(也许为Yasca写一个插件?)
如果问题重复,我们深表歉意。
实际上我正在寻找一个自动检查工具来识别:
我知道很少有工具可以用来完成这些事情,例如checkstyle和open javadoc check等。但是如果有更多可用的工具,我需要建议,如果有的话,哪一个更适合我的需要。
我一直在经历像pmd,findbuigs这样的代码分析器.它们涵盖了许多案例,似乎很好用.但想知道是否有专门针对gwt代码的代码分析器?
如何使用最新版本的gradle为Android项目设置PMD,Findbugs和Checkstyle静态代码分析工具?我尝试了几件事,但我没有设法使它们工作.
谢谢
在编译以下使用Lombok自动生成getter和setter的类时,Checkstyle会抛出一个编译错误:
实用程序类不应具有公共或默认构造函数
@Getter
@Setter
public class foo {
    private String type;
    private int value;
}
当Checkstyle不遵循checkstyle文档中指定的实用程序类定义时,为什么Checkstyle将上面的类分类为实用程序类?即仅包含静态方法或字段的类.checkstyle是解析默认的源文本文件还是lombok生成的源文件?
我面临以下问题.我已使用以下配置设置了checkstyle:
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>${checkstyle.plugin.version}</version>
            <inherited/>
            <configuration>
                <configLocation>${basedir}/checkstyle.xml</configLocation>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>
我跑的时候运行正常mvn site.但是,当我运行checkstyle mvn checkstyle:checkstyle以便更有效地获取XML报告时,checkstyle插件会失败以使用默认配置.当我将插件移动到<build>XML时,生成正确,但现在checkstyle报告不再包含在生成的站点中.
将报表插件设置为Checkstyle 的(当前)方式是什么,同时在相同配置下单独运行插件的能力是什么?
它真的是两次定义插件和配置的首选方式吗?
关于 SonarQube + Checkstyle 警告的小问题。
目前,在我的应用程序中,在我的 pom 中,我使用以下 Checkstyle 插件:
          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <outputFile>.out/reports/checkstyle/checkstyle-result.xml</outputFile>
                    <outputDirectory>target/reports/checkstyle</outputDirectory>
                    <outputFileFormat>xml</outputFileFormat>
                </configuration>
            </plugin>
这个插件正在完成它的工作,不用担心。
当我运行 SonarQube 时,我收到此警告
Old version of checkstyle detected. Consider updating to >= v8.30
For more information see: https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html
我显然去阅读了该网站,但我仍然很难理解。
我拥有的 Checkstyle 插件是最新的已知版本,版本 3.1.2,在 Maven 中心等上进行了检查。
在 SonarQube 中,我运行的是最新版本 8.9 LTS,以及最新版本的 Checkstyle 插件。
请问我缺少什么?我是否使用了某种错误的插件?