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.3.6";
27 pyproject = true;
28
29 disabled = pythonOlder "3.8";
30
31 src = fetchFromGitHub {
32 owner = "pylint-dev";
33 repo = "pylint";
34 tag = "v${version}";
35 hash = "sha256-c1Nh5g2ykvE+EmnSgpN3J7qMHPz93LZ0/snyIaYmPq4=";
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 preCheck = ''
74 export HOME=$TEMPDIR
75 '';
76
77 disabledTestPaths = [
78 "tests/benchmark"
79 # tests miss multiple input files
80 # FileNotFoundError: [Errno 2] No such file or directory
81 "tests/pyreverse/test_writer.py"
82 ];
83
84 disabledTests =
85 [
86 # AssertionError when self executing and checking output
87 # expected output looks like it should match though
88 "test_invocation_of_pylint_config"
89 "test_generate_rcfile"
90 "test_generate_toml_config"
91 "test_help_msg"
92 "test_output_of_callback_options"
93 # Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted. The list of emitted warnings is: [].
94 "test_save_and_load_not_a_linter_stats"
95 # Truncated string expectation mismatch
96 "test_truncated_compare"
97 # Probably related to pytest versions, see pylint-dev/pylint#9477 and pylint-dev/pylint#9483
98 "test_functional"
99 # AssertionError: assert [('specializa..., 'Ancestor')] == [('aggregatio..., 'Ancestor')]
100 "test_functional_relation_extraction"
101 ]
102 ++ lib.optionals stdenv.hostPlatform.isDarwin [
103 "test_parallel_execution"
104 "test_py3k_jobs_option"
105 ];
106
107 meta = {
108 description = "Bug and style checker for Python";
109 homepage = "https://pylint.readthedocs.io/en/stable/";
110 changelog = "https://github.com/pylint-dev/pylint/releases/tag/v${version}";
111 longDescription = ''
112 Pylint is a Python static code analysis tool which looks for programming errors,
113 helps enforcing a coding standard, sniffs for code smells and offers simple
114 refactoring suggestions.
115 Pylint is shipped with following additional commands:
116 - pyreverse: an UML diagram generator
117 - symilar: an independent similarities checker
118 - epylint: Emacs and Flymake compatible Pylint
119 '';
120 license = lib.licenses.gpl2Plus;
121 maintainers = [ ];
122 mainProgram = "pylint";
123 };
124}