You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current logic in the ini_handler() function seems to be to check every directory beneath the target directory for an .editorconfig file, from /.editorconfig upwards. If it encounters a config with root=true it clears the previous values and continues the traversal. If it encounters a file with INI syntax errors, it stops traversing at that directory and returns an error code.
This logic allows an .editorconfig file that shouldn't have any effect at all on the return value (because it's in a directory beneath the root config) to effectively prevent all property lookups in every directory above it.
I realize this is a weird edge case and fairly unlikely to happen, but I think it's worth mentioning anyway.
The text was updated successfully, but these errors were encountered:
The following options crossed my mind when I first noticed the issue:
Keep track of errors and do the full bottom-up traversal without any early return, then work out if there was an error above the "root" level and return appropriately.
Traverse the directories twice -- first backwards to find the "root", then forwards (from that point) to accumulate the properties.
Just ignore the lines that aren't valid INI sections or properties.
I opted for option 3 in the dteimplementation, although that may mean that it won't be able to pass the full test suite when I eventually hook it up...?
There seems to be plenty of precedent for just ignoring invalid lines though -- .gitconfig files, *.desktop files, systemd *.service files, etc. all ignore lines that don't contain a valid section/property and most parser libs (including inih) continue parsing past invalid lines.
The current logic in the
ini_handler()
function seems to be to check every directory beneath the target directory for an.editorconfig
file, from/.editorconfig
upwards. If it encounters a config withroot=true
it clears the previous values and continues the traversal. If it encounters a file with INI syntax errors, it stops traversing at that directory and returns an error code.This logic allows an
.editorconfig
file that shouldn't have any effect at all on the return value (because it's in a directory beneath theroot
config) to effectively prevent all property lookups in every directory above it.I realize this is a weird edge case and fairly unlikely to happen, but I think it's worth mentioning anyway.
The text was updated successfully, but these errors were encountered: