<commit_before>" Author: diegoholiveira <https://github.com/diegoholiveira>, haginaga <https://github.com/haginaga>
" Description: static analyzer for PHP

" Define the minimum severity
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)

let g:ale_php_phan_executable = get(g:, 'ale_php_phan_executable', 'phan')
let g:ale_php_phan_use_client = get(g:, 'ale_php_phan_use_client', 0)

function! ale_linters#php#phan#GetExecutable(buffer) abort
    let l:executable = ale#Var(a:buffer, 'php_phan_executable')
    if g:ale_php_phan_use_client == 1 && l:executable ==# 'phan'
        let l:executable = 'phan_client'
    endif

    return l:executable
endfunction

function! ale_linters#php#phan#GetCommand(buffer) abort
    if g:ale_php_phan_use_client == 1
        let l:args = '-l '
        \   . ' %s'
    else
        let l:args = '-y '
        \   . ale#Var(a:buffer, 'php_phan_minimum_severity')
        \   . ' %s'
    endif

    let l:executable = ale_linters#php#phan#GetExecutable(a:buffer)

    return ale#Escape(l:executable) . ' ' . l:args
endfunction

function! ale_linters#php#phan#Handle(buffer, lines) abort
    " Matches against lines like the following:
    if g:ale_php_phan_use_client == 1
        " Phan error: ERRORTYPE: message in /path/to/some-filename.php on line nnn
        let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$'
    else
        " /path/to/some-filename.php:18 ERRORTYPE message
        let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'<commit_msg>Fix to follow the Google VimScript Style Guide<commit_after>" Author: diegoholiveira <https://github.com/diegoholiveira>, haginaga <https://github.com/haginaga>
" Description: static analyzer for PHP

" Define the minimum severity
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)

let g:ale_php_phan_executable = get(g:, 'ale_php_phan_executable', 'phan')
let g:ale_php_phan_use_client = get(g:, 'ale_php_phan_use_client', 0)

function! ale_linters#php#phan#GetExecutable(buffer) abort
    let l:executable = ale#Var(a:buffer, 'php_phan_executable')
    if g:ale_php_phan_use_client == 1 && l:executable is# 'phan'
        let l:executable = 'phan_client'
    endif

    return l:executable
endfunction

function! ale_linters#php#phan#GetCommand(buffer) abort
    if g:ale_php_phan_use_client == 1
        let l:args = '-l '
        \   . ' %s'
    else
        let l:args = '-y '
        \   . ale#Var(a:buffer, 'php_phan_minimum_severity')
        \   . ' %s'
    endif

    let l:executable = ale_linters#php#phan#GetExecutable(a:buffer)

    return ale#Escape(l:executable) . ' ' . l:args
endfunction

function! ale_linters#php#phan#Handle(buffer, lines) abort
    " Matches against lines like the following:
    if g:ale_php_phan_use_client == 1
        " Phan error: ERRORTYPE: message in /path/to/some-filename.php on line nnn
        let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$'
    else
        " /path/to/some-filename.php:18 ERRORTYPE message
        let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
{'fraction_non_alphanumeric': 0.14857508805635608, 'fraction_numerical': 0.004482869036183158, 'mean_word_length': 3.4375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '6166381', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1139, 'n_words': 231}