1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, astroid
7, dill
8, isort
9, mccabe
10, platformdirs
11, requests
12, setuptools
13, tomli
14, tomlkit
15, typing-extensions
16, gitpython
17, py
18, pytest-timeout
19, pytest-xdist
20, pytestCheckHook
21}:
22
23buildPythonPackage rec {
24 pname = "pylint";
25 version = "2.16.2";
26 format = "pyproject";
27
28 disabled = pythonOlder "3.7.2";
29
30 src = fetchFromGitHub {
31 owner = "PyCQA";
32 repo = pname;
33 rev = "v${version}";
34 hash = "sha256-xNCGf4CsxEKScIn6dl2Ka31P6bhMo5fTs9TIQz+vPiM=";
35 };
36
37 nativeBuildInputs = [
38 setuptools
39 ];
40
41 propagatedBuildInputs = [
42 astroid
43 dill
44 isort
45 mccabe
46 platformdirs
47 tomlkit
48 ] ++ lib.optionals (pythonOlder "3.11") [
49 tomli
50 ] ++ lib.optionals (pythonOlder "3.9") [
51 typing-extensions
52 ];
53
54 nativeCheckInputs = [
55 gitpython
56 # https://github.com/PyCQA/pylint/blob/main/requirements_test_min.txt
57 py
58 pytest-timeout
59 pytest-xdist
60 pytestCheckHook
61 requests
62 typing-extensions
63 ];
64
65 pytestFlagsArray = [
66 # DeprecationWarning: pyreverse will drop support for resolving and
67 # displaying implemented interfaces in pylint 3.0. The
68 # implementation relies on the '__implements__' attribute proposed
69 # in PEP 245, which was rejected in 2006.
70 "-W" "ignore::DeprecationWarning"
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 # AssertionError when self executing and checking output
88 # expected output looks like it should match though
89 "test_invocation_of_pylint_config"
90 "test_generate_rcfile"
91 "test_generate_toml_config"
92 "test_help_msg"
93 "test_output_of_callback_options"
94 # Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted. The list of emitted warnings is: [].
95 "test_save_and_load_not_a_linter_stats"
96 # Truncated string expectation mismatch
97 "test_truncated_compare"
98 # AssertionError: assert [('specializa..., 'Ancestor')] == [('aggregatio..., 'Ancestor')]
99 "test_functional_relation_extraction"
100 ] ++ lib.optionals stdenv.isDarwin [
101 "test_parallel_execution"
102 "test_py3k_jobs_option"
103 ];
104
105 meta = with lib; {
106 homepage = "https://pylint.pycqa.org/";
107 description = "A bug and style checker for Python";
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 = licenses.gpl1Plus;
118 maintainers = with maintainers; [ SuperSandro2000 ];
119 };
120}