IDEA-144520 (Extend default question words in BooleanMethodNameMustStartWithQuestion inspection)

This commit is contained in:
Bas Leijdekkers
2015-08-31 15:35:34 +02:00
parent 07f407ab9c
commit 637991005d
4 changed files with 52 additions and 3 deletions
@@ -43,8 +43,9 @@ public class BooleanMethodNameMustStartWithQuestionInspectionBase extends BaseIn
/**
* @noinspection PublicField
*/
@NonNls public String questionString = "is,can,has,should,could,will,shall,check,contains,equals,add,put,remove,startsWith,endsWith";List<String>
questionList = new ArrayList(32);
@NonNls public String questionString =
"add,are,can,check,contains,could,endsWith,equals,has,is,matches,must,put,remove,shall,should,startsWith,was,were,will,would";
List<String> questionList = new ArrayList(32);
public BooleanMethodNameMustStartWithQuestionInspectionBase() {
parseString(questionString, questionList);
@@ -40,7 +40,8 @@ public class NonBooleanMethodNameMayNotStartWithQuestionInspectionBase extends B
/**
* @noinspection PublicField
*/
@NonNls public String questionString = "is,can,has,should,could,will,shall,check,contains,equals,startsWith,endsWith";
@NonNls public String questionString =
"add,are,can,check,contains,could,endsWith,equals,has,is,matches,must,put,remove,shall,should,startsWith,was,were,will,would";
@SuppressWarnings({"PublicField"})
public boolean ignoreBooleanMethods = false;
@SuppressWarnings({"PublicField"})
@@ -0,0 +1,10 @@
class BooleanMethodNameMustStartWithQuestion {
public boolean areYouAllRight() {
return true;
}
public boolean <warning descr="Boolean method name 'setup' does not start with question word">setup</warning>() {
return false;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.siyeh.ig.naming;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
import junit.framework.TestCase;
import org.jetbrains.annotations.Nullable;
/**
* @author Bas Leijdekkers
*/
public class BooleanMethodNameMustStartWithQuestionInspectionTest extends LightInspectionTestCase {
public void testBooleanMethodNameMustStartWithQuestion() {
doTest();
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
return new BooleanMethodNameMustStartWithQuestionInspection();
}
}