dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.49k stars 1.43k forks source link

compile_commands.json can't be disabled for clang-check #4539

Open starsareintherose opened 1 year ago

starsareintherose commented 1 year ago

Information

VIM version

" ale-setting
let g:ale_set_highlights = 0
"w&e
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
let g:ale_sign_column_always = 1
"check
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
let g:ale_open_list = 1
let g:ale_keep_list_window_open = 0

" quickfix setting
autocmd FileType qf wincmd J
let g:ale_list_window_size = 5

" close
nmap <F2> :lclose<cr>
nmap <F1>l :ALEToggle<CR>
nmap <Leader>d :ALEDetail<CR>

let g:ale_linters = {
\   'c++': ['clang++'],
\   'c': ['clang'],
\}
let g:ale_c_cc_executable = 'clang'
let g:ale_cpp_cc_executable = 'clang++'
let g:ale_c_cc_options = '-Wall `pkg-config --cflags gtk-4.0`'
let g:ale_cpp_cc_options = '-Wall `pkg-config --cflags gtkmm-4.0`'
let g:ale_c_parse_compile_commands = 0

Operating System:

What went wrong

Something went wrong in specifically this place, and I also searched through both open and closed issues for the same problem before reporting a bug here.

Are you having trouble configuring ALE? Try asking for help on Stack Exchange or perhaps on Reddit instead. The GitHub issue tracker should be used for reporting bugs or asking for new features.

How can I disbale its checking? as you can see, I already use ale_c_parse_compile_commands which saying that it also works for cpp.

Reproducing the bug

  1. I vim a cpp file
  2. Then it reports warning
    fixed-compilation-database|1 warning| No such file or directory
    json-compilation-database|1 warning| No such file or directory

:ALEInfo

Expand ``` Current Filetype: cpp Available Linters: ['cc', 'ccls', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppc heck', 'cpplint', 'cquery', 'cspell', 'flawfinder'] Linter Aliases: 'cc' -> ['gcc', 'clang', 'g++', 'clang++'] Enabled Linters: ['cc', 'ccls', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppc heck', 'cpplint', 'cquery', 'cspell', 'flawfinder'] Ignored Linters: [] Suggested Fixers: 'astyle' - Fix C/C++ with astyle. 'clang-format' - Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Proto buf files with clang-format. 'clangtidy' - Fix C/C++ and ObjectiveC files with clang-tidy. '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 l ine. 'uncrustify' - Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA fi les with uncrustify. Linter Variables: let g:ale_cpp_cc_executable = 'clang++' let g:ale_cpp_cc_header_exts = ['h', 'hpp'] let g:ale_cpp_cc_options = '-Wall `pkg-config --cflags gtkmm-4.0`' let g:ale_cpp_cc_use_header_lang_flag = -1 let g:ale_cpp_ccls_executable = 'ccls' let g:ale_cpp_ccls_init_options = {} let g:ale_cpp_clangcheck_executable = 'clang-check' let g:ale_cpp_clangcheck_options = '' let g:ale_cpp_clangd_executable = 'clangd' let g:ale_cpp_clangd_options = '' let g:ale_cpp_clangtidy_checks = [] let g:ale_cpp_clangtidy_executable = 'clang-tidy' let g:ale_cpp_clangtidy_extra_options = '' let g:ale_cpp_clangtidy_options = '' let g:ale_cpp_clazy_checks = ['level1'] let g:ale_cpp_clazy_executable = 'clazy-standalone' let g:ale_cpp_clazy_options = '' let g:ale_cpp_cppcheck_executable = 'cppcheck' let g:ale_cpp_cppcheck_options = '--enable=style' let g:ale_cpp_cpplint_executable = 'cpplint' let g:ale_cpp_cpplint_options = '' let g:ale_cpp_cquery_cache_directory = '/home/guoyi/.cache/cquery' let g:ale_cpp_cquery_executable = 'cquery' let g:ale_cpp_flawfinder_executable = 'flawfinder' let g:ale_cpp_flawfinder_minlevel = 1 let g:ale_cpp_flawfinder_options = '' 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_disable_lsp = 0 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 = {'c': ['clang'], 'c++': ['clang++']} let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = 0 let g:ale_list_window_size = 5 let g:ale_loclist_msg_format = '%code: %%s' 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 = 1 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 0 let g:ale_set_highlights = 0 let g:ale_set_loclist = 0 let g:ale_set_quickfix = 1 let g:ale_set_signs = 1 let g:ale_sign_column_always = 1 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 = 'all' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 ``` Then error start ``` LSP Error Messages: (Errors for ccls) Failed to find project root, language server won't start. LSP Error Messages: (Errors for clangd) Failed to find project root, language server won't start. LSP Error Messages: (Errors for cquery) Failed to find project root, language server won't start. Command History: (executable check - success) clang++ (finished - exit code 0) ['/usr/bin/zsh', '-c', '''clang++'' -S -x c++ -o /dev/null -i quote ''/home/guoyi/Documents/code/tree'' -Wall `pkg-config --cflags gtkmm-4.0` - < '' /tmp/vvmOOhY/6/gen_random.cpp'''] <<>> (executable check - success) clang-check (finished - exit code 0) ['/usr/bin/zsh', '-c', '''clang-check'' -analyze ''/home/guoy i/Documents/code/tree/gen_random.cpp'' --extra-arg=-Xclang --extra-arg=-analyzer-outpu t=text --extra-arg=-fno-color-diagnostics'] <<>> Error while trying to load a compilation database: Could not auto-detect compilation database for file "/home/guoyi/Documents/code/tree/g en_random.cpp" No compilation database found in /home/guoyi/Documents/code/tree or any parent directo ry json-compilation-database: Error while opening JSON database: No such file or director y fixed-compilation-database: Error while opening fixed database: No such file or direct ory Running without flags. <<>> (executable check - success) clang-tidy (finished - exit code 0) ['/usr/bin/zsh', '-c', '''clang-tidy'' ''/home/guoyi/Document s/code/tree/gen_random.cpp'''] <<>> (executable check - failure) clazy-standalone (executable check - failure) cppcheck (executable check - failure) cpplint (executable check - failure) cspell (executable check - failure) flawfinder ```
nospam2998 commented 1 year ago

This issue clearly lacks a valid description.

If there truly is a bug, could @starsareintherose please make this actionable by adding some more info than the merely unmodified template, which obviously wasn't even read?

In the more likely scenario, that this is not bug report but rather a support request, the support channels suggested above likely both have a lot higher chance at being successful in giving help, than abusing an already overflowing issue tracker. Could @starsareintherose please be so kind to close the issue if there is no real bug and ask where more appropriate?

w0rp commented 1 year ago

I see what the issue is. When the ALE setting is configured not to read compile_commands.json, we need to update the arguments for clang-check so it doesn't search for the file.