Added if brackets to single statement if-blocks (#2617)

This commit is contained in:
Ekta Mishra 2020-05-13 23:42:23 +05:30 committed by GitHub
parent 825e687b0b
commit d6c5f5d35b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -41,7 +41,9 @@ public class CommonDescriptionScrutinizer extends DescriptionScrutinizer {
labels.addAll(update.getLabelsIfNew()); // merge labels.addAll(update.getLabelsIfNew()); // merge
for (MonolingualTextValue label : labels) { for (MonolingualTextValue label : labels) {
String labelText = label.getText(); String labelText = label.getText();
if (labelText == null) continue; if (labelText == null) {
continue;
}
labelText = labelText.trim(); labelText = labelText.trim();
if (labelText.equals(descText)) { if (labelText.equals(descText)) {
QAWarning issue = new QAWarning(descIdenticalWithLabel, null, QAWarning.Severity.WARNING, 1); QAWarning issue = new QAWarning(descIdenticalWithLabel, null, QAWarning.Severity.WARNING, 1);

View File

@ -1,6 +1,5 @@
package org.openrefine.wikidata.qa.scrutinizers; package org.openrefine.wikidata.qa.scrutinizers;
import org.openrefine.wikidata.qa.QAWarning;
import org.openrefine.wikidata.updates.ItemUpdate; import org.openrefine.wikidata.updates.ItemUpdate;
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue; import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
@ -17,9 +16,13 @@ public abstract class DescriptionScrutinizer extends EditScrutinizer {
descriptions.addAll(update.getDescriptionsIfNew()); // merge descriptions.addAll(update.getDescriptionsIfNew()); // merge
for (MonolingualTextValue description : descriptions) { for (MonolingualTextValue description : descriptions) {
String descText = description.getText(); String descText = description.getText();
if (descText == null) continue; if (descText == null) {
continue;
}
descText = descText.trim(); descText = descText.trim();
if (descText.length() == 0) continue; // avoid NullPointerException if (descText.length() == 0) {
continue; // avoid NullPointerException
}
scrutinize(update, descText, description.getLanguageCode()); scrutinize(update, descText, description.getLanguageCode());
} }

View File

@ -16,7 +16,9 @@ public class EnglishDescriptionScrutinizer extends DescriptionScrutinizer {
@Override @Override
public void scrutinize(ItemUpdate update, String descText, String lang) { public void scrutinize(ItemUpdate update, String descText, String lang) {
if (!LANG.equalsIgnoreCase(lang)) return; if (!LANG.equalsIgnoreCase(lang)) {
return;
}
checkPunctuationSign(update, descText); checkPunctuationSign(update, descText);
checkUppercase(update, descText); checkUppercase(update, descText);