From 918c6c1289243c4b35dcd98dfeb5796cd9fda7b1 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Fri, 17 Jan 2020 12:52:28 +0100 Subject: [PATCH] Fix code quality issues Per Codacy report at https://app.codacy.com/gh/bisq-network/bisq/pullRequest?prid=4835062 Note that the items claiming that bisq.common.config.Config.* is an unused import are false positives. These imports are in fact used in every case. --- common/src/main/java/bisq/common/crypto/CryptoUtils.java | 2 -- .../test/java/bisq/common/config/ConfigFileOptionTests.java | 2 -- core/src/main/java/bisq/core/btc/BitcoinModule.java | 3 +-- .../main/market/offerbook/OfferBookChartViewModelTest.java | 6 ------ p2p/src/main/java/bisq/network/p2p/P2PModule.java | 5 ++--- 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/bisq/common/crypto/CryptoUtils.java b/common/src/main/java/bisq/common/crypto/CryptoUtils.java index 18fd3d08b01..6d1a5c71aa0 100644 --- a/common/src/main/java/bisq/common/crypto/CryptoUtils.java +++ b/common/src/main/java/bisq/common/crypto/CryptoUtils.java @@ -17,8 +17,6 @@ package bisq.common.crypto; -import bisq.common.util.Utilities; - import javax.crypto.Cipher; import java.security.NoSuchAlgorithmException; diff --git a/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java b/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java index 9de1a81fbf1..55e88d4dce4 100644 --- a/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java +++ b/common/src/test/java/bisq/common/config/ConfigFileOptionTests.java @@ -1,11 +1,9 @@ package bisq.common.config; -import org.junit.Assert; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; public class ConfigFileOptionTests { diff --git a/core/src/main/java/bisq/core/btc/BitcoinModule.java b/core/src/main/java/bisq/core/btc/BitcoinModule.java index c99d24250ab..053f61c32d7 100644 --- a/core/src/main/java/bisq/core/btc/BitcoinModule.java +++ b/core/src/main/java/bisq/core/btc/BitcoinModule.java @@ -37,7 +37,6 @@ import com.google.inject.Singleton; import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; import java.io.File; @@ -83,7 +82,7 @@ protected void configure() { bindConstant().annotatedWith(named(Config.NUM_CONNECTIONS_FOR_BTC)).to(config.numConnectionsForBtc); bindConstant().annotatedWith(named(Config.USE_ALL_PROVIDED_NODES)).to(config.useAllProvidedNodes); bindConstant().annotatedWith(named(Config.IGNORE_LOCAL_BTC_NODE)).to(config.ignoreLocalBtcNode); - bindConstant().annotatedWith(Names.named(Config.SOCKS5_DISCOVER_MODE)).to(config.socks5DiscoverMode); + bindConstant().annotatedWith(named(Config.SOCKS5_DISCOVER_MODE)).to(config.socks5DiscoverMode); bind(new TypeLiteral>(){}).annotatedWith(named(PROVIDERS)).toInstance(config.providers); bind(AddressEntryList.class).in(Singleton.class); diff --git a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java index 943134ad2c4..00c8f7783fe 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java @@ -23,10 +23,6 @@ import bisq.core.locale.GlobalSettings; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.coin.CoinFormatter; -import bisq.core.util.coin.ImmutableCoinFormatter; - -import bisq.common.config.Config; import javafx.beans.property.SimpleIntegerProperty; @@ -49,8 +45,6 @@ public class OfferBookChartViewModelTest { - private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat()); - @Before public void setUp() { GlobalSettings.setDefaultTradeCurrency(usd); diff --git a/p2p/src/main/java/bisq/network/p2p/P2PModule.java b/p2p/src/main/java/bisq/network/p2p/P2PModule.java index 7f00ba60673..a0cf8370c38 100644 --- a/p2p/src/main/java/bisq/network/p2p/P2PModule.java +++ b/p2p/src/main/java/bisq/network/p2p/P2PModule.java @@ -37,7 +37,6 @@ import com.google.inject.Singleton; import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; import java.time.Clock; @@ -75,11 +74,11 @@ protected void configure() { requestStaticInjection(Connection.class); - bindConstant().annotatedWith(Names.named(USE_LOCALHOST_FOR_P2P)).to(config.useLocalhostForP2P); + bindConstant().annotatedWith(named(USE_LOCALHOST_FOR_P2P)).to(config.useLocalhostForP2P); bind(File.class).annotatedWith(named(TOR_DIR)).toInstance(config.torDir); - bind(int.class).annotatedWith(Names.named(NODE_PORT)).toInstance(config.nodePort); + bind(int.class).annotatedWith(named(NODE_PORT)).toInstance(config.nodePort); bindConstant().annotatedWith(named(MAX_CONNECTIONS)).to(config.maxConnections);