# -------------------------------
# Ludtwig documentation
# -------------------------------

# To override any of the config values with environment variables use the following format:
# LUDTWIG_FORMAT__INDENTATION_COUNT=1

# To exclude any files / directories from ludtwig you can use `.ludtwig-ignore` files anywhere in the file tree
# These are evaluated just like .gitignore files (which are also considered by ludtwig!)

# Ludtwig does support directives as html and twig comments like
# <!-- ludtwig-ignore-file rule1, rule2, rule3 -->
# {# ludtwig-ignore-file rule1, rule2, rule3 #}

# Ignoring whole files from ludtwig is possible by adding the comment
# {# ludtwig-ignore-file #}
# on top of the file. You can also only ignore specific rules for a file with
# {# ludtwig-ignore-file indentation, twig-block-line-breaks #}

# Ignoring specific errors / warnings is possible by adding the comment
# {# ludtwig-ignore #}
# or
# {# ludtwig-ignore twig-block-name-snake-case #}
# before the problematic element.
# This will ignore also all children (the whole next SyntaxNode)!

# -------------------------------
# Ludtwig configuration
version = "0.13.0"
# -------------------------------
[general]
active-rules = [
    "ludtwig-ignore-file-not-on-top",
    "whitespace-between-line-breaks",
    "line-ending",
#    "indentation",
    "twig-block-line-breaks",
    "twig-block-name-snake-case",
    "html-attribute-name-kebab-case",
    "twig-logic-and",
    "twig-logic-or",
    "twig-string-quotation",
    "html-string-quotation",
    "twig-hash-key-no-quotes",
    "twig-prefer-shopware-extends",
    "twig-block-duplicate",
    "twig-json-encode-escape-js",
    "html-duplicate-id",
    "twig-variable-definition-naming",
    "twig-valid-filter",
    "twig-valid-test",
    "twig-valid-function",
# maybe activate in the future? these are okay because shopware extends the twig syntax
#    "twig-use-is-same-as",
#    "twig-use-is-not-same-as",
]

[format]
# How should the line endings look like? ["unix_LF", "windows_CRLF"]
# unix_LF is a single '\n' character
# windows_CRLF are the characters '\r\n'
# checked by the 'line-ending' rule
line-ending = "unix_LF"

# Which character should be used for indentation ["space", "tab"]
# checked by the 'indentation' rule
indentation-mode = "space"
# How many times should this character be printed for one indentation [0-255]
# checked by the 'indentation' rule
indentation-count = 4
# Should the children of twig blocks be indented? [true, false]
# checked by the 'indentation' rule
indent-children-of-blocks = true

# Should twig blocks have empty lines around them? [true, false]
# checked by the 'twig-block-line-breaks' rule
linebreaks-around-blocks = true

# How twig strings should be quotated? ["single", "double"]
# checked by the 'twig-string-quotation' rule
twig-quotation = "single"

# How html attribute strings should be quotated? ["single", "double"]
# checked by the 'html-string-quotation' rule
html-quotation = "double"

[twig]
# Valid twig filters that are allowed to be used.
# checked by the 'twig-valid-filter' rule
# Reference: https://twig.symfony.com/doc/3.x/filters/index.html
valid-filters = [
    # Twig 3.x built-in filters
    "abs",
    "batch",
    "capitalize",
    "column",
    "convert_encoding",
    "country_name",
    "currency_name",
    "currency_symbol",
    "data_uri",
    "date",
    "date_modify",
    "default",
    "escape",
    "e",
    "filter",
    "find",
    "first",
    "format",
    "format_currency",
    "format_date",
    "format_datetime",
    "format_number",
    "format_time",
    "html_attr_merge",
    "html_attr_type",
    "html_to_markdown",
    "inline_css",
    "inky_to_html",
    "invoke",
    "join",
    "json_encode",
    "keys",
    "language_name",
    "last",
    "length",
    "locale_name",
    "lower",
    "map",
    "markdown_to_html",
    "merge",
    "nl2br",
    "number_format",
    "plural",
    "raw",
    "reduce",
    "replace",
    "reverse",
    "round",
    "shuffle",
    "singular",
    "slice",
    "slug",
    "sort",
    "spaceless",
    "split",
    "striptags",
    "timezone_name",
    "title",
    "trim",
    "u",
    "upper",
    "url_encode",
    # Symfony Twig extensions (uncomment as needed)
    "humanize",
    "trans",
    "sanitize_html",
    "yaml_encode",
    "yaml_dump",
    "abbr_class",
    "abbr_method",
    "format_args",
    "format_args_as_text",
    "file_excerpt",
    "format_file",
    "format_file_from_text",
    "file_link",
    "file_relative",
    "serialize",
    "emojify",
    # Shopware specific filters (uncomment as needed)
    "sw_sanitize",
    "sw_encode_url",
    "sw_encode_media_url",
    "sw_convert_unit",
    "sw_icon_cache",
    "currency",
    "decodeIdnEmail",
    "encodeIdnEmail",
    "remove_leading_spaces",
    "replace_recursive",
    "preg_replace",
    "intval",
    "floatval",
    "strval",
    "boolval",
    "md5",
]

# Valid twig tests that are allowed to be used with the `is` operator.
# checked by the 'twig-valid-test' rule
# Reference: https://twig.symfony.com/doc/3.x/tests/index.html
valid-tests = [
    # Twig 3.x built-in tests
    "constant",
    "defined",
    "divisible by",
    "empty",
    "even",
    "iterable",
    "mapping",
    "null",
    "none",
    "odd",
    "same as",
    "sequence",
    # Symfony Twig extensions (uncomment as needed)
    "selectedchoice",
    "rootform",
    # Shopware specific tests (uncomment as needed)
    "instanceof",
    "true",
    "false",
    "array",
    "bool",
    "boolean",
    "callable",
    "float",
    "int",
    "integer",
    "object",
    "scalar",
    "string",
]

# Valid twig top-level standalone functions.
# checked by the 'twig-valid-function' rule
# Reference: https://twig.symfony.com/doc/3.x/functions/index.html
valid-functions = [
    # Twig 3.x built-in functions
    "attribute",
    "block",
    "constant",
    "country_names",
    "country_timezones",
    "currency_names",
    "cycle",
    "date",
    "dump",
    "enum",
    "enum_cases",
    "html_attr",
    "html_classes",
    "html_cva",
    "include",
    "language_names",
    "locale_names",
    "max",
    "min",
    "parent",
    "random",
    "range",
    "script_names",
    "source",
    "template_from_string",
    "timezone_names",
    # Symfony Twig extensions (uncomment as needed)
    "render",
    "render_esi",
    "fragment_uri",
    "controller",
    "asset",
    "asset_version",
    "csrf_token",
    "is_granted",
    "is_granted_for_user",
    "logout_path",
    "logout_url",
    "path",
    "url",
    "absolute_url",
    "relative_path",
    "expression",
    "impersonation_path",
    "impersonation_url",
    "impersonation_exit_path",
    "impersonation_exit_url",
    "t",
    "importmap",
    "form",
    "form_start",
    "form_end",
    "form_widget",
    "form_errors",
    "form_label",
    "form_help",
    "form_row",
    "form_rest",
    "field_name",
    "field_id",
    "field_value",
    "field_label",
    "field_help",
    "field_errors",
    "field_choices",
    # Shopware specific functions (uncomment as needed)
    "seoUrl",
    "rawUrl",
    "compare",
    "feature",
    "getAllFeatures",
    "searchMedia",
    "sw_breadcrumb_full",
    "sw_breadcrumb_full_by_id",
    "category_url",
    "category_linknewtab",
    "inAppPurchase",
    "allInAppPurchases",
    "sw_block",
    "sw_source",
    "sw_include",
    "config",
    "theme_config",
    "theme_scripts",
    "component_import_map",
    "sw_icon_cache_enable",
    "sw_icon_cache_disable",
    "preg_match",
    "array",
    "version_compare",
]
