Detail the Code Analysis mechanism (Summary) before Code submission by IntelliJ IDEA, intellijanalysis
When we use IntelliJ IDEA to submit code to SVN or Git, IntelliJ IDEA provides an automatic code analysis function, that isPerform code analysis
:
As shown in, when we selectPerform code analysis
Clickcommit
IntelliJ IDEA analyzes and checks the project code before submitting the code, and displays the check results in the form of errors and Warnings:
As shown in, this isCode Analysis
IsNo errors and 6 warnings
. If you want to further viewCode Analysis
Result, that iserrors
Andwarnings
You can clickReview
, ClickReview
Then, IntelliJ IDEA will show a series of classes and positions for errors and warnings, which helps us solve the problem.
Here, we need to emphasize that:IntelliJ IDEACode Analysis
The Mechanism is sensitive. Even if an incorrect tag or method parameter is used in text commentsCode Analysis
In the form of errors and warnings.. Therefore, we often encounter this situation, even if there are no errors (prompts) in the Code (at least it looks like this, it is not so red), when we submit the code andCode Analysis
You will still receive a lot of errors and warnings, although these errors and warnings do not affect the code running.
In addition, you can use the automation mechanism of IntelliJ IDEA to execute some operations before and after code submission. For example, select:
Reformat code
Format the code before submitting the code;Optimize imports
, Optimize the code import package before submitting the Code;Upload files
, Submit the code and upload the file .......
Intellij IDEA removes the Code analysis prompt when submitting Code using git
By default, a prompt box is displayed for executing code analysis during git commit.
In fact, this prompt can be removed if you have the option in the previous step of submission.
Remove the Check boxes before "Perform code analysis" and "Check TODO.
IntelliJ IDEA has many other functions waiting for us to explore. The more we contact, the more we can find her elegance.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.