1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, installShellFiles
7, astroid
8, dill
9, isort
10, mccabe
11, platformdirs
12, tomli
13, tomlkit
14, typing-extensions
15, GitPython
16, pytest-timeout
17, pytest-xdist
18, pytestCheckHook
19}:
20
21buildPythonPackage rec {
22 pname = "pylint";
23 version = "2.14.5";
24 format = "setuptools";
25
26 disabled = pythonOlder "3.7.2";
27
28 src = fetchFromGitHub {
29 owner = "PyCQA";
30 repo = pname;
31 rev = "v${version}";
32 sha256 = "sha256-JTFGplqIA6WavwzKOkrm1rHBKNRrplBPvAdEkb/fTlI=";
33 };
34
35 nativeBuildInputs = [
36 installShellFiles
37 ];
38
39 propagatedBuildInputs = [
40 astroid
41 dill
42 isort
43 mccabe
44 platformdirs
45 tomlkit
46 ] ++ lib.optionals (pythonOlder "3.11") [
47 tomli
48 ] ++ lib.optionals (pythonOlder "3.9") [
49 typing-extensions
50 ];
51
52 postInstall = ''
53 mkdir -p $out/share/emacs/site-lisp
54 cp -v "elisp/"*.el $out/share/emacs/site-lisp/
55 installManPage man/*.1
56 '';
57
58 checkInputs = [
59 GitPython
60 # https://github.com/PyCQA/pylint/blob/main/requirements_test_min.txt
61 pytest-timeout
62 pytest-xdist
63 pytestCheckHook
64 typing-extensions
65 ];
66
67 dontUseSetuptoolsCheck = true;
68
69 preCheck = ''
70 export HOME=$TEMPDIR
71 '';
72
73 disabledTestPaths = [
74 "tests/benchmark"
75 # tests miss multiple input files
76 # FileNotFoundError: [Errno 2] No such file or directory
77 "tests/pyreverse/test_writer.py"
78 ];
79
80 disabledTests = [
81 # AssertionError when self executing and checking output
82 # expected output looks like it should match though
83 "test_invocation_of_pylint_config"
84 "test_generate_rcfile"
85 "test_generate_toml_config"
86 "test_help_msg"
87 "test_output_of_callback_options"
88 # Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted. The list of emitted warnings is: [].
89 "test_save_and_load_not_a_linter_stats"
90 ] ++ lib.optionals stdenv.isDarwin [
91 "test_parallel_execution"
92 "test_py3k_jobs_option"
93 ];
94
95 meta = with lib; {
96 homepage = "https://pylint.pycqa.org/";
97 description = "A bug and style checker for Python";
98 longDescription = ''
99 Pylint is a Python static code analysis tool which looks for programming errors,
100 helps enforcing a coding standard, sniffs for code smells and offers simple
101 refactoring suggestions.
102 Pylint is shipped with following additional commands:
103 - pyreverse: an UML diagram generator
104 - symilar: an independent similarities checker
105 - epylint: Emacs and Flymake compatible Pylint
106 '';
107 license = licenses.gpl1Plus;
108 maintainers = with maintainers; [ SuperSandro2000 ];
109 };
110}