Fix some CodeClimate issues

- Mostly missing Javadoc on methods & line length violations
This commit is contained in:
ljacqu
2019-11-03 10:54:43 +01:00
parent 2673eb0f8e
commit e31cb5bb9e
9 changed files with 83 additions and 71 deletions
@@ -2,9 +2,8 @@ package tools.docs.translations;
import ch.jalu.configme.resource.PropertyReader;
import ch.jalu.configme.resource.YamlFileReader;
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.message.MessageKey;
import tools.utils.ToolsConstants;
import fr.xephi.authme.message.MessagePathHelper;
import java.io.File;
import java.util.ArrayList;
@@ -12,13 +11,14 @@ import java.util.Comparator;
import java.util.List;
import static tools.utils.FileIoUtils.listFilesOrThrow;
import static tools.utils.ToolsConstants.MAIN_RESOURCES_ROOT;
/**
* Gathers all available translations of AuthMe.
*/
public class TranslationsGatherer {
private static final String MESSAGES_FOLDER = ToolsConstants.MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
private static final String MESSAGES_FOLDER = MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
private List<TranslationInfo> translationInfo = new ArrayList<>();
@@ -109,6 +109,12 @@ public class HelpTranslationVerifier {
return commandPaths;
}
/**
* Creates all paths of the properties that are used to define the help translation of the given command definition.
*
* @param command the command to create the paths for
* @return all yaml paths that can be used to translate the command
*/
private List<String> getYamlPaths(CommandDescription command) {
// e.g. commands.authme.register
String commandPath = "commands." + CommandUtils.constructParentList(command).stream()
@@ -1,13 +1,12 @@
package tools.messages;
import com.google.common.collect.Multimap;
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.util.StringUtils;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import tools.utils.ToolTask;
import tools.utils.ToolsConstants;
import java.io.File;
import java.util.ArrayList;
@@ -19,6 +18,7 @@ import java.util.Set;
import static fr.xephi.authme.message.MessagePathHelper.DEFAULT_MESSAGES_FILE;
import static tools.utils.FileIoUtils.listFilesOrThrow;
import static tools.utils.ToolsConstants.MAIN_RESOURCES_ROOT;
/**
* Task to verify the keys in the messages files.
@@ -26,7 +26,7 @@ import static tools.utils.FileIoUtils.listFilesOrThrow;
public final class VerifyMessagesTask implements ToolTask {
/** The folder containing the message files. */
private static final String MESSAGES_FOLDER = ToolsConstants.MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
private static final String MESSAGES_FOLDER = MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
@Override
public String getTaskName() {
@@ -47,13 +47,14 @@ public final class VerifyMessagesTask implements ToolTask {
if (StringUtils.isEmpty(inputFile)) {
messageFiles = getMessagesFiles();
} else {
File customFile = new File(ToolsConstants.MAIN_RESOURCES_ROOT, MessagePathHelper.createMessageFilePath(inputFile));
File customFile = new File(MAIN_RESOURCES_ROOT, MessagePathHelper.createMessageFilePath(inputFile));
messageFiles = Collections.singletonList(customFile);
}
FileConfiguration defaultFileConfiguration = null;
if (addMissingKeys) {
defaultFileConfiguration = YamlConfiguration.loadConfiguration(new File(ToolsConstants.MAIN_RESOURCES_ROOT, DEFAULT_MESSAGES_FILE));
defaultFileConfiguration = YamlConfiguration.loadConfiguration(
new File(MAIN_RESOURCES_ROOT, DEFAULT_MESSAGES_FILE));
}
// Verify the given files