https://github.com/liquipedia/sqllint
A thin wrapper around the SqlParser from the phpMyAdmin project which can be used to lint any amount of sql files from the command line.
https://github.com/liquipedia/sqllint
lint linter linting mysql sql
Last synced: 6 months ago
JSON representation
A thin wrapper around the SqlParser from the phpMyAdmin project which can be used to lint any amount of sql files from the command line.
- Host: GitHub
- URL: https://github.com/liquipedia/sqllint
- Owner: Liquipedia
- License: gpl-2.0
- Created: 2021-03-04T16:10:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-11T14:30:38.000Z (over 3 years ago)
- Last Synced: 2024-03-14T13:42:49.062Z (over 2 years ago)
- Topics: lint, linter, linting, mysql, sql
- Language: PHP
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# SqlLint


This is a thin wrapper around the SqlParser from the [phpMyAdmin project][1] which can be used to lint any amount of sql files from the command line.
## Installation
Please use [Composer][2] to install:
```sh
composer require liquipedia/sqllint --dev
```
## Usage
### Command line utility
```sh
./vendor/bin/sqllint
```
```sh
./vendor/bin/sqllint --report=junit > report-junit.xml
```
### Via composer script
Add this to your composer.json
```json
{
"require-dev": {
"liquipedia/sqllint": "*"
},
"scripts": {
"sqllint": [
"sqllint"
],
"sqllint-junit": [
"sqllint --report=junit > report-junit.xml"
]
}
}
```
and run
```sh
composer sqllint
```
### Parameter
To check out parameters, please refer to the `src/Parameters.php` file or use the `--help` parameter.
### `.sqllint.json`
Parameters for SqlLint can optionally also be provided via a `.sqllint.json` file in the project root. Parameters passed via command line always have precedence over the parameters set in `.sqllint.json`.
Example:
```json
{
"report": "junit"
}
```
[1]:https://github.com/phpmyadmin/sql-parser
[2]:https://getcomposer.org/