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

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

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

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

安装alibaba

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

编码规约扫描

检查结果就有啦

在这里插入图片描述

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

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

猜你喜欢

转载自blog.csdn.net/sinat_42338962/article/details/84842571