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

Can't call wrapper script for sqlfluff #49

Open
FurcyPin opened this issue Jul 4, 2022 · 3 comments
Open

Can't call wrapper script for sqlfluff #49

FurcyPin opened this issue Jul 4, 2022 · 3 comments

Comments

@FurcyPin
Copy link

FurcyPin commented Jul 4, 2022

Hi,

First, thanks for the nice plugin!

I'm trying to use a wrapper powershell script that calls sqlfluff instead of calling it directly, but I can't get it to work.
(The main reason for using a wrapper is that I would to make sure the user has the same version of sqlfluff installed as the CI/CD pipeline)

As a minimal example I tried this:

  1. I made a simple wrapper script bin\sqlfluff.ps1 that does just this:
sqlfluff $args

(I tried with @args too)

  1. When I call the script from the terminal, it seems to work as expected.
  2. When I set the plugin's "Executable Path" to "sqlfluff", the plugin works fine.
  3. When I set "Executable Path" to "bin\does_not_exists.ps1", I get an "executable not found" error message.
  4. When I set "Executable Path" to "bin\sqlfluff.ps1", I don't get that message, but the plugin does not seem to work. Nothing happen, reformating files has no effect, etc.

I could not find any log or error message, and I have no idea what is wrong with my script (I'm more a bash person than powershell).

Help would be greatly appreciated.

@StephenDriffill
Copy link

StephenDriffill commented Oct 28, 2022

I have a similar issue: I'm trying to run the docker image of sqlfluff via a bash script rather than my team having to each install python and sqlfluff.

My script:

#!/bin/bash
MSYS_NO_PATHCONV=1 winpty docker run -i --rm -v $(pwd):/sql sqlfluff/sqlfluff $*

When I set my script as the executable path .../sqlfluff.sh nothing happens when I try to run SQLFluff Lint in VSCode and no error.

@n1kk0
Copy link

n1kk0 commented Jul 8, 2023

This syntax works on Linux:

#!/bin/bash

docker run -i --rm -v $(pwd):/sql sqlfluff/sqlfluff $@

and a

"sqlfluff.executablePath": "${workspaceFolder}/sqlfluff.sh"

in the settings.json.

@doublethink13
Copy link

I'm using this script to install and run sqlfluff using docker:

sudo tee /usr/local/bin/sqlfluff >/dev/null <<EOF
#!/bin/bash
docker run -i --rm -v \$PWD:/sql sqlfluff/sqlfluff:3.3.1 "\$@"

EOF

sudo chmod +x /usr/local/bin/sqlfluff

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

4 participants