Recommend 4 personal collections of idea plug-ins! Help you write less bad code

JavaGuide 2020-11-13 10:05:14
recommend personal collections idea plug-ins


Current words , I (Guide Brother ) Is in Github Open source has two wheels , A simple RPC frame , A lightweight HTTP frame . The code structure is clear , Achieve elegance ( This boast is shameless ), Interested partners can have a look at .

When writing code , There are several IDEA Plug-ins are very effective for me to standardize my code and to do coding more efficiently .

So today, I will talk about the process of writing code , What are they? IDEA Plugins help me the most !

Codota: Code intelligence prompt

One of the plug-ins I've been using , It's very easy to use ( Many big guys around me usually write code and use this plug-in ).

Codota This plug-in is used for intelligent code completion , It's based on millions Java Program , Be able to prompt to complete the code according to the program context . Compared with IDEA In terms of the self-contained intelligent prompt ,Codota More comprehensive .

If you think IDEA Too many plug-ins are installed in the case of a carton , Never mind !Codota The plug-in also has a corresponding online website (https://www.codota.com/code), On this website, you can search relevant code examples according to code keywords , Very good !

I often use it in my work , To be honest, it really brought me a lot of convenience , For example, we search Files.readAllLines Related code , The search results are shown in the following figure :

in addition ,Codota The basic functions of plug-ins are free . Your code will not be leaked , You don't have to worry about that .

Take a simple look Codota Plug in the Sao operation !

Intelligent code completion

We use HttpUrlConnection It's really like to build a network connection :

Let's create the thread pool as follows :

It's just to demonstrate the power of this plug-in , This is not recommended for creating thread pools , Recommended ThreadPoolExecutor Constructor to create a thread pool . I'd like to introduce a plug-in of Alibaba -Alibaba Java Code Guidelines That's the problem , therefore ,Executors The bottom is marked with wavy lines .

Code intelligent search

except , Beyond the intelligent prompt when writing code . You can also select the code directly and search for relevant code samples .

Alibaba Java Code Guidelines: Alibaba Java Code specification

Alibaba Java Code specification , Corresponding Github The address is :https://github.com/alibaba/p3c . Very recommended installation !

After installation, it is recommended to replace the language with Chinese , More friendly tips .

According to the official description :

At present, this plug-in implements the 53 Bar rule , Mostly based on PMD Realization , Among them is 4 Rules based on IDEA Realization , And based on IDEA Inspection Real time detection function is realized . Some rules are implemented Quick Fix function , For available Quick Fix But not provided , We will achieve it as soon as possible , Also welcome interested students to join in and work together . At present, plug-in detection has two modes : real-time detection 、 Manual trigger .

The development manual mentioned above is Java Well known in the field of development 《 Alibaba Java Development Manual 》.

Manually configure detection rules

You can also manually configure related inspection The rules :

Use effect

This plug-in will detect in real time where our code doesn't match its rules , And it will give suggestions for modification . For example, if we create a thread pool in the following way , This plug-in will help us detect it , As shown in the figure below .

This can correspond to 《 Alibaba Java Development Manual 》 How to create thread pool in this book .

CheckStyle: Java Code format specification .

Why do I need CheckStyle plug-in unit ?

CheckStyle Almost Java A necessary plug-in for project development , It will help us check Java There are problems with the format of the code, such as whether the variable naming format is wrong 、 Is the length of a line of code too long, etc .

On the project , It is not reliable to standardize code format by self-restraint of project developers ! therefore , We need a tool like this to help us standardize the code format .

If you've seen the wheel I wrote , I can find that I have integrated for every project CheckStyle, And set up Git Commit hook , Make sure that there is no problem with the code format before submitting the code .

Guide The wheel made by brother The code is concise , The structure is clear , Welcome to learn , Welcome to perfect ):

  1. guide-rpc-framework :A custom RPC framework implemented by Netty+Kyro+Zookeeper.( Based on a Netty+Kyro+Zookeeper Implemented customization RPC frame - The detailed implementation process and related tutorials are attached )
  2. jsoncat : Imitation Spring Boot But it's different from Spring Boot A lightweight of HTTP frame

Git hook : Git Be able to perform certain important actions such as commit、push Trigger custom script when it happens . Hooks are stored in Git In the catalog hooks Subdirectory . In most projects .git/hooks .

How to be in Maven/Gradle Integration in the project Checksytle?

In general , We all integrate it into the project , And set the corresponding Git hook . There are corresponding articles on the Internet , There's not much to talk about here .

If you don't think the online article is intuitive , I can refer to the above mentioned two wheels :

  1. guide-rpc-framework :Maven Project integration Checksytle.
  2. jsoncat :Gradle Project integration Checksytle.

If you integrate Checksytle Words , Each test generates a HTML The format file tells you where the code format is not correct , It's not intuitive . adopt Checksytle Plug-ins can be very intuitive to show the format problems in the project .

If you just use it locally , I don't want to integrate... In the project Checksytle You can also , Just download one Checksytle Plug-ins are enough .

How to install ?

We are directly in the IDEA This plug-in can be found in the plug-in market . I've installed it here .

After installing the plug-in, restart IDEA, You will find it on the bottom menu bar CheckStyle 了 .

How to customize detection rules ?

If you need to customize code format detection rules , You can configure it as follows ( You can import the CheckStyle.xml file ).

Use effect

Once the configuration is complete , Use the plug-in as follows !

run-check-style

You can see it very clearly :CheckStyle Plug-ins have detected the format problems in the code in the project according to our custom rules .

SonarLint: Help you optimize your code

SonarLint Help you find bugs and bugs in your code , It's like a code spell checker ,SonarLint Can show the problem of the code in real time , And provide clear repair guidance , So that you can fix the code before you submit it .

also , Many projects have integrated SonarQube,SonarLint Can be very convenient with SonarQube Integrate .

My open source project recommends

  1. JavaGuide :「Java Study + Interview guide 」 One covers most Java The core knowledge that programmers need to master . Get ready Java interview , The preferred JavaGuide!
  2. guide-rpc-framework :A custom RPC framework implemented by Netty+Kyro+Zookeeper.( Based on a Netty+Kyro+Zookeeper Implemented customization RPC frame - The detailed implementation process and related tutorials are attached )
  3. jsoncat : Imitation Spring Boot But it's different from Spring Boot A lightweight of HTTP frame
  4. programmer-advancement : Programmers should have some good habits + Interview must know !
  5. springboot-guide :Not only Spring Boot but also important knowledge of Spring( It's not just SpringBoot also Spring Important knowledge points )
  6. awesome-java :Collection of awesome Java project on Github(Github It's great Java Open source project collection ).

I am a Guide Brother , One Java The backend development , A little bit of the front end , Free youth . See you next time ! Wechat search “JavaGuide” reply “ Interview shock ” Get what I've arranged 4 Original PDF

版权声明
本文为[JavaGuide]所创,转载请带上原文链接,感谢

  1. [front end -- JavaScript] knowledge point (IV) -- memory leakage in the project (I)
  2. This mechanism in JS
  3. Vue 3.0 source code learning 1 --- rendering process of components
  4. Learning the realization of canvas and simple drawing
  5. gin里获取http请求过来的参数
  6. vue3的新特性
  7. Get the parameters from HTTP request in gin
  8. New features of vue3
  9. vue-cli 引入腾讯地图(最新 api,rocketmq原理面试
  10. Vue 学习笔记(3,免费Java高级工程师学习资源
  11. Vue 学习笔记(2,Java编程视频教程
  12. Vue cli introduces Tencent maps (the latest API, rocketmq)
  13. Vue learning notes (3, free Java senior engineer learning resources)
  14. Vue learning notes (2, Java programming video tutorial)
  15. 【Vue】—props属性
  16. 【Vue】—创建组件
  17. [Vue] - props attribute
  18. [Vue] - create component
  19. 浅谈vue响应式原理及发布订阅模式和观察者模式
  20. On Vue responsive principle, publish subscribe mode and observer mode
  21. 浅谈vue响应式原理及发布订阅模式和观察者模式
  22. On Vue responsive principle, publish subscribe mode and observer mode
  23. Xiaobai can understand it. It only takes 4 steps to solve the problem of Vue keep alive cache component
  24. Publish, subscribe and observer of design patterns
  25. Summary of common content added in ES6 + (II)
  26. No.8 Vue element admin learning (III) vuex learning and login method analysis
  27. Write a mini webpack project construction tool
  28. Shopping cart (front-end static page preparation)
  29. Introduction to the fluent platform
  30. Webpack5 cache
  31. The difference between drop-down box select option and datalist
  32. CSS review (III)
  33. Node.js学习笔记【七】
  34. Node.js learning notes [VII]
  35. Vue Router根据后台数据加载不同的组件(思考->实现->不止于实现)
  36. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  37. 【JQuery框架,Java编程教程视频下载
  38. [jQuery framework, Java programming tutorial video download
  39. Vue Router根据后台数据加载不同的组件(思考->实现->不止于实现)
  40. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  41. 【Vue,阿里P8大佬亲自教你
  42. 【Vue基础知识总结 5,字节跳动算法工程师面试经验
  43. [Vue, Ali P8 teaches you personally
  44. [Vue basic knowledge summary 5. Interview experience of byte beating Algorithm Engineer
  45. 【问题记录】- 谷歌浏览器 Html生成PDF
  46. [problem record] - PDF generated by Google browser HTML
  47. 【问题记录】- 谷歌浏览器 Html生成PDF
  48. [problem record] - PDF generated by Google browser HTML
  49. 【JavaScript】查漏补缺 —数组中reduce()方法
  50. [JavaScript] leak checking and defect filling - reduce() method in array
  51. 【重识 HTML (3),350道Java面试真题分享
  52. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  53. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  54. [re recognize HTML (3) and share 350 real Java interview questions
  55. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  56. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  57. 【重识 HTML ,nginx面试题阿里
  58. 【重识 HTML (4),ELK原来这么简单
  59. [re recognize HTML, nginx interview questions]
  60. [re recognize HTML (4). Elk is so simple