Coder Social home page Coder Social logo

qbatten / vscode-sqlfluff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sqlfluff/vscode-sqlfluff

0.0 0.0 0.0 1.57 MB

An extension to use the sqlfluff linter in vscode.

Home Page: https://marketplace.visualstudio.com/items?itemName=dorzey.vscode-sqlfluff

License: MIT License

TypeScript 100.00%

vscode-sqlfluff's Introduction

Sponsor

Datacoves

Hosted VS Code, dbt-core, SqlFluff, and Airflow, find out more at Datacoves.com.

vscode-sqlfluff

.github/workflows/ci.yml

A linter and auto-formatter for SQLFluff, a popular linting tool for SQL and dbt.

linter in action

You can run Format Document to fix the linting violations. You cannot run Format Selection. Please note that not all linting violations are automatically fixable.

Configuration

The extension expects sqlfluff to be installed and already added to the path. If it is installed but cannot be found, add the path to your preferences as seen below. Find the path by typing which sqlfluff into your terminal.

Edit your VS Code settings.json file manually or through the user interface.

If you want to manually update the settings.json file, open the VS Code command palette and type in settings.json. Select Preferences: Open Settings. Then, you can add any of the following configuration options to settings.json.

  "sqlfluff.config": "${workspaceFolder}/.sqlfluff",
  "sqlfluff.dialect": "mysql",
  "sqlfluff.excludeRules": ["L009"],
  "sqlfluff.executablePath": "sqlfluff",
  "sqlfluff.ignoreLocalConfig": false,
  "sqlfluff.ignoreParsing": false,
  "sqlfluff.rules": [],
  "sqlfluff.suppressNotifications": false,
  "sqlfluff.workingDirectory": "",
  /* Linter */
  "sqlfluff.linter.arguments": [],
  "sqlfluff.linter.run": "onType",
  "sqlfluff.linter.diagnosticSeverity": "error",
  "sqlfluff.linter.diagnosticSeverityByRule": [
    {
      "rule": "L010",
      "severity": "warning"
    }
  ],
  "sqlfluff.linter.lintEntireProject": true,
  /* Formatter */
  "sqlfluff.format.arguments": ["--FIX-EVEN-UNPARSABLE"],
  "sqlfluff.format.enabled": true,

DBT Configuration

DBT setup requires these settings to lint and format the document.

  "sqlfluff.linter.run": "onSave",
  "sqlfluff.experimental.format.executeInTerminal": true,
  "editor.formatOnSave": false,

Format file

By default you will be able use SQLFluff fix your file by formatting. Same as calling sqlfluff fix --force <path>

plugin configuration

Show Documentation

Hovering over a problem with reveal a popup explaining the problem and giving a link to the documentation.

For SQLFluff versions after v2.0.0 this link will take you to the rule documentation.

For SQLFLuff versions before v2.0.0 this link will take you to the top of the documentation page.

VSCode Variables

The executablePath and config settings can use some VSCode variables. This is achieved by using the format ${variableName} in the settings. Here are a few useful ones.

  • fileWorkspaceFolder: the path of the workspace folder containing the file opened in VS Code
  • workspaceFolder: the path of the first workspace folder opened in VS Code
  • workspaceFolderBasename: the last portion of the path of the folder opened in VS Code
  • fileDirname: the current opened file's dirname

And here are a few that are probably useless.

  • file: the current opened file
  • relativeFile: the current opened file relative to workspaceFolder
  • fileBasename: the last portion of the path to the file
  • fileBasenameNoExtension: the last portion of the path to the file with no extension
  • fileExtname: the current opened file's extension
  • lineNumber: the current selected line number in the active file
  • selectedText: the current selected text in the active file
  • execPath: the path to the running VS Code executable

Open-VSX

open-vsx.org/extension/sqlfluff/vscode-sqlfluff

Credits / Links

License

The MIT License (MIT). Please see the license file for more information.

vscode-sqlfluff's People

Contributors

alex-mirkin avatar dependabot[bot] avatar dorzey avatar emekdahl avatar frederikaalund avatar itsvipa avatar jice-lavocat avatar noel avatar pdecat avatar qbatten avatar rene-haskia avatar robertostermann avatar rubensa avatar ssassi avatar yaegassy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.