When we use IntelliJ IDEA to submit code to SVN or Git, IntelliJ IDEA provides a function to automatically analyze code, namely Perform code analysis :
As shown in the figure above, when we check Perform code analysis and click commit , IntelliJ IDEA will analyze and check the project's code before submitting the code, and display the check results in the form of errors and warnings:
As shown in the above figure, this is an example of the results of Code Analysis , which is No errors and 6 warnings . If we want to further view the results of Code Analysis , that is, the details of errors and warnings , you can click Review . After clicking Review , IntelliJ IDEA will show a series of specific classes and locations where errors and warnings occur, which will help us solve the problem.
Here, one thing that needs to be emphasized is: IntelliJ IDEA's Code Analysis mechanism is relatively sensitive. Even if we use the wrong label or comment in text annotation, the parameters of the method are inconsistent with the actual parameters, when Code Analysis is used, they will be given in the form of errors and warnings . Therefore, we often encounter this situation. Even if there are no errors (hints) in the code (at least it seems, it is not red), when we submit the code and perform Code Analysis , we will still receive a lot of errors and warnings, although these errors and warnings do not affect the operation of the code.
In addition, we can use IntelliJ IDEA's automation mechanism to perform some operations before and after submitting the code, such as checking:
Reformat code , format the code before submitting the code; Optimize imports , optimize the import package of the code before submitting the code; Upload files , upload the file after submitting the code. ...
Tips for removing Code analysis code analysis when Intellij IDEA submits code using git
By default, a git submission will show a prompt box for executing code analysis.
Actually, there is an option to remove this prompt in the previous step of the submission.
Just remove the checkmarks in front of the "Perform code analysis" and "Check TODO" check boxes.
IntelliJ IDEA has many features waiting for us to explore. The more we come into contact with, the more we can discover its elegance.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.