public RuleSet(RuleSet rs)
public static RuleSet forSingleRule(Rule rule)
Creates a new ruleset containing a single rule. The ruleset will have default description, name, and null file name.
rule
- The rule being created
public static RuleSet create(String name, String description, String fileName, Collection<Pattern> excludePatterns, Collection<Pattern> includePatterns, Iterable<? extends Rule> rules)
Note: The rule instances are shared between the collection and the new ruleset (copy-by-reference). This might lead to concurrency issues, if the rules of the collection are also referenced by other rulesets and used in different threads.
name
- the name of the ruleset
description
- the description
fileName
- the filename
excludePatterns
- list of exclude patterns
includePatterns
- list of include patterns, that override the exclude patterns
rules
- the collection with the rules to add to the new ruleset
NullPointerException
- If any parameter is null, or the collections contain null elements
public static RuleSet copy(RuleSet original)
Note: The rule instances are shared between the original and the new ruleset (copy-by-reference). This might lead to concurrency issues, if the original ruleset and the new ruleset are used in different threads.
original
- the original rule set to copy from
@Deprecated public List<String> getExcludePatterns()
public int size()
Returns the number of rules in this ruleset
public Collection<Rule> getRules()
Returns the actual Collection of rules in this ruleset
Rule
public Rule getRuleByName(String ruleName)
Returns the first Rule found with the given name (case-sensitive). Note: Since we support multiple languages, rule names are not expected to be unique within any specific ruleset.
ruleName
- the exact name of the rule to find
public boolean applies(File file)
Check if a given source file should be checked by rules in this RuleSet. A file should not be checked if there is an exclude
pattern which matches the file, unless there is an include
pattern which also matches the file. In other words, include
patterns override exclude
patterns.
file
- the source file to check
true
if the file should be checked, false
otherwise
@Deprecated @InternalApi public void start(RuleContext ctx)
Triggers that start lifecycle event on each rule in this ruleset. Some rules perform initialization tasks on start.
ctx
- the current context
@Deprecated @InternalApi public void apply(List<? extends Node> acuList, RuleContext ctx)
Executes the rules in this ruleset against each of the given nodes.
acuList
- the node list, usually the root nodes like compilation units
ctx
- the current context
@Deprecated @InternalApi public static boolean applies(Rule rule, LanguageVersion languageVersion)
Does the given Rule apply to the given LanguageVersion? If so, the Language must be the same and be between the minimum and maximums versions on the Rule.
rule
- The rule.
languageVersion
- The language version.
true
if the given rule matches the given language, which means, that the rule would be executed.
@Deprecated @InternalApi public void end(RuleContext ctx)
Triggers the end lifecycle event on each rule in the ruleset. Some rules perform a final summary calculation or cleanup in the end.
ctx
- the current context
public boolean equals(Object o)
Two rulesets are equals, if they have the same name and contain the same rules.
public String getFileName()
public String getName()
public String getDescription()
@Deprecated public List<String> getIncludePatterns()
public List<Pattern> getFileExclusions()
Returns the file exclusion patterns as an unmodifiable list.
public List<Pattern> getFileInclusions()
Returns the file inclusion patterns as an unmodifiable list.
@Deprecated public boolean usesDFA(Language language)
Does any Rule for the given Language use the DFA layer?
language
- The Language.
true
if a Rule for the Language uses the DFA layer, false
otherwise.
@Deprecated public boolean usesTypeResolution(Language language)
Does any Rule for the given Language use Type Resolution?
language
- The Language.
true
if a Rule for the Language uses Type Resolution, false
otherwise.
@Deprecated public boolean usesMultifile(Language language)
Does any Rule for the given Language use multi-file analysis?
language
- The Language.
true
if a Rule for the Language uses multi file analysis, false
otherwise.
@Deprecated @InternalApi public void removeDysfunctionalRules(Collection<Rule> collector)
Remove and collect any misconfigured rules.
collector
- the removed rules will be added to this collection
public long getChecksum()
Retrieves the current instance checksum
getChecksum
in interface ChecksumAware
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4