From 2d86ad43eba7fd4b82289828f3cb54465e09f220 Mon Sep 17 00:00:00 2001 From: Maxime Daniel Date: Thu, 30 May 2024 09:12:03 +0200 Subject: [PATCH 1/2] docs: :memo: added compliant solution for parameterized regex --- .../src/main/rules/EC77/java/EC77.asciidoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc b/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc index 188b8f648..3295f32a8 100644 --- a/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc +++ b/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc @@ -51,3 +51,14 @@ public class ValidRegexPattern3 { } } ``` + +##Compliant Solution N°4 + +```java +public class ValidRegexPattern { + public boolean foo(String param) { + final Pattern pattern = Pattern.compile("foo" + param); // Compliant + return pattern.matcher("foo").find(); + } +} +``` \ No newline at end of file From 318cab33a2aaeb1e5e604e7fdd1b6868bea069f7 Mon Sep 17 00:00:00 2001 From: Luc Fouin Date: Thu, 30 May 2024 12:08:09 +0200 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Updating=20CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21a7ee4bb..727122867 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [#3](https://github.com/green-code-initiative/ecoCode-java/issues/3) Improvement: pattern declaration not only in a static way + ### Deleted ## [1.5.4] - 2024-05-24