1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, pythonOlder
7, astroid
8, dill
9, isort
10, mccabe
11, platformdirs
12, requests
13, setuptools
14, tomli
15, tomlkit
16, typing-extensions
17, gitpython
18, py
19, pytest-timeout
20, pytest-xdist
21, pytestCheckHook
22, wheel
23}:
24
25buildPythonPackage rec {
26 pname = "pylint";
27 version = "2.17.5";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.7.2";
31
32 src = fetchFromGitHub {
33 owner = "pylint-dev";
34 repo = pname;
35 rev = "v${version}";
36 hash = "sha256-cmH6Q6/XJXx8EXDIsik1Aheu9hYGvvlNvWBUCdmC3P8=";
37 };
38
39 patches = [
40 (fetchpatch {
41 name = "update-setuptools.patch";
42 url = "https://github.com/pylint-dev/pylint/commit/1d029b594aa258fa01570632d001e801f9257d60.patch";
43 hash = "sha256-brQwelZVkSX9h0POH8OJeapZuWZ8p7BY/ZzhYzGbiHY=";
44 })
45 # https://github.com/pylint-dev/pylint/pull/8961
46 (fetchpatch {
47 name = "unpin-setuptools.patch";
48 url = "https://github.com/pylint-dev/pylint/commit/a0ac282d6f8df381cc04adc0a753bec66fc4db63.patch";
49 hash = "sha256-15O72LE2WQK590htNc3jghdbVoGLHUIngERDpqT8pK8=";
50 })
51 ];
52
53 nativeBuildInputs = [
54 setuptools
55 wheel
56 ];
57
58 propagatedBuildInputs = [
59 astroid
60 dill
61 isort
62 mccabe
63 platformdirs
64 tomlkit
65 ] ++ lib.optionals (pythonOlder "3.11") [
66 tomli
67 ] ++ lib.optionals (pythonOlder "3.9") [
68 typing-extensions
69 ];
70
71 nativeCheckInputs = [
72 gitpython
73 # https://github.com/PyCQA/pylint/blob/main/requirements_test_min.txt
74 py
75 pytest-timeout
76 pytest-xdist
77 pytestCheckHook
78 requests
79 typing-extensions
80 ];
81
82 pytestFlagsArray = [
83 # DeprecationWarning: pyreverse will drop support for resolving and
84 # displaying implemented interfaces in pylint 3.0. The
85 # implementation relies on the '__implements__' attribute proposed
86 # in PEP 245, which was rejected in 2006.
87 "-W" "ignore::DeprecationWarning"
88 "-v"
89 ];
90
91 dontUseSetuptoolsCheck = true;
92
93 preCheck = ''
94 export HOME=$TEMPDIR
95 '';
96
97 disabledTestPaths = [
98 "tests/benchmark"
99 # tests miss multiple input files
100 # FileNotFoundError: [Errno 2] No such file or directory
101 "tests/pyreverse/test_writer.py"
102 ];
103
104 disabledTests = [
105 # AssertionError when self executing and checking output
106 # expected output looks like it should match though
107 "test_invocation_of_pylint_config"
108 "test_generate_rcfile"
109 "test_generate_toml_config"
110 "test_help_msg"
111 "test_output_of_callback_options"
112 # Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted. The list of emitted warnings is: [].
113 "test_save_and_load_not_a_linter_stats"
114 # Truncated string expectation mismatch
115 "test_truncated_compare"
116 # AssertionError: assert [('specializa..., 'Ancestor')] == [('aggregatio..., 'Ancestor')]
117 "test_functional_relation_extraction"
118 ] ++ lib.optionals stdenv.isDarwin [
119 "test_parallel_execution"
120 "test_py3k_jobs_option"
121 ];
122
123 meta = with lib; {
124 homepage = "https://pylint.readthedocs.io/en/stable/";
125 description = "A bug and style checker for Python";
126 longDescription = ''
127 Pylint is a Python static code analysis tool which looks for programming errors,
128 helps enforcing a coding standard, sniffs for code smells and offers simple
129 refactoring suggestions.
130 Pylint is shipped with following additional commands:
131 - pyreverse: an UML diagram generator
132 - symilar: an independent similarities checker
133 - epylint: Emacs and Flymake compatible Pylint
134 '';
135 license = licenses.gpl1Plus;
136 maintainers = with maintainers; [ ];
137 };
138}