Code Monkey home page Code Monkey logo

p3c's Issues

第9页 (五)集合处理 第4条规范描述不够精确

default

如图,“下标为[ list.size() ]的数组元素将被置为 null”,该描述不够精确。

Java Doc中的描述为“If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null.)

修改为“下标为从list.size()至数组末尾的全部元素将被置为 null”是不是更合适些呢?

可以提供一份规范化的简单易懂的dome吗?

包含对用户进行简单的增删改查, 完整的单元测试,以及相关的说明.以及如何利用云效平台,做代码开发跟相关测试工作,我可以这段时间可以出一个简单的dome,希望阿里的人给与指正下.共同出一份在云效平台上面使用的帮助说明.谢谢,麻烦你们的,这个要求很无理,但希望得到你们的支持跟帮助.

更改类名后,双击“代码扫描建议”无法定位到对应的类

举一个case:
p3c扫描出如下问题:抽象类Service没有以Abstract或者Base打头命名。我修改了类名为:AbstractService,这时候再次点击“代码扫描建议”不能定位到对应的类。体验不是很好。
建议:在开发者修改了代码之后,立即触发对该类的重新扫描,并自动清理已经修复的问题描述。

希望有风格设置文件

手动遵守不如在IDE设置好,我按着这个规约和谷歌HTML CSS双空格等规范设置了一个,不过总觉得没有官方出的好,希望官方出设置导出文件。

提示框显示文字为方框

展开提示(ctrl + f1)里的文字正常显示
请问是环境的原因吗?
(Android Studio 3.0 beta 7, Ubuntu 17.04)

eclipse无法自定义生效条目以及类名保留关键字

用IDEA可以选择某一条条规则不生效或修改级别, 但eclipse里面只能看到条目, 无法设置单条是否生效以及调整级别

另外关于类名大驼峰的检查, 有一些领域模型的保留字, 希望这部分可以自定义添加保留字, 情景比如 : 在类名的命名上会加入公司名的缩写, 这个缩写都是全大写的

关于包名的一个疑问

命名风格第九条是这样说的

  1. 【强制】包名统一使用小写,点分隔符之间有且仅有一个自然语义的英语单词。包名统一使用单数形式,但是类名如果有复数含义,类名可以使用复数形式。

但是常量定义第4条是这样说的

  1. 【推荐】常量的复用层次有五层:跨应用共享常量、应用内共享常量、子工程内共享常量、包内共享常量、类内共享常量。 1) 跨应用共享常量:放置在二方库中,通常是client.jar中的constant目录下。 2) 应用内共享常量:放置在一方库中,通常是modules中的constant目录下。

请问这个modules是指包名吗?

关于注解内常量的检查

@interface 中写的 常量,本身默认含有 public static final 修饰,命名按照常量规范命名,但是规约插件检测为变量,提示 不符合 lowerCamelCase 命名规范

关于System.out.println与e.printStackTrace();一类问题

Noncompliant Code Example
System.out.println("My Message"); // Noncompliant
Compliant Solution
logger.log("My Message");

Noncompliant Code Example
try {
/* ... /
} catch(Exception e) {
e.printStackTrace(); // Noncompliant
}
Compliant Solution
try {
/
... */
} catch(Exception e) {
LOGGER.log("context", e);
}

昨天简单实用了下插件,提交的小建议,参照sonarlint

(一) 命名风格 #13

尽量不要在接口里定义变量,如果一定要定义变量,肯定是与接口方法相关,并且是整个应用的基础常量。 这句话有歧义,既然已经说是变量(variable)了,怎么能是基础常量(constant)呢?

Eclipse扫描结束后卡死

Eclipse版本:Version: Neon.2 Release (4.6.2)
JDK:1.8

使用Eclipse扫描结束后,打开扫描结果直接卡死。改用IDEA后一直正常!
其他人是否有类似情况?

孤尽的花名打错了

电子工业版本社也将在一年后出版孤 参与编写的“码出高效 - 阿里巴巴的Java开发手册详解”这本书。

孤->孤尽

期望支持:rule可配置特性

规范很细,但是各个公司对于规范的落地细节不一样,有些细则可以选择忽略,期望支持:rule可配置特性。让使用者选择性地使用rule 。

插件扫描时能否排除一些包?

例如一些生成的代码,扫描后一大堆问题...
protobuf 生成的检测出来的问题相当多...还有部分mybatis生成的代码~

能否有个功能排除掉部分包?

还有些是第三方规定的package路径,里面有大写只有一个包名的情况.

关于使用interface来定义常量

《Effective Java》中写到过

The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class’s exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface.

package com.alibaba.p3c.idea;下面的两个Constants常量就使用了interface来定义常量,如何看待此类问题?

[Suggestion] allow add custom item to CLASS_NAMING_WHITE_LIST

Problem

Some class names that contains IOS,GUI will not match upperCamelCase pattern.
Hope to allow add custom item to CLASS_NAMING_WHITE_LIST.

p3c/p3c-pmd/src/main/resources/namelist.properties

...
ClassNamingShouldBeCamelRule_CLASS_NAMING_WHITE_LIST=["Hbase","HBase","ID"]

Suggestion

  • Allow add a custom properties file under project root to add custom item

一(五)#7中的反例代码有bug

应该修改为如下:

        List<String> list = new ArrayList<String>();
        list.add("1");
        list.add("2");
        for (String item : list) {
            if ("1".equals(item)) {
                list.remove(item);
            }
        }

中文无法显示

插件安装之后,菜单中的中文无法显示,尝试更换字体无效!

关于Java开发规约插件

手册中提到的Java开发规约插件是基于IDE的吗,支持哪些IDE呢?
在此感谢阿里Java技术团队对Java项目的工程性和规范性进行了非常有价值的提炼,帮助国内Java相关从业者和团队不断进步。

不支持单个工程校验的?

Myeclipse 2017 进行工程校验的时候,结果是一直累积上去的 , 之前工程的结果一直在缓存在列表中。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.