Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove length limits on sections/keys/values #148

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ cache:

environment:
VIM_EXE: C:\vim\vim\vim80\vim.exe
EDITORCONFIG_DEBUG: c:\windows\temp\ecdebug.txt

for:
# Don't run the Windows build if the commit message includes "[ci-linux]"
Expand Down Expand Up @@ -102,6 +103,7 @@ test_script:

on_failure:
- echo "failed"
- cmd: type c:\windows\temp\ecdebug.txt
- cmd: type tests\core\build\Testing\Temporary\LastTest.log
- sh: cat tests/core/build/Testing/Temporary/LastTest.log

3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
url = https://github.com/editorconfig/editorconfig-plugin-tests.git
[submodule "core_tests"]
path = tests/core/tests
url = https://github.com/editorconfig/editorconfig-core-test.git
url = https://github.com/goodhoko/editorconfig-core-test.git
branch = feature/remove-length-limits
21 changes: 5 additions & 16 deletions autoload/editorconfig_core/ini.vim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ endif
" Allow ``]`` and escaped ``;`` and ``#`` characters in section headers.
" In fact, allow \ to escape any single character - it needs to cover at
" least \ * ? [ ! ] { }.
unlockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE
unlockvar s:SECTCRE s:OPTCRE
let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]'

" Regular expression for parsing option name/values.
Expand All @@ -48,11 +48,7 @@ let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]'
" any characters to eol
let s:OPTCRE = '\v\s*([^:=[:space:]][^:=]*)\s*([:=])\s*(.*)$'

let s:MAX_SECTION_NAME = 4096
let s:MAX_PROPERTY_NAME = 50
let s:MAX_PROPERTY_VALUE = 255

lockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE
lockvar s:SECTCRE s:OPTCRE

" }}}2
" === Main ============================================================== {{{1
Expand Down Expand Up @@ -123,13 +119,8 @@ function! s:parse(config_filename, target_filename, lines)
if len(l:mo)
let l:sectname = l:mo[1]
let l:in_section = 1
if strlen(l:sectname) > s:MAX_SECTION_NAME
" Section name too long => ignore the section
let l:matching_section = 0
else
let l:matching_section = s:matches_filename(
\ a:config_filename, a:target_filename, l:sectname)
endif
let l:matching_section = s:matches_filename(
\ a:config_filename, a:target_filename, l:sectname)

if g:editorconfig_core_vimscript_debug
echom 'In section ' . l:sectname . ', which ' .
Expand Down Expand Up @@ -177,9 +168,7 @@ function! s:parse(config_filename, target_filename, lines)
echom printf('Saw opt <%s>=<%s>', l:optname, l:optval)
endif

if l:matching_section &&
\ strlen(l:optname) <= s:MAX_PROPERTY_NAME &&
\ strlen(l:optval) <= s:MAX_PROPERTY_VALUE
if l:matching_section
let l:options[l:optname] = l:optval
endif
else
Expand Down
2 changes: 1 addition & 1 deletion tests/core/tests