-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
json linting with jq doesn't report errors correctly #4765
Labels
Comments
benjos1234
added a commit
to benjos1234/ale
that referenced
this issue
Nov 13, 2024
With the 1.6 version of jq the error message start with "parse error". With the last version of jq the error message start with "jq: parse error". Fix it by using a regular expression that works in both cases.
benjos1234
added a commit
to benjos1234/ale
that referenced
this issue
Nov 20, 2024
With the 1.6 version of jq the error message start with "parse error". With the last version of jq the error message start with "jq: parse error". Fix it by using a regular expression that works in both cases.
hsanson
pushed a commit
that referenced
this issue
Nov 23, 2024
axhav
pushed a commit
to axhav/ale
that referenced
this issue
Dec 18, 2024
With the 1.6 version of jq the error message start with "parse error". With the last version of jq the error message start with "jq: parse error". Fix it by using a regular expression that works in both cases.
hsanson
pushed a commit
that referenced
this issue
Dec 29, 2024
* Added jq support Cleaned up yq.vim file * Updated docs * Updated supported-tools.md * Added yq tests * Fix python linting/formatting error when in virtual environment (#4865) Python fixers and linters were failing when vim is running in a virtual environment that's located in a path containing text `poetry`. The cause of this was the regular expression `poetry\|pipenv\|uv$` which matches `poetry` and `pipenv` if they appear anywhere in the virtualenv path. * Add cljfmt fixer for clojure files (#4860) * When using `actionlint` look for & use a config file (#4858) Actionlint supports a config file and it lives in a very searchable path, as the only files it acts on are in the `.github` directory already. Look for an `actionlint.yml` and `.yaml` in that path, and use the config if its there. * Fix linting with jq (#4765) (#4862) With the 1.6 version of jq the error message start with "parse error". With the last version of jq the error message start with "jq: parse error". Fix it by using a regular expression that works in both cases. * Properly handle optional end_line_no/end_line_pos in sqlfluff (#4867) end_line_no/end_line_pos are optional. Example SQL: `SELECT NULL FROM {{ a_jinja_templated_table }};` `sqlfluff lint --dialect ansi --format json` gives the following error among others: ``` {"start_line_no": 1, "start_line_pos": 21, "code": "TMP", "description": "Undefined jinja template variable: 'a_jinja_templated_table'", "name": "", "warning": false} ``` As one can see there is no end_line_no/end_line_pos. * Add golangci-lint fixer (#4853) Closes #4616 * Fixed copy-paste misstakes and added filter to docs * Added test vader file for yq * Fixed and updated the test case --------- Co-authored-by: Walter Kaunda <14844142+kwalter94@users.noreply.github.com> Co-authored-by: rudolf ordoyne <49649789+casens5@users.noreply.github.com> Co-authored-by: Bea Hughes <108035665+beahues@users.noreply.github.com> Co-authored-by: benjos1234 <legrimlvl24@gmail.com> Co-authored-by: Coacher <Coacher@users.noreply.github.com> Co-authored-by: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Information
VIM version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 11 2024 20:38:16)
Included patches: 1-16
Operating System: Linux (Debian GNU/Linux trixie/sid)
What went wrong
When editing json files using jq for linting, ALE doesn't report the errors correctly.
As you can see the details below, jq returns
jq: parse error: Expected separator between values at line L, column C
for each error. But, in fileale_linters/json/jq.vim
(line 8), the regexp to catch the errors/warning islet s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
(note the ^ in the regexp). Therefore, jq's output is not properly parsed.using
let s:pattern = 'parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
(without ^ in the regexp) gives me expected results, but I'm not sure whether it is correct way to fix it.:ALEInfo
ALEInfo Ouput
Current Filetype: json
Available Linters: ['cspell', 'eslint', 'jq', 'jsonlint', 'spectral', 'vscodejson']
Enabled Linters: ['jq']
Ignored Linters: []
Suggested Fixers:
'clang-format' - Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.
'dprint' - Pluggable and configurable code formatting platform
'fixjson' - Fix JSON files with fixjson.
'jq' - Fix JSON files with jq.
'prettier' - Apply prettier to a file.
'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_json_jq_executable = 'jq'
let g:ale_json_jq_filters = '.'
let g:ale_json_jq_options = '. --slurp --monochrome-output'
Global Variables:
let g:ale_cache_executable_check_failures = 0
let g:ale_change_sign_column_color = 1
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = 20
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = '✗'
let g:ale_echo_msg_format = '%severity%: [%linter%, %code%] %s'
let g:ale_echo_msg_info_str = '💡'
let g:ale_echo_msg_warning_str = '⚠'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'cmake': ['cmakeformat'], 'javascript.jsx': ['prettier', 'eslint'], 'markdown': ['dprint'], 'puppet': ['puppetlint'], 'terraform': ['terraform'], 'sh': ['shfmt'], 'graphql': ['prettier', 'eslint'], 'html': ['prettier'], '*': ['remove_trailing_lines', 'trim_whitespace'], 'javascript': ['prettier', 'eslint'], 'rust': ['rustfmt'], 'css': ['prettier'], 'python': ['yapf']}
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 1000
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 = 'always'
let g:ale_linter_aliases = {'jinja2': 'jinja', 'dockerfile': 'Dockerfile'}
let g:ale_linters = {'rust': ['rls'], 'puppet': ['puppetlint'], 'sh': ['shellcheck'], 'html': ['htmlhint'], 'terraform': ['terraform'], 'go': ['golint', 'go vet'], 'markdown': ['vale'], 'Dockerfile': ['hadolint'], 'yaml': ['yamllint'], 'python': ['pylint', 'pycodestyle', 'flake8', 'pydocstyle'], 'jinja': ['j2lint'], 'javascript.jsx': ['eslint', 'flow'], 'graphql': ['eslint', 'flow'], 'php': ['phpan'], 'ansible': ['ansible-lint'], 'javascript': ['eslint', 'flow'], 'json': ['jq'], 'dockerfile': ['hadolint'], 'yaml.ansible': ['ansible-lint', 'yamllint'], 'css': ['stylelint']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {'json': ['prettier']}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 3
let g:ale_loclist_msg_format = '%severity%: [%linter%, %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 = 1
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
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_type_map = {}
let g:ale_use_neovim_diagnostics_api = 0
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
Command History:
(executable check - success) jq
(finished - exit code 5) ['/bin/bash', '-c', '''jq'' < ''/tmp/vSr5vTa/4/manifest.json''']
<<>>
jq: parse error: Expected separator between values at line 16, column 18
<<>>
The text was updated successfully, but these errors were encountered: