p3c README

The project's README from github.com/alibaba/p3c. As one markdown file: README.md.

P3C

最新版本:黄山版(2022.2.3发布)

License

Preface

We are pleased to present Alibaba Java Coding Guidelines which consolidates the best programming practices over the years from Alibaba Group's technical teams. A vast number of Java programming teams impose demanding requirements on code quality across projects as we encourage reuse and better understanding of each other's programs. We have seen many programming problems in the past. For example, defective database table structures and index designs may cause software architecture flaws and performance risks. Another example is confusing code structures being difficult to maintain. Furthermore, vulnerable code without authentication is prone to hackers’ attacks. To address these kinds of problems, we developed this document for Java developers at Alibaba.

For more information please refer the Alibaba Java Coding Guidelines:

Introduction

The project consists of 3 parts:

Rules

Forty-nine rules are realized based on PMD, please refer the P3C-PMD documentation for more detailed information. Four rules are implemented within IDE plugins (IDEA and Eclipse) as follows:

p3c (alibaba/p3c)

Searching Database…

30.9K ·GitHub
这是什么?阿里巴巴 Java 开发手册(P3C):从阿里巴巴集团各技术团队长期积累的最佳实践中提炼出来的 Java 编码规范,以 PMD 静态分析规则和 IDE 插件的形式提供。
我装的具体是什么——一套规则、一个库,还是一个应用?包含三部分:用于静态分析的 PMD 规则实现、一个 IntelliJ IDEA 插件和一个 Eclipse 插件——你既可以在分析流水线里跑检查,也可以直接在 IDE 里获得即时反馈。
我怎么把它跑起来?在 IntelliJ IDEA 或 Eclipse 里安装插件,或者把 P3C-PMD 规则集接入你的 PMD 运行;README 本身没有给出逐步的安装说明,而是让你参考 P3C-PMD 文档了解详情。
用之前我需要先准备什么?需要一个待分析的 Java 项目;走插件路线的话需要 IntelliJ IDEA 或 Eclipse,PMD 规则则可以在任何运行 PMD 的地方使用。README 里没有列出其他前置条件。
这些工具能强制执行手册里的全部内容吗?不能——工具化的覆盖只是其中一部分:PMD 实现了 49 条规则,另有 4 条规则只存在于 IDEA 和 Eclipse 插件中。手册里的其余内容都停留在文档本身,并没有落到工具里。
这个只适合阿里风格的代码库用吗?任何 Java 团队都可以用——阿里巴巴最初是为自己的开发人员编写的,但手册针对的是通用的 Java 质量问题,而不是阿里内部的特殊情况。
这些规则到底检查些什么?经典的 Java 坑:使用已废弃(deprecated)的类或方法、重写方法时没加 @Override 注解、通过实例调用静态成员,以及破坏 Set 元素或 Map 键的 hashCode/equals 约定。这些示例规则都标着【强制】——是硬性禁止,不是风格建议。
手册本身有英文版吗?有——最新的中文版提供可下载的 PDF(黄山版),同时也提供了英文版的 Alibaba Java Coding Guidelines。
这个项目更新得勤吗?最新的手册版本是黄山版,2022 年 2 月 3 日发布(2022.2.3)。
阿里巴巴为什么要做并开源这个?他们的团队反复踩同样的坑——数据库表和索引设计缺陷导致架构问题和性能风险、代码结构混乱、存在未做鉴权的易受攻击代码——于是把多年内部最佳实践沉淀成了一份统一的开发手册。
Creator
alibaba
Size
26.5 MB
Stars
30.9K
Updated
CommitMay 11
Age
9y
Commits · 90 Days