Moving Pattern to static constant
This commit is contained in:
1 parent
13ab94deff
commit
4609fc3f00
1 file changed
+3
-1
+3
-1
@@ -57,6 +57,8 @@ import com.google.common.collect.ListMultimap;
|
||||
*/
|
||||
public class ApexCRUDViolationRule extends AbstractApexRule {
|
||||
private static final Pattern VOID_OR_STRING_PATTERN = Pattern.compile("^(string|void)$", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern SELECT_FROM_PATTERN = Pattern.compile("^[\\S|\\s]+?FROM[\\s]+?(\\S+)",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private final HashMap<String, String> varToTypeMapping = new HashMap<>();
|
||||
private final ListMultimap<String, String> typeToDMLOperationMapping = ArrayListMultimap.create();
|
||||
@@ -543,7 +545,7 @@ public class ApexCRUDViolationRule extends AbstractApexRule {
|
||||
private String getTypeFromSOQLQuery(final ASTSoqlExpression node) {
|
||||
final String canonQuery = node.getNode().getCanonicalQuery();
|
||||
|
||||
Matcher m = Pattern.compile("^[\\S|\\s]+?FROM[\\s]+?(\\S+)", Pattern.CASE_INSENSITIVE).matcher(canonQuery);
|
||||
Matcher m = SELECT_FROM_PATTERN.matcher(canonQuery);
|
||||
while (m.find()) {
|
||||
return new StringBuffer().append(node.getNode().getDefiningType().getApexName()).append(":")
|
||||
.append(m.group(1)).toString();
|
||||
|
||||
Reference in new issue
Block a user