{"id":13427719,"url":"https://github.com/alibaba/p3c","last_synced_at":"2025-05-13T17:04:12.338Z","repository":{"id":37669428,"uuid":"95189138","full_name":"alibaba/p3c","owner":"alibaba","description":"Alibaba Java Coding Guidelines pmd implements and IDE plugin","archived":false,"fork":false,"pushed_at":"2024-08-06T08:22:02.000Z","size":27099,"stargazers_count":30628,"open_issues_count":188,"forks_count":8071,"subscribers_count":1305,"default_branch":"master","last_synced_at":"2025-05-06T16:12:46.350Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/alibaba/p3c/wiki","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alibaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-23T06:15:51.000Z","updated_at":"2025-05-06T08:23:00.000Z","dependencies_parsed_at":"2024-05-02T13:02:37.907Z","dependency_job_id":"63dc3f94-21b7-420a-958c-817c51662695","html_url":"https://github.com/alibaba/p3c","commit_stats":{"total_commits":225,"total_committers":43,"mean_commits":5.232558139534884,"dds":0.7288888888888889,"last_synced_commit":"6c59c8c36ecd8722c712d5685b8c3822c1c8b030"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fp3c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fp3c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fp3c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fp3c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alibaba","download_url":"https://codeload.github.com/alibaba/p3c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990456,"owners_count":21995773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T01:00:39.099Z","updated_at":"2025-05-13T17:04:12.307Z","avatar_url":"https://github.com/alibaba.png","language":"Kotlin","readme":"# P3C\n\n最新版本：黄山版（2022.2.3发布）\n\n[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\n\n## \u003cfont color=\"green\"\u003ePreface\u003c/font\u003e\n\u003e 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.\n \nFor more information please refer the *Alibaba Java Coding Guidelines*:\n- 中文版: 直接下载上方的PDF文件（黄山版）\n- English Version: *[Alibaba Java Coding Guidelines](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines)*\n\n## \u003cfont color=\"green\"\u003eIntroduction\u003c/font\u003e\nThe project consists of 3 parts:  \n- [PMD implementations](p3c-pmd)  \n- [IntelliJ IDEA plugin](idea-plugin)  \n- [Eclipse plugin](eclipse-plugin)   \n\n## \u003cfont color=\"green\"\u003eRules\u003c/font\u003e\n\u003cfont color=\"blue\"\u003eForty-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:\u003c/font\u003e  \n\n- ``[Mandatory]`` Using a deprecated class or method is prohibited.  \n   Note: For example, decode(String source, String encode) should be used instead of the deprecated method decode(String encodeStr). Once an interface has been deprecated, the interface provider has the obligation to provide a new one. At the same time, client programmers have the obligation to check out what its new implementation is.\n   \n- ``[Mandatory]`` An overridden method from an interface or abstract class must be marked with @Override annotation.\n   Counter example: For getObject() and get0bject(), the first one has a letter 'O', and the second one has a number '0'. To accurately determine whether the overriding is successful, an @Override annotation is necessary. Meanwhile, once the method signature in the abstract class is changed, the implementation class will report a compile-time error immediately.\n   \n- ``[Mandatory]`` A static field or method should be directly referred by its class name instead of its corresponding object name.\n\n- ``[Mandatory]`` The usage of hashCode and equals should follow:\n    1. Override hashCode if equals is overridden.\n    2. These two methods must be overridden for Set since they are used to ensure that no duplicate object will be inserted in Set.\n    3. These two methods must be overridden if self-defined object is used as the key of Map.\n   Note: String can be used as the key of Map since these two methods have been rewritten.\n\n","funding_links":[],"categories":["Libraries","Kotlin","代码扫描","大厂开源","开发运维工具","Kotlin (19)","Tool","代码规范","Java 程序设计","Projects","项目","Java","Projects List"],"sub_categories":["阿里开源","Common Utils/Code Quality","Vert.x","网络服务_其他","Code Analysis","代码分析","相关工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fp3c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibaba%2Fp3c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fp3c/lists"}