~edwargix/git.sr.ht

3b66235f6d5952cf28bac812cb744b33d0d4cd58 — Drew DeVault 7 years ago 04611e5
Add resilience to shitty editorconfigs
1 files changed, 8 insertions(+), 2 deletions(-)

M gitsrht/editorconfig.py
M gitsrht/editorconfig.py => gitsrht/editorconfig.py +8 -2
@@ 46,12 46,18 @@ class EditorConfig:
    def tab_width(self):
        if self._config == None:
            return 8
        return self._config.get("tab_size", self._config.get("indent_size", 8))
        val = self._config.get("tab_size", self._config.get("indent_size", 8))
        if not isinstance(val, int):
            return 8
        return val

    def max_line_length(self):
        if self._config == None:
            return 80
        return self._config.get("max_line_length", 80)
        val = self._config.get("max_line_length", 80)
        if not isinstance(val, int):
            return 80
        return val

# Via https://github.com/editorconfig/editorconfig-core-py/blob/master/editorconfig/fnmatch.py
# 2-Clause BSD