mformat: correctly handle editorconfig files without the root setting

Which happens when a .editorconfig is in a subdirectory, not the root.
In this case we need Set the fallback value to `False`, which is what
editorconfig expects.

Closes: #13568
pull/13576/head
Dylan Baker 3 months ago committed by Eli Schwartz
parent cdf646feb8
commit 18f4a058bf
  1. 3
      mesonbuild/mformat.py
  2. 1
      test cases/format/3 editorconfig/meson.build
  3. 2
      test cases/format/3 editorconfig/subdir/.editorconfig
  4. 3
      test cases/format/3 editorconfig/subdir/sub.meson

@ -823,7 +823,8 @@ class Formatter:
if value is not None:
setattr(config, f.name, value)
if cp.getboolean(cp.default_section, 'root'):
# Root is not required except in the top level .editorconfig.
if cp.getboolean(cp.default_section, 'root', fallback=False):
break
return config

@ -7,6 +7,7 @@ meson_files = {
'self': files('meson.build'),
'comments': files('crazy_comments.meson'),
'indentation': files('indentation.meson'),
'subdir editorconfig': files('subdir/sub.meson'),
}
foreach name, f : meson_files

@ -0,0 +1,3 @@
project('line')
msg = 'this is a very long line, and it should be be wrapped because we have line length limit of 120, not 60'
Loading…
Cancel
Save