Module rules

Source
Expand description

A module that contains the different rules that mutates a Lua block.

Modules§

bundle

Structs§

AppendTextComment
A rule to append a comment at the beginning or the end of each file.
ComputeExpression
A rule that compute expressions that do not have any side-effects.
Context
The intent of this struct is to hold data shared across all rules applied to a file.
ContextBuilder
ConvertIndexToField
A rule that converts index expression into field expression.
ConvertLocalFunctionToAssign
Convert local function statements into local assignements when the function is not recursive.
ConvertRequire
A rule that converts require calls between environments
FilterAfterEarlyReturn
A rule that removes statements that will never be executed because of an earlier return statement.
GroupLocalAssignment
Group local assign statements into one statement.
InjectGlobalValue
A rule to replace global variables with values.
RemoveAssertions
A rule that removes assert calls.
RemoveComments
A rule that removes comments associated with AST nodes.
RemoveCompoundAssignment
A rule that converts compound assignment (like +=) into regular assignments.
RemoveContinue
A rule that removes continue statements and converts them into break statements.
RemoveDebugProfiling
A rule that removes debug.profilebegin and debug.profileend calls.
RemoveEmptyDo
A rule that removes empty do statements.
RemoveFloorDivision
A rule that removes interpolated strings.
RemoveFunctionCallParens
A rule that removes parentheses when calling functions with a string or a table.
RemoveIfExpression
A rule that removes trailing nil in local assignments.
RemoveInterpolatedString
A rule that removes interpolated strings.
RemoveMethodDefinition
Change method functions into regular functions.
RemoveNilDeclaration
A rule that removes trailing nil in local assignments.
RemoveSpaces
A rule that removes whitespaces associated with AST nodes.
RemoveTypes
A rule that removes Luau types from all AST nodes.
RemoveUnusedIfBranch
A rule that removes unused if branches. It can also turn a if statement into a do block statement.
RemoveUnusedVariable
A rule that removes unused variables.
RemoveUnusedWhile
A rule that removes while statements with a known false condition.
RenameVariables
Rename all identifiers to small and meaningless names.
RobloxRequireMode

Enums§

RequireMode
RobloxIndexStyle
RuleConfigurationError
When implementing the configure method of the Rule trait, the method returns a result that uses this error type.
RulePropertyValue
In order to be able to weakly-type the properties of any rule, this enum makes it possible to easily use serde to gather the value associated with a property.

Constants§

APPEND_TEXT_COMMENT_RULE_NAME
COMPUTE_EXPRESSIONS_RULE_NAME
CONVERT_INDEX_TO_FIELD_RULE_NAME
CONVERT_LOCAL_FUNCTION_TO_ASSIGN_RULE_NAME
CONVERT_REQUIRE_RULE_NAME
FILTER_AFTER_EARLY_RETURN_RULE_NAME
GROUP_LOCAL_ASSIGNMENT_RULE_NAME
INJECT_GLOBAL_VALUE_RULE_NAME
REMOVE_ASSERTIONS_RULE_NAME
REMOVE_COMMENTS_RULE_NAME
REMOVE_COMPOUND_ASSIGNMENT_RULE_NAME
REMOVE_CONTINUE_RULE_NAME
REMOVE_DEBUG_PROFILING_RULE_NAME
REMOVE_EMPTY_DO_RULE_NAME
REMOVE_FLOOR_DIVISION_RULE_NAME
REMOVE_FUNCTION_CALL_PARENS_RULE_NAME
REMOVE_IF_EXPRESSION_RULE_NAME
REMOVE_INTERPOLATED_STRING_RULE_NAME
REMOVE_METHOD_DEFINITION_RULE_NAME
REMOVE_NIL_DECLARATION_RULE_NAME
REMOVE_SPACES_RULE_NAME
REMOVE_TYPES_RULE_NAME
REMOVE_UNUSED_IF_BRANCH_RULE_NAME
REMOVE_UNUSED_VARIABLE_RULE_NAME
REMOVE_UNUSED_WHILE_RULE_NAME
RENAME_VARIABLES_RULE_NAME

Traits§

FlawlessRule
Rule
Defines an interface that will be used to mutate blocks and how to serialize and deserialize the rule configuration.
RuleConfiguration

Functions§

get_all_rule_names
get_default_rules
A function to get the default rule stack for darklua. All the rules here must preserve all the functionalities of the original code after being applied. They must guarantee that the processed block will work as much as the original one.

Type Aliases§

RuleProcessResult
RuleProperties