<commit_before>"============================================================================
"File:        ghc-mod.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer:  <NAME> <<EMAIL>>
"License:     This program is free software. It comes without any warranty,
"             to the extent permitted by applicable law. You can redistribute
"             it and/or modify it under the terms of the Do What The Fuck You
"             Want To Public License, Version 2, as published by Sam Hocevar.
"             See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================

if exists('g:loaded_syntastic_haskell_ghc_mod_checker')
    finish
endif
let g:loaded_syntastic_haskell_ghc_mod_checker = 1

let s:ghc_mod_new = -1

let s:save_cpo = &cpo
set cpo&vim

function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
    if !executable(self.getExec())
        return 0
    endif

    " ghc-mod 5.0.0 and later needs the "version" command to print the
    " version.  But the "version" command appeared in 4.1.0.  Thus, we need to
    " know the version in order to know how to find out the version. :)

    " Try "ghc-mod version".
    let ver = filter(split(system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m^ghc-mod version''')
    if !len(ver)
        " That didn't work.  Try "ghc-mod" alone.
        let ver = filter(split(system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m^ghc-mod version''')
    endif

    if len(ver)
        " Encouraged by the great success in finding out the version, now we
        " need either a Vim that can handle NULs in system() output, or a
        " ghc-mod that has the "--boundary" option.
        let parsed_ver = syntastic#util#parseVersion(ver[0])
        call self.log(self.getExec() . ' version =', parsed_ver)
        let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2])
    else
        call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
        let s:ghc_mod_new = -1
    endif

    return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new)
endfunction

function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
    let makeprg = self.makeprgBuild({
        \ 'exe': self.getExecEscaped() . ' check' . (s:ghc_mod_new ? ' --boundary=""' : '') })

    let errorformat =
        \ '%-G%\s%#,' .
        \ '%f:%l:%c:%trror: %m,' .
        \ '%f:%l:%c:%tarning: %m,'.<commit_msg>ghc-mod: the pylint way of handling versions is way cool, man.<commit_after>"============================================================================
"File:        ghc-mod.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer:  <NAME> <<EMAIL>>
"License:     This program is free software. It comes without any warranty,
"             to the extent permitted by applicable law. You can redistribute
"             it and/or modify it under the terms of the Do What The Fuck You
"             Want To Public License, Version 2, as published by Sam Hocevar.
"             See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================

if exists('g:loaded_syntastic_haskell_ghc_mod_checker')
    finish
endif
let g:loaded_syntastic_haskell_ghc_mod_checker = 1

let s:ghc_mod_new = -1

let s:save_cpo = &cpo
set cpo&vim

function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
    if !executable(self.getExec())
        return 0
    endif

    " ghc-mod 5.0.0 and later needs the "version" command to print the
    " version.  But the "version" command appeared in 4.1.0.  Thus, we need to
    " know the version in order to know how to find out the version. :)

    " Try "ghc-mod version".
    let ver = filter(split(system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
    if !len(ver)
        " That didn't work.  Try "ghc-mod" alone.
        let ver = filter(split(system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
    endif

    if len(ver)
        " Encouraged by the great success in finding out the version, now we
        " need either a Vim that can handle NULs in system() output, or a
        " ghc-mod that has the "--boundary" option.
        let parsed_ver = syntastic#util#parseVersion(ver[0])
        call self.log(self.getExec() . ' version =', parsed_ver)
        let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2])
    else
        call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
        let s:ghc_mod_new = -1
    endif

    return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new)
endfunction

function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
    let makeprg = self.makeprgBuild({
        \ 'exe': self.getExecEscaped() . ' check' . (s:ghc_mod_new ? ' --boundary=""' : '') })

    let errorformat =
        \ '%-G%\s%#,' .
        \ '%f:%l:%c:%trror: %m,' .
        \ '%f:%l:%c:%tarning: %m,'.
{'fraction_non_alphanumeric': 0.18070625369895443, 'fraction_numerical': 0.007496547642533044, 'mean_word_length': 3.1728395061728394, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '1540467', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1621, 'n_words': 475}