Update checkstyle config and CodeClimate exclusions

- Add new checkstyle checks: require Javadoc on large private methods, default in switch, declaration order & others
- Update path exclusions in CodeClimate config to match newly renamed classes (e.g. PHPBB -> PhpBB)
  - Create consistency check testing that excluded paths exist as classes
- Fix some trivial violations
This commit is contained in:
ljacqu
2017-03-23 10:34:28 +01:00
parent e77828b228
commit 32a664ef59
27 changed files with 185 additions and 93 deletions
@@ -25,18 +25,18 @@ public class EmailService {
private final File dataFolder;
private final String serverName;
private final Settings settings;
private final SendMailSSL sendMailSSL;
private final SendMailSsl sendMailSsl;
@Inject
EmailService(@DataFolder File dataFolder, Server server, Settings settings, SendMailSSL sendMailSSL) {
EmailService(@DataFolder File dataFolder, Server server, Settings settings, SendMailSsl sendMailSsl) {
this.dataFolder = dataFolder;
this.serverName = server.getServerName();
this.settings = settings;
this.sendMailSSL = sendMailSSL;
this.sendMailSsl = sendMailSsl;
}
public boolean hasAllInformation() {
return sendMailSSL.hasAllInformation();
return sendMailSsl.hasAllInformation();
}
@@ -56,7 +56,7 @@ public class EmailService {
HtmlEmail email;
try {
email = sendMailSSL.initializeMail(mailAddress);
email = sendMailSsl.initializeMail(mailAddress);
} catch (EmailException e) {
ConsoleLogger.logException("Failed to create email with the given settings:", e);
return false;
@@ -75,7 +75,7 @@ public class EmailService {
}
}
boolean couldSendEmail = sendMailSSL.sendEmail(mailText, email);
boolean couldSendEmail = sendMailSsl.sendEmail(mailText, email);
FileUtils.delete(file);
return couldSendEmail;
}
@@ -83,7 +83,7 @@ public class EmailService {
public boolean sendRecoveryCode(String name, String email, String code) {
HtmlEmail htmlEmail;
try {
htmlEmail = sendMailSSL.initializeMail(email);
htmlEmail = sendMailSsl.initializeMail(email);
} catch (EmailException e) {
ConsoleLogger.logException("Failed to create email for recovery code:", e);
return false;
@@ -91,7 +91,7 @@ public class EmailService {
String message = replaceTagsForRecoveryCodeMail(settings.getRecoveryCodeEmailMessage(),
name, code, settings.getProperty(SecuritySettings.RECOVERY_CODE_HOURS_VALID));
return sendMailSSL.sendEmail(message, htmlEmail);
return sendMailSsl.sendEmail(message, htmlEmail);
}
private File generateImage(String name, String newPass) throws IOException {
@@ -24,7 +24,7 @@ import static fr.xephi.authme.settings.properties.EmailSettings.MAIL_PASSWORD;
/**
* Sends emails to players on behalf of the server.
*/
public class SendMailSSL {
public class SendMailSsl {
@Inject
private Settings settings;
@@ -67,7 +67,7 @@ public class SendMailSSL {
}
public boolean sendEmail(String content, HtmlEmail email) {
Thread.currentThread().setContextClassLoader(SendMailSSL.class.getClassLoader());
Thread.currentThread().setContextClassLoader(SendMailSsl.class.getClassLoader());
// Issue #999: Prevent UnsupportedDataTypeException: no object DCH for MIME type multipart/alternative
// cf. http://stackoverflow.com/questions/21856211/unsupporteddatatypeexception-no-object-dch-for-mime-type
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();