dense-analysis / dense-analysis/ale
Extra flag for sqlfmt causes file to be replaced by a warning
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
**VIM version**
NVIM v0.4.2
Build type: Release
Operating System: Arch Linux
## What went wrong
Formatting with the sqlfmt fixer causes all text to be replaced with
`unknown shorthand flag: 'w' in -w`
changing sqlfmt.vim from
```
return {
\ 'command': ale#Escape(l:executable)
\ . ' -w'
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
```
to
```
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
```
fixes the issue
## Reproducing the bug
1. have sqlfmt installed through the [aur package](https://aur.archlinux.org/packages/sqlfmt-bin/) or [binary](https://github.com/mjibson/sqlfmt/releases/tag/v0.4.0)
2. set g:ale_fixers to `{'sql': ['sqlfmt']}`
3. run ALEFix
then file is replaced with error text
It is possible this is a fixer name collision, and this fixer setup is intended for a different sql formatter. But I haven't been able to find that formatter?
### :ALEInfo
Current Filetype: sql
Available Linters: ['sqlint']
Enabled Linters: ['sqlint']
Suggested Fixers:
'pgformatter' - A PostgreSQL SQL syntax beautifier
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'sqlfmt' - Fix SQL files with sqlfmt.
'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 = {'sql': ['sqlfmt']}
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 = {}
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 = 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_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) sqlint
(finished - exit code 0) ['/usr/bin/bash', '-c', 'sqlint < ''/tmp/nvim35UVni/1/scratch.sql''']
<<>>
(finished - exit code 2) ['/usr/bin/bash', '-c', '''sqlfmt'' -w < ''/tmp/nvim35UVni/2/scratch.sql''']
(finished - exit code 1) ['/usr/bin/bash', '-c', 'sqlint < ''/tmp/nvim35UVni/3/scratch.sql''']
<<>>
stdin:1:1:ERROR syntax error at or near "unknown"
<<>>
(finished - exit code 1) ['/usr/bin/bash', '-c', 'sqlint < ''/tmp/nvim35UVni/4/scratch.sql''']
<<>>
stdin:1:1:ERROR syntax error at or near "unknown"
<<>>
Contributor guide
Assessment
This issue has not been assessed yet.