aboutsummaryrefslogtreecommitdiff
path: root/src/xdocs/idea.xml
blob: 1bfac2c10dc66a5bdb6535aad6482439748b6493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0" encoding="UTF-8"?>

<document xmlns="http://maven.apache.org/XDOC/2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

  <head>
    <title>Importing and debugging in IntelliJ IDE</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
    <script type="text/javascript" src="js/anchors.js"/>
    <script type="text/javascript" src="js/google-analytics.js"/>
    <link rel="icon" href="images/favicon.png" type="image/x-icon" />
    <link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
  </head>

  <body>
    <section name="Content">
      <macro name="toc">
        <param name="fromDepth" value="1"/>
        <param name="toDepth" value="1"/>
      </macro>
    </section>

    <section name="Import Checkstyle Project">
      <p>
        If no project is currently open in IntelliJ IDEA, click Import Project on the
        Welcome screen. Otherwise, select File > Import Project<br/><br/>
        <img alt="screenshot" src="images/gui_screenshot_importing_idea.png"/>
        <br/><br/>
        <img alt="screenshot" src="images/gui_screenshot_importing_idea1.png"/>
        <br/><br/>
        Then Next > Next > ... Until Finish.
      </p>
    </section>

    <section name="Debug">
      <p>
        Open the Check's source file by double click on it in a source tree as is shown:<br/><br/>
        <img alt="screenshot" src="images/gui_screenshot_select_check_idea.png"/>
        <br/><br/>
        Debug the Check by putting the breakpoint at controversial place (double-click)
        on the left part of line number as it is shown:<br/><br/>
        <img alt="screenshot" src="images/gui_screenshot_debug_idea.png"/>
        <br/><br/>
        Then right-click the corresponding Unit-test file or class definition > Debug
        &quot;testName&quot;<br/><br/>
        <img alt="screenshot" src="images/gui_screenshot_ut_select_idea.png"/>
        <br/><br/>
        Then manage you debug operations F8 (Step Over), Shift+F8 (Step Out),
        F7 (Step Into), Alt+F9 (Run to Cursor)
      </p>
    </section>

    <section name="Organize Imports">
      <p>
        One of the Checkstyle checks we run on our own code require certain order of import
        statements. Few changes in IDE settings are required to help your IDE do it automatically.<br/>
        To change formatter settings please go to File->Settings in menu.<br/>
        Then in the tree go to: Editor->Code Style->Java, open Import tab (follow numbers on a
        picture) and apply settings highlighted:<br/><br/>
        <img alt="Organize Imports settings in IDEA" src="images/gui_screenshot_organize_imports_idea.jpg"/>
        <br/>
      </p>
    </section>

    <section name="Inspections">
      <p>
        Checkstyle has its own very strict set of inspections. To import and enable them go to
        Settings -> Editor -> Inspections -> Manage -> Import... and locate file
        <code>config/intellij-idea-inspections.xml</code>.<br/><br/>
        <img alt="Inspections in IntelliJ IDEA" src="images/gui_screenshot_inspections_idea.png"/>
        <br/><br/>
        Not all files in repository should be analyzed. For example test input files contain numerous
        violations on purpose. Our shared inspection scope can be used to exclude such files.<br/>
        To add custom scope copy file <code>config/intellij-idea-inspection-scope.xml</code>
        to <code>.idea/scopes</code> directory. Now it should be ready to use in inspect code window:<br/><br/>
        <img alt="Scope for inspections" src="images/gui_screenshot_scope_idea.png"/>
      </p>
    </section>

  </body>
</document>