1{ lib
2, fetchFromGitHub
3, python3
4}:
5
6python3.pkgs.buildPythonApplication rec {
7 pname = "sqlfluff";
8 version = "2.1.1";
9 format = "setuptools";
10
11 src = fetchFromGitHub {
12 owner = pname;
13 repo = pname;
14 rev = "refs/tags/${version}";
15 hash = "sha256-WNQ9rcy3dqfZjLdqjpl5erSxLgQjYc/sy293DfzoenM=";
16 };
17
18 propagatedBuildInputs = with python3.pkgs; [
19 appdirs
20 cached-property
21 chardet
22 click
23 colorama
24 configparser
25 diff-cover
26 jinja2
27 oyaml
28 pathspec
29 pytest
30 regex
31 tblib
32 toml
33 tqdm
34 typing-extensions
35 ] ++ lib.optionals (pythonOlder "3.8") [
36 backports.cached-property
37 importlib_metadata
38 ];
39
40 nativeCheckInputs = with python3.pkgs; [
41 hypothesis
42 pytestCheckHook
43 ];
44
45 disabledTestPaths = [
46 # Don't run the plugin related tests
47 "plugins/sqlfluff-plugin-example/test/rules/rule_test_cases_test.py"
48 "plugins/sqlfluff-templater-dbt"
49 "test/core/plugin_test.py"
50 "test/diff_quality_plugin_test.py"
51 ];
52
53 disabledTests = [
54 # dbt is not available yet
55 "test__linter__skip_dbt_model_disabled"
56 "test_rules__test_helper_has_variable_introspection"
57 "test__rules__std_file_dbt"
58 ];
59
60 pythonImportsCheck = [
61 "sqlfluff"
62 ];
63
64 meta = with lib; {
65 description = "SQL linter and auto-formatter";
66 homepage = "https://www.sqlfluff.com/";
67 changelog = "https://github.com/sqlfluff/sqlfluff/blob/${version}/CHANGELOG.md";
68 license = with licenses; [ mit ];
69 maintainers = with maintainers; [ fab ];
70 };
71}