<commit_before>" Author: prashcr - https://github.com/prashcr

if exists('g:loaded_ale_linters_coffee_coffeelint')
    finish
endif

let g:loaded_ale_linters_coffee_coffeelint = 1

function! ale_linters#coffee#coffeelint#Handle(buffer, lines)
    " Matches patterns like the following:
    "
    " path,lineNumber,lineNumberEnd,level,message
    " stdin,14,,error,Throwing strings is forbidden
    " 
    " Note that we currently ignore lineNumberEnd for multiline errors
    let pattern = 'stdin,\(\d\+\),\(\d*\),\(.\+\),\(.\+\)'
    let output = []

    for line in a:lines
        let l:match = matchlist(line, pattern)

        if len(l:match) == 0
            continue
        endif

        let line = l:match[1] + 0
        let column = 1
        let type = l:match[3] ==# 'error' ? 'error' : 'warn'
        let text = type . ': ' . l:match[4]

        " vcol is needed to indicate that the column is a character
        call add(output, {
        \   'bufnr': a:buffer,
        \   'lnum': line,
        \   'vcol': 0,
        \   'col': column,
        \   'text': text,
        \   'type': type,
        \   'nr': -1,
        \})
    endfor

    return output
endfunction

call ALEAddLinter('coffee', {
\   'name': 'coffeelint',
\   'executable': 'coffeelint',
\   'command': 'coffeelint --stdin --reporter csv',
\   'callback': 'ale_linters#coffee#coffeelint#Handle',
\})<commit_msg>Fix qflist output for coffeelint<commit_after>" Author: prashcr - https://github.com/prashcr

if exists('g:loaded_ale_linters_coffee_coffeelint')
    finish
endif

let g:loaded_ale_linters_coffee_coffeelint = 1

function! ale_linters#coffee#coffeelint#Handle(buffer, lines)
    " Matches patterns like the following:
    "
    " path,lineNumber,lineNumberEnd,level,message
    " stdin,14,,error,Throwing strings is forbidden
    " 
    " Note that we currently ignore lineNumberEnd for multiline errors
    let pattern = 'stdin,\(\d\+\),\(\d*\),\(.\+\),\(.\+\)'
    let output = []

    for line in a:lines
        let l:match = matchlist(line, pattern)

        if len(l:match) == 0
            continue
        endif

        let line = l:match[1] + 0
        let column = 1
        let type = l:match[3] ==# 'error' ? 'E' : 'W'
        let text = l:match[3] . ': ' . l:match[4]

        " vcol is needed to indicate that the column is a character
        call add(output, {
        \   'bufnr': a:buffer,
        \   'lnum': line,
        \   'vcol': 0,
        \   'col': column,
        \   'text': text,
        \   'type': type,
        \   'nr': -1,
        \})
    endfor

    return output
endfunction

call ALEAddLinter('coffee', {
\   'name': 'coffeelint',
\   'executable': 'coffeelint',
\   'command': 'coffeelint --stdin --reporter csv',
\   'callback': 'ale_linters#coffee#coffeelint#Handle',
\})
{'fraction_non_alphanumeric': 0.14718460441910192, 'fraction_numerical': 0.00819672131147541, 'mean_word_length': 2.32189349112426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3930972', 'n_tokens_mistral': 1021, 'n_tokens_neox': 961, 'n_words': 228}