74

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 TODOs. When it finds "problems," it prompts me whether or not I want to review or commit.

I don't want the pre-commit code analysis to run, and I don't want IntelliJ IDEA to ask me about the results. I can't seem to find any setting in the regular IntelliJ IDEA project/IDE settings to disable this. How can I disable this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hawkeye Parker
  • 7,817
  • 7
  • 44
  • 47

6 Answers6

112

As of 2022-3 there is a cog next to the 'Amend' checkbox that allows you to turn off checks.

enter image description here

Interlated
  • 5,108
  • 6
  • 48
  • 79
65

This answer is outdated. Please see Interlated's answer for a more current answer.


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.

Hawkeye Parker
  • 7,817
  • 7
  • 44
  • 47
  • 8
    +1, this has been driving me nuts too. Sucks that there isn't a way to simply turn it off globally. I guess IntelliJ knows what's best for me, just like it knows how to indent my code more than I do. – Jack Leow Oct 27 '15 at 18:09
  • 2
    You can tell IntelliJ "exactly" how to format your code. It has defaults, but all can be overridden in the `Settings > Editor > Code Style` config options – TetraDev Oct 11 '16 at 17:04
  • 1
    For more recent versions of IDEA (without the Commit modal), check Interlated's answer. – Samuel Lindblom Dec 02 '21 at 12:31
17

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
  • This should be the accepted answer. I use the "Commit" view instead of "Changelists" and there is no way to disable it from it's UI :( – Jakub Bochenski Jan 20 '21 at 16:08
16

You can access the settings in PHPStorm through the following path

Settings -> Version Control -> Commit -> Before Commit

As shown below

enter image description here

0

Above the commit message on the commit screen there's a gear that lets you select what to do before making a comit.

Ftoy
  • 26
  • 6
0

Once you have added your commit message then click on the 3 dots above the commit message box. A dialog box will appear and you will able to select the checks before commit

intelliJ idea screenshot dialog box

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Shamsher
  • 1
  • 3