How to disable pre-commit code analysis for Git-backed projects using IntelliJ IDEA

后端 未结 3 416
误落风尘
误落风尘 2021-02-05 02:19

I have a project in IntelliJ IDEA, and I\'m using Git/GitHub as source control. Each time I try to commit changes, IntelliJ IDEA runs a lengthy code analysis and searches for TO

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 02:56

    The following is perhaps a simpler (albeit, a bit more hacky way) to do this. This involves making a simple edit to a file and, depending on the file you edit, result in the checkboxes being unchecked by default either for an existing project (A) or result in those checkboxes being disabled by default for ALL new projects (B).

    This has been tested on IntelliJ IDEA version 2016.3

    (A) Project Level Change

    (This should be used for existing projects, where you are sick of disabling either of the checkboxes for every commit.)

    To have those two check boxes disabled by default for a specific project, in .idea/workspace.xml add the following two options under the component called VcsManagerConfiguration:

    
        

    The option names are self-explanatory (the former is for disabling Perform Code Analysis and the latter for disabling Check TODO).

    Note that the effect is immediate. You don't have to restart IntelliJ IDEA or reopen the project



    (B) IDE Level change - Will affect all new projects

    (This should do that by default. The checkboxes will be disabled for any new projects.)

    If you make the same change, i.e. adding the two options as below to VcsManagerConfiguration, to the file project.default.xml (location of this file is detailed in the next section for the major OSes) then this will get inherited by ALL new projects and you will be rid of this annoyance for good until an update of IntelliJ IDEA changes how these settings are stored :)

    
        

    Location of project.default.xml

    (Based on Directories used by the IDE to store settings.) (I have only verified the OS X path. The remaining are based on the link above and are not verified.)

    Mac OS X: /Users/az/Library/Preferences/IntelliJIdea2016.3/options/project.default.xml

    Windows: c:\Users\John\.IntelliJIdea2016.3\config\options\project.default.xml

    Linux: ~/.IntelliJIdea2016.3/config/options/project.default.xml

提交回复
热议问题