Add support for keil c51
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start with the proposed ale_linters#c#c51#GetCommand and ale_linters#c#c51#HandleOutput entry points, then review how ale#linter#Define registers the C51 linter. Done means C51 is registered for C files and its compiler output produces the shown error and warning locations and messages.
Written by the indexing model from the issue text.
Description
I make a linter for keil c51. It has worked good for me recently, so I suggest to add it.
My code:
" ALE Linter for C51 Compiler
call ale#Set('c_c51_executable', 'c51')
call ale#Set('c_c51_options', 'NOPRINT NOOBJECT')
call ale#Set('c_c51_inc_path','.;.')
" 获取C51编译器的命令
" get the command
function! ale_linters#c#c51#GetCommand(buffer) abort
let l:file = expand('%:p')
return ale#Var(a:buffer, 'c_c51_executable') . ' ' . l:file . ' ' . ale#Var(a:buffer, 'c_c51_options') . ' ' . 'INCDIR("' . ale#Var(a:buffer,'c_c51_inc_path') . '")'
endfunction
" 处理C51编译器的输出
" handle the output of the keil c51
function! ale_linters#c#c51#HandleOutput(buffer, output) abort
let l:errors = []
for l:line in a:output
" 匹配错误和警告行
" match errors and warnings
if l:line =~ '\v\*\*\*\s+(ERROR|WARNING)\s+\w+\s+IN\s+LINE\s+\d+'
" 提取错误类型、行号、文件路径和错误消息
" get the information of errors and warnings
let l:match = matchlist(l:line, '\v\*\*\*\s+(ERROR|WARNING)\s+(\w+)\s+IN\s+LINE\s+(\d+)\s+OF\s+\S+:\s*(.*)')
if !empty(l:match)
let l:type = l:match[1]
let l:error_code = l:match[2]
let l:line_number = str2nr(l:match[3])
let l:message = l:match[4]
let l:file_path = expand('%:p')
call add(l:errors, {
\ 'filename': l:file_path,
\ 'lnum': l:line_number,
\ 'type': l:type == 'ERROR' ? 'E' : 'W',
\ 'text': l:message
\})
endif
endif
endfor
return l:errors
endfunction
" 注册C51 Linter
" register keil c51 linter
call ale#linter#Define('c', {
\ 'name': 'c51',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'c_c51_executable')},
\ 'command': function('ale_linters#c#c51#GetCommand'),
\ 'callback': function('ale_linters#c#c51#HandleOutput'),
\})
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dense-analysis/ale
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dense-analysis/ale#5181 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dense-analysis/ale#5180 · 1 comment ·
-
new tool
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
dense-analysis/ale#5176 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 75/100
dense-analysis/ale#5174 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dense-analysis/ale#5158 ·
All issues in dense-analysis/ale
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
electron-userland/electron-builder#10623 ·
Maintainers usually reply within 1 day
-
ExceptionThrowShouldUseContext: NullPointerException on a catch block inside an annotation typePossibly taken @Carbon14-48 claimed this today. Openapproved
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
checkstyle/checkstyle#22784 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
hassanmubiru/StreetJS#209 ·