<commit_before>if exists("b:did_ruby_statusline_ftplugin") || &filetype !~ '\<ruby\>'
    finish
endif
let b:did_ruby_statusline_ftplugin = 1

"bail if the user doesnt have ruby installed
if !executable("ruby")
    finish
endif

let &l:statusline = substitute(&statusline, '\(%=\)', '%#warningmsg#%{StatuslineRubySyntaxCheck()}%*\1', '')

"recalculate after saving
autocmd bufwritepost * unlet! b:statusline_ruby_syntax_check

function! StatuslineRubySyntaxCheck()
    if !exists("b:statusline_ruby_syntax_check")
        let b:statusline_ruby_syntax_check = ''
        if filereadable(expand("%"))
            let output = system("ruby -c " . expand("%"))
            if v:shell_error != 0
                let b:statusline_ruby_syntax_check = '[syntax:'. s:ExtractErrorLine(output) . ']'
            endif
        endif
    endif
    return b:statusline_ruby_syntax_check
endfunction

function! s:ExtractErrorLine(error_msg)
    return substitute(a:error_msg, '.\{-}:\(\d*\): syntax error,.*', '\1', '')
endfunction
<commit_msg>use "warning" instead of "check" for ruby &stl syntax check<commit_after>if exists("b:did_ruby_statusline_ftplugin") || &filetype !~ '\<ruby\>'
    finish
endif
let b:did_ruby_statusline_ftplugin = 1

"bail if the user doesnt have ruby installed
if !executable("ruby")
    finish
endif

let &l:statusline = substitute(&statusline, '\(%=\)', '%#warningmsg#%{StatuslineRubySyntaxWarning()}%*\1', '')

"recalculate after saving
autocmd bufwritepost * unlet! b:statusline_ruby_syntax_warning

function! StatuslineRubySyntaxWarning()
    if !exists("b:statusline_ruby_syntax_warning")
        let b:statusline_ruby_syntax_warning = ''
        if filereadable(expand("%"))
            let output = system("ruby -c " . expand("%"))
            if v:shell_error != 0
                let b:statusline_ruby_syntax_warning = '[syntax:'. s:ExtractErrorLine(output) . ']'
            endif
        endif
    endif
    return b:statusline_ruby_syntax_warning
endfunction

function! s:ExtractErrorLine(error_msg)
    return substitute(a:error_msg, '.\{-}:\(\d*\): syntax error,.*', '\1', '')
endfunction

{'fraction_non_alphanumeric': 0.14022662889518414, 'fraction_numerical': 0.003777148253068933, 'mean_word_length': 4.021327014218009, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5258763', 'n_tokens_mistral': 721, 'n_tokens_neox': 663, 'n_words': 143}