mirror of
https://github.com/sqlfluff/sqlfluff
synced 2025-12-17 19:31:32 +00:00
Add yamllint to project (#2162)
* Add yamllint checks * Update to ture/false instead of True/False * Reinstate all rules * Extend default * Add ignore direcotries
This commit is contained in:
6
.github/codecov.yml
vendored
6
.github/codecov.yml
vendored
@@ -7,11 +7,11 @@ codecov:
|
||||
ci:
|
||||
- "github.com"
|
||||
max_report_age: 24
|
||||
disable_default_path_fixes: no
|
||||
require_ci_to_pass: yes
|
||||
disable_default_path_fixes: no # yamllint disable-line rule:truthy
|
||||
require_ci_to_pass: yes # yamllint disable-line rule:truthy
|
||||
notify:
|
||||
after_n_builds: 11
|
||||
wait_for_ci: yes
|
||||
wait_for_ci: yes # yamllint disable-line rule:truthy
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
|
||||
2
.github/workflows/ci-tests.yml
vendored
2
.github/workflows/ci-tests.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
jobs: [ 'linting', 'doclinting', 'docbuild' ]
|
||||
jobs: [ 'linting', 'doclinting', 'docbuild', 'yamllint' ]
|
||||
name: ${{ matrix.jobs }} tests
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -1,40 +1,45 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.0.1
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: end-of-file-fixer
|
||||
exclude: (.*\.sql$|test/fixtures/linter/sqlfluffignore/path_c)
|
||||
- id: trailing-whitespace
|
||||
- id: trailing-whitespace
|
||||
exclude: (.*\.sql$|test/fixtures/linter/sqlfluffignore/path_c)
|
||||
- repo: https://github.com/psf/black
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.12b0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
- id: black
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.920
|
||||
hooks:
|
||||
- id: mypy
|
||||
- id: mypy
|
||||
args: [--ignore-missing-imports]
|
||||
additional_dependencies: [
|
||||
types-toml,
|
||||
types-pkg_resources,
|
||||
types-chardet,
|
||||
types-toml,
|
||||
types-pkg_resources,
|
||||
types-chardet,
|
||||
]
|
||||
files: ^src/sqlfluff/.*
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 4.0.1
|
||||
hooks:
|
||||
- id: flake8
|
||||
- id: flake8
|
||||
additional_dependencies: [
|
||||
flake8-black,
|
||||
flake8-docstrings,
|
||||
flake8-black,
|
||||
flake8-docstrings,
|
||||
]
|
||||
- repo: https://github.com/pycqa/doc8
|
||||
- repo: https://github.com/pycqa/doc8
|
||||
rev: 0.10.1
|
||||
hooks:
|
||||
- id: doc8
|
||||
- id: doc8
|
||||
args: [
|
||||
--file-encoding,
|
||||
utf8,
|
||||
--file-encoding,
|
||||
utf8,
|
||||
]
|
||||
files: docs/source/.*\.rst$
|
||||
- repo: https://github.com/adrienverge/yamllint.git
|
||||
rev: v1.26.3
|
||||
hooks:
|
||||
- id: yamllint
|
||||
args: [-c=.yamllint]
|
||||
|
||||
17
.yamllint
Normal file
17
.yamllint
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
extends: default
|
||||
ignore: |
|
||||
.tox/
|
||||
.venv/
|
||||
dbt_modules/
|
||||
dbt_packages/
|
||||
|
||||
rules:
|
||||
brackets: disable
|
||||
document-start: disable
|
||||
indentation:
|
||||
indent-sequences: whatever
|
||||
line-length: disable
|
||||
truthy:
|
||||
check-keys: false # .github workflow uses "on:" (but not as a truthy value)
|
||||
@@ -1,15 +1,15 @@
|
||||
default:
|
||||
target: dev
|
||||
outputs:
|
||||
dev:
|
||||
type: postgres
|
||||
host: localhost
|
||||
user: alice
|
||||
pass: <password>
|
||||
port: 5432
|
||||
dbname: jaffle_shop
|
||||
schema: dbt_alice
|
||||
threads: 4
|
||||
target: dev
|
||||
outputs:
|
||||
dev:
|
||||
type: postgres
|
||||
host: localhost
|
||||
user: alice
|
||||
pass: <password>
|
||||
port: 5432
|
||||
dbname: jaffle_shop
|
||||
schema: dbt_alice
|
||||
threads: 4
|
||||
|
||||
config:
|
||||
send_anonymous_usage_stats: False
|
||||
send_anonymous_usage_stats: false
|
||||
|
||||
@@ -20,3 +20,4 @@ types-pkg_resources
|
||||
types-chardet
|
||||
# Requests is required for the util script
|
||||
requests
|
||||
yamllint
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Insert Statements
|
||||
file:
|
||||
statement:
|
||||
insert_statement:
|
||||
keyword: INSERT
|
||||
keyword: into
|
||||
object_reference:
|
||||
identifier: tbl_b
|
||||
start_bracket: (
|
||||
object_reference:
|
||||
identifier: col1
|
||||
end_bracket: )
|
||||
values_clause:
|
||||
keyword: values
|
||||
start_bracket: (
|
||||
literal:
|
||||
literal: 123
|
||||
end_bracket: )
|
||||
keyword: ;
|
||||
@@ -1,7 +1,7 @@
|
||||
rule: R001
|
||||
configs:
|
||||
core:
|
||||
dialect: exasol
|
||||
core:
|
||||
dialect: exasol
|
||||
|
||||
|
||||
tc1:
|
||||
|
||||
@@ -62,7 +62,7 @@ test_pass_line_too_long_with_comments_ignore_comment_lines:
|
||||
rules:
|
||||
max_line_length: 80
|
||||
L016:
|
||||
ignore_comment_lines: True
|
||||
ignore_comment_lines: true
|
||||
|
||||
test_fail_line_too_long_only_comments:
|
||||
# Check long lines that are only comments are linted correctly
|
||||
@@ -86,7 +86,7 @@ test_pass_line_too_long_ignore_comments_true:
|
||||
rules:
|
||||
max_line_length: 10
|
||||
L016:
|
||||
ignore_comment_lines: True
|
||||
ignore_comment_lines: true
|
||||
|
||||
test_pass_line_too_long_ignore_comments_false:
|
||||
# Check we still pick up long comments if we don't want to ignore
|
||||
@@ -95,7 +95,7 @@ test_pass_line_too_long_ignore_comments_false:
|
||||
rules:
|
||||
max_line_length: 10
|
||||
L016:
|
||||
ignore_comment_lines: False
|
||||
ignore_comment_lines: false
|
||||
|
||||
test_compute_line_length_before_template_expansion_1:
|
||||
# Line 3 is fine before expansion. Too long after expansion is NOT considered
|
||||
@@ -141,7 +141,7 @@ test_long_jina_comment:
|
||||
rules:
|
||||
max_line_length: 80
|
||||
L016:
|
||||
ignore_comment_lines: False
|
||||
ignore_comment_lines: false
|
||||
|
||||
|
||||
test_long_jina_comment_ignore:
|
||||
@@ -155,7 +155,7 @@ test_long_jina_comment_ignore:
|
||||
rules:
|
||||
max_line_length: 80
|
||||
L016:
|
||||
ignore_comment_lines: True
|
||||
ignore_comment_lines: true
|
||||
|
||||
|
||||
test_for_loop:
|
||||
|
||||
@@ -21,7 +21,7 @@ passes_on_count_1:
|
||||
configs: &prefer_count_1
|
||||
rules:
|
||||
L047:
|
||||
prefer_count_1: True
|
||||
prefer_count_1: true
|
||||
|
||||
changes_count_0_to_count_star:
|
||||
fail_str: |
|
||||
@@ -52,7 +52,7 @@ passes_on_count_0:
|
||||
configs: &prefer_count_0
|
||||
rules:
|
||||
L047:
|
||||
prefer_count_0: True
|
||||
prefer_count_0: true
|
||||
|
||||
passes_on_count_1_if_both_present:
|
||||
pass_str: |
|
||||
@@ -66,8 +66,8 @@ passes_on_count_1_if_both_present:
|
||||
configs: &prefer_both
|
||||
rules:
|
||||
L047:
|
||||
prefer_count_0: True
|
||||
prefer_count_1: True
|
||||
prefer_count_0: true
|
||||
prefer_count_1: true
|
||||
|
||||
changes_to_count_1_if_both_present:
|
||||
fail_str: |
|
||||
|
||||
@@ -10,7 +10,7 @@ test_pass_semi_colon_custom_newline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_semi_colon_same_line_custom_newline:
|
||||
fail_str: |
|
||||
@@ -23,7 +23,7 @@ test_fail_semi_colon_same_line_custom_newline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_pass_no_semi_colon_default:
|
||||
pass_str: |
|
||||
@@ -35,7 +35,7 @@ test_pass_no_semi_colon_custom_newline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_no_semi_colon_custom_require:
|
||||
fail_str: |
|
||||
@@ -45,7 +45,7 @@ test_fail_no_semi_colon_custom_require:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
require_final_semicolon: true
|
||||
|
||||
test_fail_no_semi_colon_custom_require_oneline:
|
||||
fail_str: |
|
||||
@@ -55,8 +55,8 @@ test_fail_no_semi_colon_custom_require_oneline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_no_semi_colon_custom_require_multiline:
|
||||
fail_str: |
|
||||
@@ -69,8 +69,8 @@ test_fail_no_semi_colon_custom_require_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_pass_multi_statement_semi_colon_default:
|
||||
pass_str: |
|
||||
@@ -98,7 +98,7 @@ test_fail_multi_statement_semi_colon_custom_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_pass_multi_statement_no_trailing_semi_colon_default:
|
||||
pass_str: |
|
||||
@@ -115,7 +115,7 @@ test_pass_multi_statement_no_trailing_semi_colon_custom_require:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
require_final_semicolon: true
|
||||
|
||||
test_fail_multi_statement_no_trailing_semi_colon_custom_require_oneline:
|
||||
fail_str: |
|
||||
@@ -127,8 +127,8 @@ test_fail_multi_statement_no_trailing_semi_colon_custom_require_oneline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_multi_statement_no_trailing_semi_colon_custom_require_multiline:
|
||||
fail_str: |
|
||||
@@ -146,8 +146,8 @@ test_fail_multi_statement_no_trailing_semi_colon_custom_require_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_space_semi_colon_default:
|
||||
fail_str: |
|
||||
@@ -170,7 +170,7 @@ test_pass_newline_semi_colon_custom_newline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_multi_statement_semi_colon_default:
|
||||
fail_str: |
|
||||
@@ -200,8 +200,8 @@ test_fail_multi_statement_semi_colon_custom_require_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_multiple_newlines_semi_colon_custom_require_newline:
|
||||
fail_str: |
|
||||
@@ -216,8 +216,8 @@ test_fail_multiple_newlines_semi_colon_custom_require_newline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_final_semi_colon_same_line_inline_comment:
|
||||
fail_str: |
|
||||
@@ -227,7 +227,7 @@ test_fail_final_semi_colon_same_line_inline_comment:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
require_final_semicolon: true
|
||||
|
||||
test_fail_final_semi_colon_same_line_inline_comment_custom_oneline:
|
||||
fail_str: |
|
||||
@@ -237,8 +237,8 @@ test_fail_final_semi_colon_same_line_inline_comment_custom_oneline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_final_semi_colon_newline_inline_comment_custom_multiline:
|
||||
fail_str: |
|
||||
@@ -251,8 +251,8 @@ test_fail_final_semi_colon_newline_inline_comment_custom_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
require_final_semicolon: True
|
||||
multiline_newline: True
|
||||
require_final_semicolon: true
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_same_line_inline_comment:
|
||||
fail_str: |
|
||||
@@ -280,7 +280,7 @@ test_pass_newline_inline_comment:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_inline_comment:
|
||||
fail_str: |
|
||||
@@ -295,7 +295,7 @@ test_fail_newline_inline_comment:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_multiple_inline_comments_custom_oneline:
|
||||
fail_str: |
|
||||
@@ -311,7 +311,7 @@ test_fail_newline_multiple_inline_comments_custom_oneline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_multiple_inline_comments_custom_multiline:
|
||||
fail_str: |
|
||||
@@ -330,7 +330,7 @@ test_fail_newline_multiple_inline_comments_custom_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_trailing_inline_comment:
|
||||
fail_str: |
|
||||
@@ -343,7 +343,7 @@ test_fail_newline_trailing_inline_comment:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_preceding_block_comment_custom_oneline:
|
||||
fail_str: |
|
||||
@@ -358,7 +358,7 @@ test_fail_newline_preceding_block_comment_custom_oneline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_preceding_block_comment_custom_multiline:
|
||||
fail_str: |
|
||||
@@ -376,7 +376,7 @@ test_fail_newline_preceding_block_comment_custom_multiline:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_trailing_block_comment:
|
||||
fail_str: |
|
||||
@@ -393,7 +393,7 @@ test_fail_newline_trailing_block_comment:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_block_comment_semi_colon_before:
|
||||
fail_str: |
|
||||
@@ -412,7 +412,7 @@ test_fail_newline_block_comment_semi_colon_before:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
test_fail_newline_block_comment_semi_colon_after:
|
||||
fail_str: |
|
||||
@@ -432,4 +432,4 @@ test_fail_newline_block_comment_semi_colon_after:
|
||||
configs:
|
||||
rules:
|
||||
L052:
|
||||
multiline_newline: True
|
||||
multiline_newline: true
|
||||
|
||||
@@ -164,4 +164,3 @@ test_pass_with_inner_join:
|
||||
col1,
|
||||
col2
|
||||
FROM cte;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ test_pass_special_chars_create_table_space_allowed:
|
||||
configs:
|
||||
rules:
|
||||
L057:
|
||||
allow_space_in_identifier: True
|
||||
allow_space_in_identifier: true
|
||||
|
||||
test_fail_special_chars_quoted_policy_alias:
|
||||
fail_str:
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
file:
|
||||
statement:
|
||||
select_statement:
|
||||
select_clause:
|
||||
- keyword: select
|
||||
- select_clause_element:
|
||||
literal: '2'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col2
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '4'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col4
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '6'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col6
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '8'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col8
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '10'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col10
|
||||
statement:
|
||||
select_statement:
|
||||
select_clause:
|
||||
- keyword: select
|
||||
- select_clause_element:
|
||||
literal: '2'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col2
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '4'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col4
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '6'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col6
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '8'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col8
|
||||
- comma: ','
|
||||
- select_clause_element:
|
||||
literal: '10'
|
||||
alias_expression:
|
||||
keyword: as
|
||||
identifier: col10
|
||||
|
||||
7
tox.ini
7
tox.ini
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = generate-fixture-yml, linting, doclinting, docbuild, cov-init, py{37,38,39,310}, dbt{017,018,019,020,021,100}-py{37,38,39,310}, cov-report, bench, mypy, winpy, dbt{017,018,019,020,021,100}-winpy
|
||||
envlist = generate-fixture-yml, linting, doclinting, docbuild, cov-init, py{37,38,39,310}, dbt{017,018,019,020,021,100}-py{37,38,39,310}, cov-report, bench, mypy, winpy, dbt{017,018,019,020,021,100}-winpy, yamllint
|
||||
|
||||
[testenv]
|
||||
passenv = CI CIRCLECI CIRCLE_* HOME SQLFLUFF_BENCHMARK_API_KEY
|
||||
@@ -79,6 +79,11 @@ commands = python test/generate_parse_fixture_yml.py
|
||||
skip_install = true
|
||||
commands = flake8
|
||||
|
||||
[testenv:yamllint]
|
||||
skip_install = true
|
||||
deps = yamllint
|
||||
commands = yamllint -c .yamllint .
|
||||
|
||||
[testenv:doclinting]
|
||||
skip_install = true
|
||||
commands = doc8 docs/source --file-encoding utf8
|
||||
|
||||
Reference in New Issue
Block a user