阿里java代码规范IDEA添加插件

骑猪看日落 2022-04-11 10:52 466阅读 0赞

为了尽量自己写好代码,为了尽量团队代码风格统一,有一套可执行的规范是再好不过了,《阿里巴巴Java开发手册》对JAVA编码规范做了一个总结,并且把这个规范做成了一个很好用的IDEA插件,可以让我们的代码看上去更加舒适。

1.打开IDEA,点击File->Settings->Plugins

2.查找alibaba插件并安装,然后重启IDEA

安装alibaba

3.使用 : 右键项目->编码规约扫描

编码规约扫描

检查结果就有啦

在这里插入图片描述

另外还可以参考文件代码模板预设的变量自定义注释模板

  1. ${ PACKAGE_NAME} - the name of the target package where the new class or interface will be created.
  2. (将创建新类或接口的目标包的名称)
  3. ${ PROJECT_NAME} - the name of the current project.
  4. (当前项目的名称)
  5. ${ FILE_NAME} - the name of the PHP file that will be created.
  6. (将创建PHP文件的名称。)
  7. ${ NAME} - the name of the new file which you specify in the New File dialog box during the file creation.
  8. (在文件创建过程中在新文件对话框中指定的新文件的名称。)
  9. ${ USER} - the login name of the current user.
  10. (当前用户的登录名。)
  11. ${ DATE} - the current system date.
  12. (当前系统日期。)
  13. ${ TIME} - the current system time.
  14. (当前系统时间。)
  15. ${ YEAR} - the current year.
  16. (当前的年。)
  17. ${ MONTH} - the current month.
  18. (当前的月。)
  19. ${ DAY} - the current day of the month.
  20. (本月的今天。)
  21. ${ HOUR} - the current hour.
  22. (当前的小时。)
  23. ${ MINUTE} - the current minute.
  24. (当前的分钟)
  25. ${ PRODUCT_NAME} - the name of the IDE in which the file will be created.
  26. (将在其中创建文件的IDEA的名称。)
  27. ${ MONTH_NAME_SHORT} - the first 3 letters of the month name. Example: Jan, Feb, etc.
  28. (月份名称的前3个字母。例如:简、二月等。)
  29. ${ MONTH_NAME_FULL} - full name of a month. Example: January, February, etc.
  30. (一个月的全名。例如:一月、二月等。)

发表评论

表情:
评论列表 (有 0 条评论,466人围观)

还没有评论,来说两句吧...

相关阅读

    相关 IDEA安装阿里代码规范

    要养成一个好的编码习惯从自己编码开始,对自己代码的合理化命名,编码不仅对自己有好处,而且别人也容易读懂你的代码。 所以下载阿里的代码规范插件来约束自己凌乱的代码。 阿里规范