2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * Created by IntelliJ IDEA.
22 * To change template for new class use
23 * Code Style | Class Templates options (Tools | IDE Options).
25 package com
.intellij
.codeInspection
;
27 import com
.intellij
.openapi
.application
.ApplicationStarter
;
29 import java
.util
.Arrays
;
31 public class InspectionMain
implements ApplicationStarter
{
32 private InspectionApplication myApplication
;
34 public String
getCommandName() {
38 @SuppressWarnings({"HardCodedStringLiteral"})
39 public void premain(String
[] args
) {
40 if (args
.length
< 4) {
41 System
.err
.println("invalid args:" + Arrays
.toString(args
));
45 //System.setProperty("idea.load.plugins.category", "inspection");
46 myApplication
= new InspectionApplication();
48 myApplication
.myProjectPath
= args
[1];
49 myApplication
.myProfileName
= args
[2];
50 myApplication
.myOutPath
= args
[3];
53 for (int i
= 4; i
< args
.length
; i
++) {
55 if ("-d".equals(arg
)) {
56 myApplication
.mySourceDirectory
= args
[++i
];
58 else if ("-v0".equals(arg
)) {
59 myApplication
.setVerboseLevel(0);
61 else if ("-v1".equals(arg
)) {
62 myApplication
.setVerboseLevel(1);
64 else if ("-v2".equals(arg
)) {
65 myApplication
.setVerboseLevel(2);
67 else if ("-v3".equals(arg
)) {
68 myApplication
.setVerboseLevel(3);
70 else if ("-e".equals(arg
)){
71 myApplication
.myRunWithEditorSettings
= true;
73 else if ("-t".equals(arg
)) {
74 myApplication
.myErrorCodeRequired
= false;
77 System
.err
.println("unexpected argument: " + arg
);
82 catch (ArrayIndexOutOfBoundsException e
) {
87 myApplication
.myRunGlobalToolsOnly
= System
.getProperty("idea.no.local.inspections") != null;
90 public void main(String
[] args
) {
91 myApplication
.startup();
94 public static void printHelp() {
95 System
.out
.println(InspectionsBundle
.message("inspection.command.line.explanation"));