Java编码风格 [英] Java coding style

查看:210
本文介绍了Java编码风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何保持自己的编码,以标准?有了StyleCop 并的为C#ReSharper的。是否有在Java代码中analisys任何工具/ Eclipse插件? ?您使用哪个人

How do you keep yourself coding to standards? There is stylecop and resharper for C#. Are there any tools/eclipse plugins for code analisys in Java? Which of them do you use?

推荐答案

  • Checkout http://checkstyle.sourceforge.net/.
  • Checkstyle的是一个开发工具,以帮助程序员编写坚持一个编码标准的Java代码。它自动检查Java代码饶这个无聊的(但很重要)的任务的人的过程。这使得它非常适合那些希望强制执行编码标准的项目。
    Checkstyle的是高度可配置,可为支持几乎所有的编码标准。示例配置文件提供支持Sun代码惯例。同样,其他示例配置文件是为其他知名约定提供。

    Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard. Checkstyle is highly configurable and can be made to support almost any coding standard. An example configuration file is supplied supporting the Sun Code Conventions. As well, other sample configuration files are supplied for other well known conventions.

    • PMD http://pmd.sourceforge.net/
    • PMD是集成与JDeveloper,Eclipse的,JEDIT,JBuilder中,BlueJ的,CodeGuide上,NetBeans /的Sun Java Studio企业版/造物主,IntelliJ IDEA的,TextPad,Maven的,蚂蚁,凝胶,JCreator中,和Emacs。

      PMD is integrated with JDeveloper, Eclipse, JEdit, JBuilder, BlueJ, CodeGuide, NetBeans/Sun Java Studio Enterprise/Creator, IntelliJ IDEA, TextPad, Maven, Ant, Gel, JCreator, and Emacs.


      • :// FindBugs的.sourceforge.net

      • Findbugs http://findbugs.sourceforge.net
      • FindBugs的使用静态分析来检查是否有漏洞的出现Java字节码图案。静态分析是指FindBugs的可以通过简单的检查程序的代码中找到的bug:执行程序是没有必要的。这使得FindBugs的非常容易使用:在一般情况下,你应该能够用它来寻找错误在你的代码下载它的几分钟之内。 FindBugs的工作原理是分析Java字节码(编译的类文件),所以你甚至不需要程序的源代码,使用它。由于它的分析是有时不准确的,FindBugs的可报告虚假警告,它们是不会有真正的错误警告。在实践中,通过FindBugs的报告的错误警告率小于50%的

        FindBugs uses static analysis to inspect Java bytecode for occurrences of bug patterns. Static analysis means that FindBugs can find bugs by simply inspecting a program's code: executing the program is not necessary. This makes FindBugs very easy to use: in general, you should be able to use it to look for bugs in your code within a few minutes of downloading it. FindBugs works by analyzing Java bytecode (compiled class files), so you don't even need the program's source code to use it. Because its analysis is sometimes imprecise, FindBugs can report false warnings, which are warnings that do not indicate real errors. In practice, the rate of false warnings reported by FindBugs is less than 50%.

        这篇关于Java编码风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆