Skip to content

format: files() sort order doesn't match style guide #14997

@bgilbert

Description

@bgilbert

Describe the bug
meson format sorts the files in files() by default, but doesn't follow the instructions in the Meson style guide.

To Reproduce
Run meson format meson.build, where meson.build is:

project('a')
sources = files(
    'aaa/a1.c',
    'aaa/a2.c',
    'bbb/subdir1/b1.c',
    'bbb/subdir2/b2.c',
    'bbb/subdir10/b3.c',
    'bbb/subdir20/b4.c',
    'bbb/b5.c',
    'bbb/b6.c',
    'f1.c',
    'f2.c',
    'f10.c',
    'f20.c',
)

This produces:

project('a')
sources = files(
    'aaa/a1.c',
    'aaa/a2.c',
    'bbb/b5.c',
    'bbb/b6.c',
    'bbb/subdir1/b1.c',
    'bbb/subdir10/b3.c',
    'bbb/subdir2/b2.c',
    'bbb/subdir20/b4.c',
    'f1.c',
    'f10.c',
    'f2.c',
    'f20.c',
)

Expected behavior
The output matches the input.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    native

  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Fedora 42

  • what Python version are you using e.g. 3.8.0
    3.13.7

  • what meson --version
    1.9.0

  • what ninja --version if it's a Ninja build
    1.12.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions