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

后端 未结 3 414
误落风尘
误落风尘 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:

    <component name="VcsManagerConfiguration">
        <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
        <option name="CHECK_NEW_TODO" value="false" />
    

    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 :)

    <component name="VcsManagerConfiguration">
        <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
        <option name="CHECK_NEW_TODO" value="false" />
    

    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

    0 讨论(0)
  • 2021-02-05 03:07

    Answer for IntelliJ IDEA 11.1.5:

    There are persistent check-boxes in the "Commit Changes" dialog. The next time you go to commit a changelist, uncheck the "Perform code analysis" and "Check TODO" check-boxes.

    If you want to just get it done now:

    • Make a non-invasive, 'test change' to a file; for example, add a test comment to any file
    • Right click on the changelist and select "Commit Changes..."
    • In the "Commit Changes" dialog, uncheck the "Perform code analysis" and "Check TODO" check-boxes
    • Click "Commit" to persist the settings. You can then undo the test comment and commit that.

    I can't find anyway to disable these checkboxes by default for new projects.

    0 讨论(0)
  • As of 2021 there is a cog next to the 'Amend' checkbox that allows you to turn off checks.

    0 讨论(0)
提交回复
热议问题