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