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

Spurious scriptencoding error when checking multiple files #363

Open
puremourning opened this issue May 19, 2020 · 4 comments · May be fixed by #364
Open

Spurious scriptencoding error when checking multiple files #363

puremourning opened this issue May 19, 2020 · 4 comments · May be fixed by #364

Comments

@puremourning
Copy link

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)
@lelutin
Copy link

lelutin commented Jul 26, 2021

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

@offa
Copy link

offa commented Mar 11, 2022

Workaround:

policies:
  ProhibitEncodingOptionAfterScriptEncoding:
    enabled: false

@lelutin
Copy link

lelutin commented Mar 12, 2022

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

@puremourning
Copy link
Author

I just use my fork which includes the fix #364

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

Successfully merging a pull request may close this issue.

3 participants