Issue #2031: 'ignoreMethods' option has been removed from DeclarationOrderCheck
This commit is contained in:
parent
a960c379bc
commit
aa581847fe
|
|
@ -53,7 +53,6 @@ import com.puppycrawl.tools.checkstyle.utils.ScopeUtils;
|
|||
* <ul>
|
||||
* <li>ignoreModifiers</li>
|
||||
* <li>ignoreConstructors</li>
|
||||
* <li>ignoreMethods</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
|
|
@ -109,12 +108,6 @@ public class DeclarationOrderCheck extends Check {
|
|||
*/
|
||||
public static final String MSG_CONSTRUCTOR = "declaration.order.constructor";
|
||||
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_METHOD = "declaration.order.method";
|
||||
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
|
|
@ -153,8 +146,6 @@ public class DeclarationOrderCheck extends Check {
|
|||
|
||||
/** If true, ignores the check to constructors. */
|
||||
private boolean ignoreConstructors;
|
||||
/** If true, ignore the check to methods. */
|
||||
private boolean ignoreMethods;
|
||||
/** If true, ignore the check to modifiers (fields, ...). */
|
||||
private boolean ignoreModifiers;
|
||||
|
||||
|
|
@ -193,7 +184,9 @@ public class DeclarationOrderCheck extends Check {
|
|||
break;
|
||||
case TokenTypes.METHOD_DEF:
|
||||
if (parentType == TokenTypes.OBJBLOCK) {
|
||||
processMethod(ast);
|
||||
final ScopeState state = scopeStates.peek();
|
||||
// nothing can be bigger than method's state
|
||||
state.currentScopeState = STATE_METHOD_DEF;
|
||||
}
|
||||
break;
|
||||
case TokenTypes.MODIFIERS:
|
||||
|
|
@ -224,23 +217,6 @@ public class DeclarationOrderCheck extends Check {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Method Token
|
||||
* @param ast method token AST
|
||||
*/
|
||||
private void processMethod(DetailAST ast) {
|
||||
|
||||
final ScopeState state = scopeStates.peek();
|
||||
if (state.currentScopeState > STATE_METHOD_DEF) {
|
||||
if (!ignoreMethods) {
|
||||
log(ast, MSG_METHOD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
state.currentScopeState = STATE_METHOD_DEF;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process modifiers
|
||||
* @param ast ast of Modifiers
|
||||
|
|
@ -295,14 +271,6 @@ public class DeclarationOrderCheck extends Check {
|
|||
this.ignoreConstructors = ignoreConstructors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to ignore methods.
|
||||
* @param ignoreMethods whether to ignore methods.
|
||||
*/
|
||||
public void setIgnoreMethods(boolean ignoreMethods) {
|
||||
this.ignoreMethods = ignoreMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to ignore modifiers.
|
||||
* @param ignoreModifiers whether to ignore modifiers.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ avoid.finalizer.method=Avoid using finalizer method.
|
|||
avoid.clone.method=Avoid using clone method.
|
||||
covariant.equals=covariant equals without overriding equals(java.lang.Object).
|
||||
declaration.order.constructor=Constructor definition in wrong order.
|
||||
declaration.order.method=Method definition in wrong order.
|
||||
declaration.order.static=Static variable definition in wrong order.
|
||||
declaration.order.instance=Instance variable definition in wrong order.
|
||||
declaration.order.access=Variable access definition in wrong order.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ avoid.finalizer.method=Die Verwendung von finalizer Methoden sollte vermieden we
|
|||
avoid.clone.method=Die Methode clone() sollte vermieden werden.
|
||||
covariant.equals=Kovariante Definition von equals() ohne equals(java.lang.Object) zu überschreiben.
|
||||
declaration.order.constructor=Konstruktordefinition in falscher Reihenfolge.
|
||||
declaration.order.method=Methodendefinition in falscher Reihenfolge.
|
||||
declaration.order.static=Statische Variablendefinition in falscher Reihenfolge.
|
||||
declaration.order.instance=Instanzvariablendefinition in falscher Reihenfolge.
|
||||
declaration.order.access=Fehlerhafte Deklarationsreihenfolge für diesen Scope.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ return.count=El número de sentencias return es {0,number,integer} (máximo perm
|
|||
illegal.type=La declaración de variables, valores de retorno o parámetros de tipo ''{0}'' no está permitida.
|
||||
|
||||
declaration.order.constructor=Definición de constructor en orden incorrecto.
|
||||
declaration.order.method=Definición de método en orden incorrecto.
|
||||
declaration.order.static=Definición de variable static en orden incorrecto.
|
||||
declaration.order.instance=Definición de variable de instancia en orden incorrecto.
|
||||
declaration.order.access=Definición de acceso a variable en orden incorrecto.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ return.count=Le nombre de return est de {0,number,integer} alors que le maximum
|
|||
illegal.type=Déclarer des variables, des valeurs de retour ou des paramètres de type ''{0}'' est interdit.
|
||||
|
||||
declaration.order.constructor=La définition des constructeurs n''apparait pas dans le bon ordre.
|
||||
declaration.order.method=La définition des méthodes n''apparait pas dans le bon ordre.
|
||||
declaration.order.static=La définition des variables statiques n''apparait pas dans le bon ordre.
|
||||
declaration.order.instance=La définition des variables d''instance n''apparait pas dans le bon ordre.
|
||||
declaration.order.access=La définition des variables n''est pas triée suivant leur portée.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ return.count=return が {0,number,integer} 個所あります(最大 {1,number
|
|||
illegal.type=''{0}'' 型の変数、戻り値、パラメータを宣言することは許可されていません。
|
||||
|
||||
declaration.order.constructor=コンストラクタの定義順序が間違っています。
|
||||
declaration.order.method=メソッドの定義順序が間違っています。
|
||||
declaration.order.static=static 変数の定義順序が間違っています。
|
||||
declaration.order.instance=インスタンス変数の定義順序が間違っています。
|
||||
declaration.order.access=変数アクセスの定義順序が間違っています。
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ covariant.equals=\"equals\" covariante sem implementar equals(java.lang.Object).
|
|||
declaration.order.access=Definição de acesso a variável em ordem errada.
|
||||
declaration.order.constructor=Definição de construtor em ordem errada.
|
||||
declaration.order.instance=Definição de variável de instância em ordem errada.
|
||||
declaration.order.method=Definição de método em ordem errada.
|
||||
declaration.order.static=Definição de variável estática em ordem errada.
|
||||
empty.statement=Declaração vazia.
|
||||
equals.noHashCode=Definição de ''equals()'' sem a definição de ''hashCode()''.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ covariant.equals = java.lang.Object sınıfının ''equals'' metodundan başka b
|
|||
declaration.order.access = Değişken, erişim seviyesine göre yanlış sırada tanımlanmış.
|
||||
declaration.order.constructor = ''constructor'' tanımı yanlış sırada yapılmış.
|
||||
declaration.order.instance = Değişken tanımı yanlış sırada yapılmış.
|
||||
declaration.order.method = Metot tanımı yanlış sırada yapılmış.
|
||||
declaration.order.static = ''static'' değişken tanımı yanlış sırada yapılmış.
|
||||
|
||||
default.comes.last = ''switch'' içerisindeki ''default'' ifadesi son durum olarak yer almalıdır.
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ public class DeclarationOrderCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(DeclarationOrderCheck.class);
|
||||
checkConfig.addAttribute("ignoreConstructors", "false");
|
||||
checkConfig.addAttribute("ignoreMethods", "true");
|
||||
checkConfig.addAttribute("ignoreModifiers", "true");
|
||||
|
||||
final String[] expected = {
|
||||
|
|
@ -93,7 +92,6 @@ public class DeclarationOrderCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(DeclarationOrderCheck.class);
|
||||
checkConfig.addAttribute("ignoreConstructors", "true");
|
||||
checkConfig.addAttribute("ignoreMethods", "true");
|
||||
checkConfig.addAttribute("ignoreModifiers", "false");
|
||||
|
||||
final String[] expected = {
|
||||
|
|
|
|||
|
|
@ -2082,12 +2082,6 @@ if ("something".equals(x))
|
|||
<td><a href="property_types.html#boolean">Boolean</a></td>
|
||||
<td><code>false</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ignoreMethods</td>
|
||||
<td>whether to ignore methods</td>
|
||||
<td><a href="property_types.html#boolean">Boolean</a></td>
|
||||
<td><code>false</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ignoreModifiers</td>
|
||||
<td>whether to ignore modifiers</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue