From dce027c709c2092e6a9fdeeeef33df6b37aff82f Mon Sep 17 00:00:00 2001 From: Hugo Queinnec Date: Fri, 23 Aug 2024 15:29:48 +0200 Subject: [PATCH] move reorganizer to mapper Signed-off-by: Hugo Queinnec --- .../reorganizer/JavaReorganizerRules.java | 12 ++++++------ .../ibm/mapper}/reorganizer/UsualPerformActions.java | 7 +++---- .../rules/AeadBlockCipherReorganizer.java | 2 +- .../rules/AsymmetricBlockCipherReorganizer.java | 6 +++--- .../reorganizer/rules/BlockCipherReorganizer.java | 2 +- .../rules/CipherParameterReorganizer.java | 4 ++-- .../mapper}/reorganizer/rules/MacReorganizer.java | 2 +- .../mapper}/reorganizer/rules/SignerReorganizer.java | 2 +- .../detection/asymmetric/DSA/PycaDSASignTest.java | 9 ++++----- 9 files changed, 22 insertions(+), 24 deletions(-) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/UsualPerformActions.java (98%) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/rules/AeadBlockCipherReorganizer.java (99%) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/rules/AsymmetricBlockCipherReorganizer.java (97%) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/rules/BlockCipherReorganizer.java (98%) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/rules/CipherParameterReorganizer.java (96%) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/rules/MacReorganizer.java (99%) rename {java/src/main/java/com/ibm/plugin/translation => mapper/src/main/java/com/ibm/mapper}/reorganizer/rules/SignerReorganizer.java (99%) diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/JavaReorganizerRules.java b/java/src/main/java/com/ibm/plugin/translation/reorganizer/JavaReorganizerRules.java index 2f1c3399..c759f2f9 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/JavaReorganizerRules.java +++ b/java/src/main/java/com/ibm/plugin/translation/reorganizer/JavaReorganizerRules.java @@ -20,12 +20,12 @@ package com.ibm.plugin.translation.reorganizer; import com.ibm.mapper.reorganizer.IReorganizerRule; -import com.ibm.plugin.translation.reorganizer.rules.AeadBlockCipherReorganizer; -import com.ibm.plugin.translation.reorganizer.rules.AsymmetricBlockCipherReorganizer; -import com.ibm.plugin.translation.reorganizer.rules.BlockCipherReorganizer; -import com.ibm.plugin.translation.reorganizer.rules.CipherParameterReorganizer; -import com.ibm.plugin.translation.reorganizer.rules.MacReorganizer; -import com.ibm.plugin.translation.reorganizer.rules.SignerReorganizer; +import com.ibm.mapper.reorganizer.rules.AeadBlockCipherReorganizer; +import com.ibm.mapper.reorganizer.rules.AsymmetricBlockCipherReorganizer; +import com.ibm.mapper.reorganizer.rules.BlockCipherReorganizer; +import com.ibm.mapper.reorganizer.rules.CipherParameterReorganizer; +import com.ibm.mapper.reorganizer.rules.MacReorganizer; +import com.ibm.mapper.reorganizer.rules.SignerReorganizer; import java.util.List; import java.util.stream.Stream; import javax.annotation.Nonnull; diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/UsualPerformActions.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/UsualPerformActions.java similarity index 98% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/UsualPerformActions.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/UsualPerformActions.java index 9ece2ac3..3a6f2b77 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/UsualPerformActions.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/UsualPerformActions.java @@ -17,16 +17,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer; +package com.ibm.mapper.reorganizer; import com.ibm.mapper.model.INode; import com.ibm.mapper.utils.Function3; -import org.jetbrains.annotations.NotNull; - -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * This class contains public static {@code Function3} implementing usual reorganization actions, diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/AeadBlockCipherReorganizer.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/AeadBlockCipherReorganizer.java similarity index 99% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/AeadBlockCipherReorganizer.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/rules/AeadBlockCipherReorganizer.java index 5a61a7a0..e085df9c 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/AeadBlockCipherReorganizer.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/AeadBlockCipherReorganizer.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer.rules; +package com.ibm.mapper.reorganizer.rules; import com.ibm.mapper.model.Algorithm; import com.ibm.mapper.model.AuthenticatedEncryption; diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/AsymmetricBlockCipherReorganizer.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/AsymmetricBlockCipherReorganizer.java similarity index 97% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/AsymmetricBlockCipherReorganizer.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/rules/AsymmetricBlockCipherReorganizer.java index 99984d9c..532ebd68 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/AsymmetricBlockCipherReorganizer.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/AsymmetricBlockCipherReorganizer.java @@ -17,8 +17,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer.rules; +package com.ibm.mapper.reorganizer.rules; +import com.ibm.mapper.ITranslator; import com.ibm.mapper.model.BlockCipher; import com.ibm.mapper.model.DigestSize; import com.ibm.mapper.model.INode; @@ -27,7 +28,6 @@ import com.ibm.mapper.model.padding.OAEP; import com.ibm.mapper.reorganizer.IReorganizerRule; import com.ibm.mapper.reorganizer.builder.ReorganizerRuleBuilder; -import com.ibm.plugin.translation.translator.JavaTranslator; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,7 +45,7 @@ private AsymmetricBlockCipherReorganizer() { new ReorganizerRuleBuilder() .createReorganizerRule() .forNodeKind(PublicKeyEncryption.class) - .forNodeValue(JavaTranslator.UNKNOWN) + .forNodeValue(ITranslator.UNKNOWN) .includingChildren( List.of( new ReorganizerRuleBuilder() diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/BlockCipherReorganizer.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/BlockCipherReorganizer.java similarity index 98% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/BlockCipherReorganizer.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/rules/BlockCipherReorganizer.java index c18f2c9c..9fee8683 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/BlockCipherReorganizer.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/BlockCipherReorganizer.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer.rules; +package com.ibm.mapper.reorganizer.rules; import com.ibm.mapper.model.Algorithm; import com.ibm.mapper.model.BlockCipher; diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/CipherParameterReorganizer.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/CipherParameterReorganizer.java similarity index 96% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/CipherParameterReorganizer.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/rules/CipherParameterReorganizer.java index 7f6d1a37..06c16e75 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/CipherParameterReorganizer.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/CipherParameterReorganizer.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer.rules; +package com.ibm.mapper.reorganizer.rules; import com.ibm.mapper.model.INode; import com.ibm.mapper.model.KeyLength; @@ -25,8 +25,8 @@ import com.ibm.mapper.model.functionality.Decrypt; import com.ibm.mapper.model.functionality.Encrypt; import com.ibm.mapper.reorganizer.IReorganizerRule; +import com.ibm.mapper.reorganizer.UsualPerformActions; import com.ibm.mapper.reorganizer.builder.ReorganizerRuleBuilder; -import com.ibm.plugin.translation.reorganizer.UsualPerformActions; import java.util.List; import javax.annotation.Nonnull; import org.jetbrains.annotations.Unmodifiable; diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/MacReorganizer.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/MacReorganizer.java similarity index 99% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/MacReorganizer.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/rules/MacReorganizer.java index cf52df3b..9589c07c 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/MacReorganizer.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/MacReorganizer.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer.rules; +package com.ibm.mapper.reorganizer.rules; import com.ibm.mapper.model.BlockCipher; import com.ibm.mapper.model.BlockSize; diff --git a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/SignerReorganizer.java b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/SignerReorganizer.java similarity index 99% rename from java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/SignerReorganizer.java rename to mapper/src/main/java/com/ibm/mapper/reorganizer/rules/SignerReorganizer.java index 3ae2f7ee..92ca70b1 100644 --- a/java/src/main/java/com/ibm/plugin/translation/reorganizer/rules/SignerReorganizer.java +++ b/mapper/src/main/java/com/ibm/mapper/reorganizer/rules/SignerReorganizer.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.ibm.plugin.translation.reorganizer.rules; +package com.ibm.mapper.reorganizer.rules; import com.ibm.mapper.reorganizer.IReorganizerRule; import java.util.List; diff --git a/python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DSA/PycaDSASignTest.java b/python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DSA/PycaDSASignTest.java index e7ae8116..32c5131c 100644 --- a/python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DSA/PycaDSASignTest.java +++ b/python/src/test/java/com/ibm/plugin/rules/detection/asymmetric/DSA/PycaDSASignTest.java @@ -19,6 +19,8 @@ */ package com.ibm.plugin.rules.detection.asymmetric.DSA; +import static org.assertj.core.api.Assertions.assertThat; + import com.ibm.engine.detection.DetectionStore; import com.ibm.engine.model.CipherAction; import com.ibm.engine.model.IValue; @@ -38,6 +40,8 @@ import com.ibm.mapper.model.functionality.KeyGeneration; import com.ibm.mapper.model.functionality.Sign; import com.ibm.plugin.TestBase; +import java.util.List; +import javax.annotation.Nonnull; import org.junit.Test; import org.sonar.plugins.python.api.PythonCheck; import org.sonar.plugins.python.api.PythonVisitorContext; @@ -45,11 +49,6 @@ import org.sonar.plugins.python.api.tree.Tree; import org.sonar.python.checks.utils.PythonCheckVerifier; -import javax.annotation.Nonnull; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - public class PycaDSASignTest extends TestBase { @Test