dense-analysis/ale

vcom and vlog create files in current directory on disk

Ouverte

#2 929 ouverte le 10 déc. 2019

 (5 commentaires) (0 réaction) (0 personne assignée)Vim Script (1 487 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (13 990 étoiles)
Métriques de merge PR
 (Merge moyen 51j 4h) (3 PRs mergées en 30 j)

Description

Information

VIM version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 18 2019 12:07:09) Included patches: 1-1565

Operating System: RHEL 6.9 64b

What went wrong

The 'vlog' and 'vcom' Questa/Modelsim linters create a directory called 'work' with a handful of library files inside the current working directory as a byproduct of linting with ALE. These files pollute the cwd and are unnecessary. They can be avoided by modifying the call to vlog/vcom

Reproducing the bug

  1. Ensure questa/modelsim is installed and on PATH
  2. Open a VHDL file with the vcom linter enabled or open a Verilog file with the vlog linter enabled.
  3. Close vim
  4. Observe that there is a new directory called 'work' in the cwd with compiled library files resident.

Fixing the bug

I worked around the bug by using the -work option with a Tempname for both vlog and vcom. -work lets you specify a library path rather than the default of ./work. The temp file will then get cleaned up automatically when vim exits.

Before (vlog)

function! ale_linters#verilog#vlog#GetCommand(buffer) abort
    return '%e ' . ale#Pad(ale#Var(a:buffer, 'verilog_vlog_options')) . ' %t'
endfunction

After

function! ale_linters#verilog#vlog#GetCommand(buffer) abort
    let l:tmpdir = ale#util#Tempname()

    return '%e ' . ale#Pad(ale#Var(a:buffer, 'verilog_vlog_options')) . ' -work ' . l:tmpdir . ' %t'
endfunction

Before (vcom)

function! ale_linters#vhdl#vcom#GetCommand(buffer) abort
    return '%e ' . ale#Pad(ale#Var(a:buffer, 'vhdl_vcom_options')) . ' %t'
endfunction

After

function! ale_linters#vhdl#vcom#GetCommand(buffer) abort
    let l:tmpdir = ale#util#Tempname()

    return '%e ' . ale#Pad(ale#Var(a:buffer, 'vhdl_vcom_options')) . ' -work '. l:tmpdir . ' %t'
endfunction

:ALEInfo

ALEInfo output for an empty Verilog file: Current Filetype: verilog_systemverilog Available Linters: ['iverilog', 'verilator', 'vlog', 'xvlog'] Enabled Linters: ['vlog'] Suggested Fixers: 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables:

Global Variables:

let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = v:null let g:ale_completion_enabled = 0 let g:ale_completion_max_suggestions = v:null let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 0 let g:ale_fixers = {} let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'normal' let g:ale_linter_aliases = {} let g:ale_linters = {'vhdl': ['vcom'], 'verilog_systemverilog': ['vlog']} let g:ale_linters_explicit = 0 let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_lsp_root = {} let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '>>' let g:ale_sign_info = '--' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '>>' let g:ale_sign_style_warning = '--' let g:ale_sign_warning = '--' let g:ale_sign_highlight_linenrs = 0 let g:ale_statusline_format = v:null let g:ale_type_map = {} let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 0 let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History:

(executable check - success) vlog (finished - exit code 0) ['/bin/bash', '-c', '''vlog'' -quiet -lint ''/tmp/vrylSVN/0/test.v''']

<<>>

ALEInfo output for an empty VHDL file Current Filetype: vhdl Available Linters: ['ghdl', 'vcom', 'xvhdl'] Enabled Linters: ['vcom'] Suggested Fixers: 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables:

let g:ale_vhdl_vcom_executable = 'vcom' let g:ale_vhdl_vcom_options = '-2008 -quiet -lint' Global Variables:

let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = v:null let g:ale_completion_enabled = 0 let g:ale_completion_max_suggestions = v:null let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 0 let g:ale_fixers = {} let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'normal' let g:ale_linter_aliases = {} let g:ale_linters = {'vhdl': ['vcom'], 'verilog_systemverilog': ['vlog']} let g:ale_linters_explicit = 0 let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_lsp_root = {} let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '>>' let g:ale_sign_info = '--' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '>>' let g:ale_sign_style_warning = '--' let g:ale_sign_warning = '--' let g:ale_sign_highlight_linenrs = 0 let g:ale_statusline_format = v:null let g:ale_type_map = {} let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 0 let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History:

(executable check - success) vcom (finished - exit code 2) ['/bin/bash', '-c', '''vcom'' -2008 -quiet -lint ''/tmp/vIO6HZx/0/test.vhd''']

<<>> ** Error (suppressible): /tmp/vIO6HZx/0/test.vhd(2): (vcom-1491) Empty source files. <<>>

Guide contributeur