Skip to content
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

ansible-lint not working due to incorrect errorformat #2561

Open
schwukas opened this issue Jul 20, 2023 · 0 comments
Open

ansible-lint not working due to incorrect errorformat #2561

schwukas opened this issue Jul 20, 2023 · 0 comments

Comments

@schwukas
Copy link

Expected behavior

Calling :Neomake ansiblelint should lint the open file and show errors and warnings in the quickfix list.

Steps to reproduce

  1. Open a supported ansible file and make sure that filetype is ansible or yaml.ansible.
  2. Call :Neomake ansiblelint.
  3. Nothing will happen.

neomake.log shows Skipped 38 entries without bufnr:

Fixing the errorformat in autoload/neomake/makers/ft/ansible.vim seems to fix the error and the quickfix list is populated again.

This is what I came up with for a fix but it's not particularly well crafted and displays all messages as warnings, even though only some of those are marked as warnings by ansible-lint:

        \ 'errorformat': 
            \ '%f:%l: %m,' .
            \ '%-G%.%#',

Maybe someone can build a nicer and more robust expression.

Output from :NeomakeInfo

Neomake debug information

Async support: 1
Current filetype: yaml.ansible
Windows: 0
[shell, shellcmdflag, shellslash]: ['/usr/bin/bash', '-c', 0]
makeprg=make

Enabled makers

For the current filetype ("yaml.ansible", used with :Neomake):

  • ansiblelint
    • args: ['-p', '--nocolor']
    • auto_enabled: 0
    • errorformat: '%f:%l: [%t%n] %m,%f:%l: [%tANSIBLE%n] %m'
    • exe: 'ansible-lint'
    • version information (/usr/bin/ansible-lint --version): ansible-lint �[1;36m6.15�[0m�[1;36m.�[0m�[1;36m1.�[0m�[1;36mdev45�[0m using ansible �[1;36m2.15�[0m�[1;36m.�[0m�[1;36m1�[0m
      �[33mA new release of ansible-lint is available: �[0m�[1;31m6.15�[0m�[31m.�[0m�[1;31m1.�[0m�[31mdev45�[0m�[33m → �[0m�]8;id=396604;https://github.com/ansible/ansible-lint/releases/tag/v6.17.2�\�[1;32m6.17�[0m�]8;;�\�]8;id=742439;https://github.com/ansible/ansible-lint/releases/tag/v6.17.2�\�[32m.�[0m�]8;;�\�]8;id=396604;https://github.com/ansible/ansible-lint/releases/tag/v6.17.2�\�[1;32m2�[0m�]8;;�
      NOTE: you can define g:neomake_yaml_ansible_enabled_makers to configure it (or b:neomake_yaml_ansible_enabled_makers).

For the project (used with :Neomake!):

  • makeprg
    • append_file: 0
    • args: []
    • auto_enabled: 1
    • errorformat: '%[^"]"%f"%\D%l: %m,"%f"%\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%[ ]from %f:%l:%c,%-G%[ ]from %f:%l:,%-G%[ ]from %f:%l,,%-G%[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f", line %l%\D%c%[^ ] %m,%D%\a[%\d]: Entering directory %['']%f'',%X%*\a[%*\d]: Leaving directory %*['']%f'',%D%\a: Entering directory %['']%f'',%X%*\a: Leaving directory %*['']%f'',%DMaking %*\a in %f,%f|%l| %m'
    • exe: 'make'
    • version information (/usr/bin/make --version): GNU Make 4.4.1
      Built for x86_64-pc-linux-gnu
      Copyright (C) 1988-2023 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      NOTE: you can define g:neomake_enabled_makers to configure it.

Default maker settings:

  • output_stream: 'both'
  • remove_invalid_entries: 0
  • buffer_output: 1
Settings
New-style (dict, overrides old-style)
g:neomake: {
  'automake': {
    'ignore_filetypes': [
      'startify',
    ],
    'events': {
      'BufWritePost': {
        'delay': 0,
      },
    },
  },
}
b:neomake: unset
Old-style
g:neomake_java_enabled_makers = ['javac']
g:neomake_open_list = 2
g:neomake_place_signs = 1
g:neomake_python_enabled_makers = ['pylama']
g:neomake_yaml_ansible_enabled_makers = ['ansiblelint']

:version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

:messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant