vint icon indicating copy to clipboard operation
vint copied to clipboard

Spurious scriptencoding error when checking multiple files

Open puremourning opened this issue 4 years ago • 4 comments

The warning "Set encoding before setting scriptencoding (see :help :scriptencoding)" is reported when a set encoding= is found in any file after :scriptencoding

To reproduce:

  • Create a file dir1/file1.vim with the following:
set encoding=utf-8
scriptencoding utf-8
  • Create a file dir2/file2.vim with the following:
set encoding=utf-8
  • run vint dir1/ dir2/

Expected result: no error Actual result:

dir2/file2.vim:1:1: Set encoding before setting scriptencoding (see :help :scriptencoding)

puremourning avatar May 19 '20 19:05 puremourning

Hi there, I can confirm that I'm seeing this issue with vint 0.4a3 on my .vim directory (it actually contains my vimrc file)

my vimrc sets encoding first and then scriptencoding. there's one more file that sets scriptencoding and that causes the error to show up

lelutin avatar Jul 26 '21 15:07 lelutin

Workaround:

policies:
  ProhibitEncodingOptionAfterScriptEncoding:
    enabled: false

offa avatar Mar 11 '22 19:03 offa

Hi there, I can confirm that adding the snippet of configuration that @offa mentioned to ~/.vintrc.yaml takes out the error about the encoding.

It also takes out all legit checks for this within files though.

The way I worked arount this issue was to modify my ~/.vimrc in this way to disable the warning only where the error was being produced:

  " vint: -ProhibitEncodingOptionAfterScriptEncoding
  set encoding=utf-8
  scriptencoding utf-8
  " vint: +ProhibitEncodingOptionAfterScriptEncoding

lelutin avatar Mar 12 '22 18:03 lelutin

I just use my fork which includes the fix https://github.com/Vimjas/vint/pull/364

puremourning avatar Mar 12 '22 19:03 puremourning