Inspection 代码检查
    
在设置目录中,editor –> inspections用来配置各种代码检查以及警告。
- 
      
 开启import *提示
 
 
 editor –> inspections –> java –> imports
 
 勾选
 
 * import
 
- 
      
 工具类必须为final、不能含有public构造方法、必须有private构造方法
 
 
 editor –> inspections –> java –> class structure
 
 勾选
 
 utility class is not final
 
 
 勾选
 
 utility class with public constructor
 
 
 勾选
 
 utility class without private constructor
 
- 
      
 equals()与hashCode()方法必须成对出现
 
 
 editor –> inspections –> java –> probable bugs
 
 勾选
 
 equals and hashcode() not paired
 
- 
      
 可序列化类没有声明serialVersionUID
 
 
 editor –> inspections –> java –> Serialization issue
 
 勾选
 
 Serializable class without 'serialVersionUID'
 
     
     
     Code Style 代码风格
    
- 
      
 else新起一行
 
 
 editor –> code style –> java –> if() statement
 
 勾选
 
 else on new line
 
 
 
 force brace
 
 选择
 
 always
 
- 
      
 方法参数过长自动换行
 
 
 editor –> code style –> java –> method declaration
 
 
 parameters
 
 选择
 
 wrap if long
 
- 
      
 禁用import *
 
 
 editor –> code style –> java –> imports
 
 
 class count to use import with *
 
 填写
 
 500
 
 
 
 names count to use static import with *
 
 填写
 
 500
 
- 
      
 配置import顺序
 
 
 editor –> code style –> java –> imports –> import layout
 
 
 参考链接(stackoverflow.com)
 
     
     
     IDE配置
    
- 
      
 自动import
 
 
 editor –> general –> auto import
 
 勾选
 
 optimize imports on the fly
 
 
 勾选
 
 add unambiguous imports on the fly
 
- 
      
 编辑器显示行号
 
 
 editor –> general –> apperance
 
 勾选
 
 show line numbers
 
- 
      
 自动补全main函数
 
 
 editor –> live templates –> other
 
 右侧点击加号,如下图配置
 
 
  
 
- 
      
 去掉新文件自动添加的created by注释
 
 
 editor –> file and code templates
 
 找到需要修改的模板,按图中所示,将红框内内容替换为空行
 
 
  
 
- 
      
 版本控制显示修改文件及目录
 
 
 version control
 
 勾选
 
 show directories with changed descendants
 
 
版权声明:本文为gaodebao1原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
