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