From 99ef874327f815fe55949341c0e110866d13158b Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sat, 6 Jan 2018 11:48:27 +0100 Subject: [PATCH 1/2] Update CodeClimate configuration to new structure --- .codeclimate.yml | 72 +++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index cd84da5fd..84c6151de 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,31 +1,45 @@ -engines: - duplication: - enabled: true - config: - languages: - - java - - php +version: '2' # required to adjust maintainability checks + +plugins: checkstyle: enabled: true - channel: beta - config: '.checkstyle.xml' - pmd: - enabled: true - channel: beta - checks: - AvoidUsingHardCodedIP: - enabled: false -ratings: - paths: - # Check only production files - - 'src/main/java/**' -exclude_paths: -# Exclude code from third-party sources -- 'src/main/java/fr/xephi/authme/mail/OAuth2Provider.java' -- 'src/main/java/fr/xephi/authme/mail/OAuth2SaslClient.java' -- 'src/main/java/fr/xephi/authme/mail/OAuth2SaslClientFactory.java' -- 'src/main/java/fr/xephi/authme/security/crypts/BCryptService.java' -- 'src/main/java/fr/xephi/authme/security/crypts/PhpBB.java' -- 'src/main/java/fr/xephi/authme/security/crypts/Whirlpool.java' -- 'src/main/java/fr/xephi/authme/security/crypts/Wordpress.java' -- 'src/test/java/**Test.java' + config: + file: '.checkstyle.xml' + +checks: + # We disable all the following CodeClimate checks: Checkstyle already checks for these things and has the advantage + # that the Checkstyle config can also be used in one's IDE. + argument-count: + enabled: false + complex-logic: + enabled: false + file-lines: + enabled: false + method-complexity: + enabled: false + method-count: + enabled: false + method-lines: + enabled: false + nested-control-flow: + enabled: false + return-statements: + enabled: false + similar-code: + enabled: false + # The "identical-code" check would be cool to enable since Checkstyle offers no such functionality, but it is + # too aggressive and we'd have to suppress many reported warnings. + identical-code: + enabled: false + +exclude_patterns: + # Exclude code from third-party sources + - 'src/main/java/fr/xephi/authme/mail/OAuth2Provider.java' + - 'src/main/java/fr/xephi/authme/mail/OAuth2SaslClient.java' + - 'src/main/java/fr/xephi/authme/mail/OAuth2SaslClientFactory.java' + - 'src/main/java/fr/xephi/authme/security/crypts/BCryptService.java' + - 'src/main/java/fr/xephi/authme/security/crypts/PhpBB.java' + - 'src/main/java/fr/xephi/authme/security/crypts/Whirlpool.java' + - 'src/main/java/fr/xephi/authme/security/crypts/Wordpress.java' + # Don't check test classes + - 'src/test/java/**/*Test.java' From 94cf310d5b51479cd639f1ee425128044cd96e66 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sat, 6 Jan 2018 18:06:30 +0100 Subject: [PATCH 2/2] Minor: fix code climate config test --- src/test/java/fr/xephi/authme/CodeClimateConfigTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/fr/xephi/authme/CodeClimateConfigTest.java b/src/test/java/fr/xephi/authme/CodeClimateConfigTest.java index d69093b2b..7eff3a72d 100644 --- a/src/test/java/fr/xephi/authme/CodeClimateConfigTest.java +++ b/src/test/java/fr/xephi/authme/CodeClimateConfigTest.java @@ -24,7 +24,7 @@ public class CodeClimateConfigTest { public void shouldHaveExistingClassesInExclusions() { // given / when FileConfiguration configuration = YamlConfiguration.loadConfiguration(new File(CONFIG_FILE)); - List excludePaths = configuration.getStringList("exclude_paths"); + List excludePaths = configuration.getStringList("exclude_patterns"); // then assertThat(excludePaths, not(empty())); @@ -49,7 +49,7 @@ public class CodeClimateConfigTest { } private static void removeTestsExclusionOrThrow(List excludePaths) { - boolean wasRemoved = excludePaths.removeIf("src/test/java/**Test.java"::equals); + boolean wasRemoved = excludePaths.removeIf("src/test/java/**/*Test.java"::equals); assertThat("Expected an exclusion for test classes", wasRemoved, equalTo(true)); }