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