Class CommandDetector
- java.lang.Object
-
- org.sonar.iac.docker.checks.utils.CommandDetector
-
public class CommandDetector extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommandDetector.Builderstatic classCommandDetector.Command
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CommandDetector.Builderbuilder()List<ArgumentResolution>fullMatch(PredicateContext context)Process and reduce the stack of arguments.List<CommandDetector.Command>search(List<ArgumentResolution> resolvedArguments)A stack is formed on the basis of the arguments provided by a command instruction.
-
-
-
Method Detail
-
builder
public static CommandDetector.Builder builder()
-
search
public List<CommandDetector.Command> search(List<ArgumentResolution> resolvedArguments)
A stack is formed on the basis of the arguments provided by a command instruction. This stack is processed until there are no more usable elements. The foremost element is taken from the stack and checked to see if it matches the command to be searched for.
-
fullMatch
public List<ArgumentResolution> fullMatch(PredicateContext context)
Process and reduce the stack of arguments. Within the loop, which iterates over a stack of predicates, each argument from the stack is consumed and tested to see if the corresponding predicate is a match. Each consumed argument that matches is added to the list of arguments that will later form the suitable command. If a predicate is not optional and does not match, an empty list is returned. The method is then called again with a reduced argument stack until there are no more arguments on the stack. If a predicate can be applied multiple times to the argument stack, it is placed on the predicate stack again at the end of the loop.
-
-