antsibull-nox 0.2.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. antsibull_nox/__init__.py +7 -51
  2. antsibull_nox/_pydantic.py +98 -0
  3. antsibull_nox/ansible.py +15 -0
  4. antsibull_nox/cli.py +132 -0
  5. antsibull_nox/collection/__init__.py +2 -2
  6. antsibull_nox/collection/data.py +12 -0
  7. antsibull_nox/collection/install.py +194 -79
  8. antsibull_nox/collection/search.py +136 -34
  9. antsibull_nox/config.py +51 -2
  10. antsibull_nox/data/action-groups.py +2 -2
  11. antsibull_nox/data/antsibull-nox-lint-config.py +29 -0
  12. antsibull_nox/data/file-yamllint.py +138 -0
  13. antsibull_nox/data/license-check.py +5 -1
  14. antsibull_nox/data/plugin-yamllint.py +54 -24
  15. antsibull_nox/init.py +83 -0
  16. antsibull_nox/interpret_config.py +29 -8
  17. antsibull_nox/lint_config.py +113 -0
  18. antsibull_nox/sessions/__init__.py +70 -0
  19. antsibull_nox/sessions/ansible_lint.py +60 -0
  20. antsibull_nox/sessions/ansible_test.py +559 -0
  21. antsibull_nox/sessions/build_import_check.py +147 -0
  22. antsibull_nox/sessions/collections.py +145 -0
  23. antsibull_nox/sessions/docs_check.py +78 -0
  24. antsibull_nox/sessions/extra_checks.py +127 -0
  25. antsibull_nox/sessions/license_check.py +73 -0
  26. antsibull_nox/sessions/lint.py +694 -0
  27. antsibull_nox/sessions/utils.py +206 -0
  28. {antsibull_nox-0.2.0.dist-info → antsibull_nox-0.4.0.dist-info}/METADATA +2 -2
  29. antsibull_nox-0.4.0.dist-info/RECORD +41 -0
  30. antsibull_nox-0.4.0.dist-info/entry_points.txt +2 -0
  31. antsibull_nox/sessions.py +0 -1712
  32. antsibull_nox-0.2.0.dist-info/RECORD +0 -25
  33. {antsibull_nox-0.2.0.dist-info → antsibull_nox-0.4.0.dist-info}/WHEEL +0 -0
  34. {antsibull_nox-0.2.0.dist-info → antsibull_nox-0.4.0.dist-info}/licenses/LICENSES/GPL-3.0-or-later.txt +0 -0
@@ -0,0 +1,694 @@
1
+ # Author: Felix Fontein <felix@fontein.de>
2
+ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
3
+ # https://www.gnu.org/licenses/gpl-3.0.txt)
4
+ # SPDX-License-Identifier: GPL-3.0-or-later
5
+ # SPDX-FileCopyrightText: 2025, Ansible Project
6
+
7
+ """
8
+ Create nox lint sessions.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import os
15
+ import shlex
16
+ from pathlib import Path
17
+
18
+ import nox
19
+
20
+ from ..paths import (
21
+ filter_paths,
22
+ list_all_files,
23
+ )
24
+ from .collections import (
25
+ CollectionSetup,
26
+ prepare_collections,
27
+ )
28
+ from .utils import (
29
+ IN_CI,
30
+ compose_description,
31
+ install,
32
+ run_bare_script,
33
+ silence_run_verbosity,
34
+ )
35
+
36
+ CODE_FILES = [
37
+ "plugins",
38
+ "tests/unit",
39
+ ]
40
+
41
+ MODULE_PATHS = [
42
+ "plugins/modules/",
43
+ "plugins/module_utils/",
44
+ "tests/unit/plugins/modules/",
45
+ "tests/unit/plugins/module_utils/",
46
+ ]
47
+
48
+
49
+ def add_lint(
50
+ *,
51
+ make_lint_default: bool,
52
+ has_formatters: bool,
53
+ has_codeqa: bool,
54
+ has_yamllint: bool,
55
+ has_typing: bool,
56
+ has_config_lint: bool,
57
+ ) -> None:
58
+ """
59
+ Add nox meta session for linting.
60
+ """
61
+
62
+ def lint(session: nox.Session) -> None: # pylint: disable=unused-argument
63
+ pass # this session is deliberately empty
64
+
65
+ dependent_sessions = []
66
+ if has_formatters:
67
+ dependent_sessions.append("formatters")
68
+ if has_codeqa:
69
+ dependent_sessions.append("codeqa")
70
+ if has_yamllint:
71
+ dependent_sessions.append("yamllint")
72
+ if has_typing:
73
+ dependent_sessions.append("typing")
74
+ if has_config_lint:
75
+ dependent_sessions.append("antsibull-nox-config")
76
+
77
+ lint.__doc__ = compose_description(
78
+ prefix={
79
+ "one": "Meta session for triggering the following session:",
80
+ "other": "Meta session for triggering the following sessions:",
81
+ },
82
+ programs={
83
+ "formatters": has_formatters,
84
+ "codeqa": has_codeqa,
85
+ "yamllint": has_yamllint,
86
+ "typing": has_typing,
87
+ "antsibull-nox-config": has_config_lint,
88
+ },
89
+ )
90
+ nox.session(
91
+ name="lint",
92
+ default=make_lint_default,
93
+ requires=dependent_sessions,
94
+ )(lint)
95
+
96
+
97
+ def add_formatters(
98
+ *,
99
+ extra_code_files: list[str],
100
+ # isort:
101
+ run_isort: bool,
102
+ isort_config: str | os.PathLike | None,
103
+ isort_package: str,
104
+ # black:
105
+ run_black: bool,
106
+ run_black_modules: bool | None,
107
+ black_config: str | os.PathLike | None,
108
+ black_package: str,
109
+ ) -> None:
110
+ """
111
+ Add nox session for formatters.
112
+ """
113
+ if run_black_modules is None:
114
+ run_black_modules = run_black
115
+ run_check = IN_CI
116
+
117
+ def compose_dependencies() -> list[str]:
118
+ deps = []
119
+ if run_isort:
120
+ deps.append(isort_package)
121
+ if run_black or run_black_modules:
122
+ deps.append(black_package)
123
+ return deps
124
+
125
+ def execute_isort(session: nox.Session) -> None:
126
+ command: list[str] = [
127
+ "isort",
128
+ ]
129
+ if run_check:
130
+ command.append("--check")
131
+ if isort_config is not None:
132
+ command.extend(["--settings-file", str(isort_config)])
133
+ command.extend(session.posargs)
134
+ command.extend(filter_paths(CODE_FILES + ["noxfile.py"] + extra_code_files))
135
+ session.run(*command)
136
+
137
+ def execute_black_for(session: nox.Session, paths: list[str]) -> None:
138
+ if not paths:
139
+ return
140
+ command = ["black"]
141
+ if run_check:
142
+ command.append("--check")
143
+ if black_config is not None:
144
+ command.extend(["--config", str(black_config)])
145
+ command.extend(session.posargs)
146
+ command.extend(paths)
147
+ session.run(*command)
148
+
149
+ def execute_black(session: nox.Session) -> None:
150
+ if run_black and run_black_modules:
151
+ execute_black_for(
152
+ session, filter_paths(CODE_FILES + ["noxfile.py"] + extra_code_files)
153
+ )
154
+ return
155
+ if run_black:
156
+ paths = (
157
+ filter_paths(
158
+ CODE_FILES,
159
+ remove=MODULE_PATHS,
160
+ extensions=[".py"],
161
+ )
162
+ + ["noxfile.py"]
163
+ + extra_code_files
164
+ )
165
+ execute_black_for(session, paths)
166
+ if run_black_modules:
167
+ paths = filter_paths(
168
+ CODE_FILES,
169
+ restrict=MODULE_PATHS,
170
+ extensions=[".py"],
171
+ )
172
+ execute_black_for(session, paths)
173
+
174
+ def formatters(session: nox.Session) -> None:
175
+ install(session, *compose_dependencies())
176
+ if run_isort:
177
+ execute_isort(session)
178
+ if run_black or run_black_modules:
179
+ execute_black(session)
180
+
181
+ formatters.__doc__ = compose_description(
182
+ prefix={
183
+ "one": "Run code formatter:",
184
+ "other": "Run code formatters:",
185
+ },
186
+ programs={
187
+ "isort": run_isort,
188
+ "black": run_black,
189
+ },
190
+ )
191
+ nox.session(name="formatters", default=False)(formatters)
192
+
193
+
194
+ def process_pylint_errors(
195
+ session: nox.Session,
196
+ prepared_collections: CollectionSetup,
197
+ output: str,
198
+ ) -> None:
199
+ """
200
+ Process errors reported by pylint in 'json2' format.
201
+ """
202
+ data = json.loads(output)
203
+ found_error = False
204
+ if data["messages"]:
205
+ for message in data["messages"]:
206
+ path = os.path.relpath(
207
+ message["absolutePath"], prepared_collections.current_path
208
+ )
209
+ prefix = f"{path}:{message['line']}:{message['column']}: [{message['messageId']}]"
210
+ print(f"{prefix} {message['message']} [{message['symbol']}]")
211
+ found_error = True
212
+ if found_error:
213
+ session.error("Pylint failed")
214
+
215
+
216
+ def add_codeqa( # noqa: C901
217
+ *,
218
+ extra_code_files: list[str],
219
+ # flake8:
220
+ run_flake8: bool,
221
+ flake8_config: str | os.PathLike | None,
222
+ flake8_package: str,
223
+ # pylint:
224
+ run_pylint: bool,
225
+ pylint_rcfile: str | os.PathLike | None,
226
+ pylint_modules_rcfile: str | os.PathLike | None,
227
+ pylint_package: str,
228
+ pylint_ansible_core_package: str | None,
229
+ pylint_extra_deps: list[str],
230
+ ) -> None:
231
+ """
232
+ Add nox session for codeqa.
233
+ """
234
+
235
+ def compose_dependencies() -> list[str]:
236
+ deps = []
237
+ if run_flake8:
238
+ deps.append(flake8_package)
239
+ if run_pylint:
240
+ deps.append(pylint_package)
241
+ if pylint_ansible_core_package is not None:
242
+ deps.append(pylint_ansible_core_package)
243
+ if os.path.isdir("tests/unit"):
244
+ deps.append("pytest")
245
+ if os.path.isfile("tests/unit/requirements.txt"):
246
+ deps.extend(["-r", "tests/unit/requirements.txt"])
247
+ for extra_dep in pylint_extra_deps:
248
+ deps.extend(shlex.split(extra_dep))
249
+ return deps
250
+
251
+ def execute_flake8(session: nox.Session) -> None:
252
+ command: list[str] = [
253
+ "flake8",
254
+ ]
255
+ if flake8_config is not None:
256
+ command.extend(["--config", str(flake8_config)])
257
+ command.extend(session.posargs)
258
+ command.extend(filter_paths(CODE_FILES + ["noxfile.py"] + extra_code_files))
259
+ session.run(*command)
260
+
261
+ def execute_pylint_impl(
262
+ session: nox.Session,
263
+ prepared_collections: CollectionSetup,
264
+ config: os.PathLike | str | None,
265
+ paths: list[str],
266
+ ) -> None:
267
+ command = ["pylint"]
268
+ if config is not None:
269
+ command.extend(
270
+ [
271
+ "--rcfile",
272
+ os.path.join(prepared_collections.current_collection.path, config),
273
+ ]
274
+ )
275
+ command.extend(["--source-roots", "."])
276
+ command.extend(["--output-format", "json2"])
277
+ command.extend(session.posargs)
278
+ command.extend(prepared_collections.prefix_current_paths(paths))
279
+ with silence_run_verbosity():
280
+ # Exit code is OR of some of 1, 2, 4, 8, 16
281
+ output = session.run(
282
+ *command, silent=True, success_codes=list(range(0, 32))
283
+ )
284
+
285
+ if output:
286
+ process_pylint_errors(session, prepared_collections, output)
287
+
288
+ def execute_pylint(
289
+ session: nox.Session, prepared_collections: CollectionSetup
290
+ ) -> None:
291
+ if pylint_modules_rcfile is not None and pylint_modules_rcfile != pylint_rcfile:
292
+ # Only run pylint twice when using different configurations
293
+ module_paths = filter_paths(
294
+ CODE_FILES, restrict=MODULE_PATHS, extensions=[".py"]
295
+ )
296
+ other_paths = filter_paths(
297
+ CODE_FILES, remove=MODULE_PATHS, extensions=[".py"]
298
+ )
299
+ else:
300
+ # Otherwise run it only once using the general configuration
301
+ module_paths = []
302
+ other_paths = filter_paths(CODE_FILES)
303
+
304
+ with session.chdir(prepared_collections.current_place):
305
+ if module_paths:
306
+ execute_pylint_impl(
307
+ session,
308
+ prepared_collections,
309
+ pylint_modules_rcfile or pylint_rcfile,
310
+ module_paths,
311
+ )
312
+
313
+ if other_paths:
314
+ execute_pylint_impl(
315
+ session, prepared_collections, pylint_rcfile, other_paths
316
+ )
317
+
318
+ def codeqa(session: nox.Session) -> None:
319
+ install(session, *compose_dependencies())
320
+ prepared_collections: CollectionSetup | None = None
321
+ if run_pylint:
322
+ prepared_collections = prepare_collections(
323
+ session,
324
+ install_in_site_packages=False,
325
+ extra_deps_files=["tests/unit/requirements.yml"],
326
+ )
327
+ if not prepared_collections:
328
+ session.warn("Skipping pylint...")
329
+ if run_flake8:
330
+ execute_flake8(session)
331
+ if run_pylint and prepared_collections:
332
+ execute_pylint(session, prepared_collections)
333
+
334
+ codeqa.__doc__ = compose_description(
335
+ prefix={
336
+ "other": "Run code QA:",
337
+ },
338
+ programs={
339
+ "flake8": run_flake8,
340
+ "pylint": run_pylint,
341
+ },
342
+ )
343
+ nox.session(name="codeqa", default=False)(codeqa)
344
+
345
+
346
+ def add_yamllint(
347
+ *,
348
+ run_yamllint: bool,
349
+ yamllint_config: str | os.PathLike | None,
350
+ yamllint_config_plugins: str | os.PathLike | None,
351
+ yamllint_config_plugins_examples: str | os.PathLike | None,
352
+ yamllint_package: str,
353
+ ) -> None:
354
+ """
355
+ Add yamllint session for linting YAML files and plugin/module docs.
356
+ """
357
+
358
+ def compose_dependencies() -> list[str]:
359
+ deps = []
360
+ if run_yamllint:
361
+ deps.append(yamllint_package)
362
+ return deps
363
+
364
+ def to_str(config: str | os.PathLike | None) -> str | None:
365
+ return str(config) if config else None
366
+
367
+ def execute_yamllint(session: nox.Session) -> None:
368
+ # Run yamllint
369
+ all_files = list_all_files()
370
+ all_yaml_filenames = [
371
+ file for file in all_files if file.name.lower().endswith((".yml", ".yaml"))
372
+ ]
373
+ if not all_yaml_filenames:
374
+ session.warn("Skipping yamllint since no YAML file was found...")
375
+ return
376
+
377
+ run_bare_script(
378
+ session,
379
+ "file-yamllint",
380
+ use_session_python=True,
381
+ files=all_yaml_filenames,
382
+ extra_data={
383
+ "config": to_str(yamllint_config),
384
+ },
385
+ )
386
+
387
+ def execute_plugin_yamllint(session: nox.Session) -> None:
388
+ # Run yamllint
389
+ all_files = list_all_files()
390
+ cwd = Path.cwd()
391
+ plugins_dir = cwd / "plugins"
392
+ ignore_dirs = [
393
+ plugins_dir / "action",
394
+ plugins_dir / "module_utils",
395
+ plugins_dir / "plugin_utils",
396
+ ]
397
+ all_plugin_files = [
398
+ file
399
+ for file in all_files
400
+ if file.is_relative_to(plugins_dir)
401
+ and file.name.lower().endswith((".py", ".yml", ".yaml"))
402
+ and not any(file.is_relative_to(dir) for dir in ignore_dirs)
403
+ ]
404
+ if not all_plugin_files:
405
+ session.warn(
406
+ "Skipping yamllint for modules/plugins since"
407
+ " no appropriate Python file was found..."
408
+ )
409
+ return
410
+ run_bare_script(
411
+ session,
412
+ "plugin-yamllint",
413
+ use_session_python=True,
414
+ files=all_plugin_files,
415
+ extra_data={
416
+ "config": to_str(yamllint_config_plugins or yamllint_config),
417
+ "config_examples": to_str(
418
+ yamllint_config_plugins_examples
419
+ or yamllint_config_plugins
420
+ or yamllint_config
421
+ ),
422
+ },
423
+ )
424
+
425
+ def yamllint(session: nox.Session) -> None:
426
+ install(session, *compose_dependencies())
427
+ if run_yamllint:
428
+ execute_yamllint(session)
429
+ execute_plugin_yamllint(session)
430
+
431
+ yamllint.__doc__ = compose_description(
432
+ prefix={
433
+ "one": "Run YAML checker:",
434
+ "other": "Run YAML checkers:",
435
+ },
436
+ programs={
437
+ "yamllint": run_yamllint,
438
+ },
439
+ )
440
+ nox.session(name="yamllint", default=False)(yamllint)
441
+
442
+
443
+ def process_mypy_errors(
444
+ session: nox.Session,
445
+ prepared_collections: CollectionSetup,
446
+ output: str,
447
+ ) -> None:
448
+ """
449
+ Process errors reported by mypy in 'json' format.
450
+ """
451
+ found_error = False
452
+ for line in output.splitlines():
453
+ if not line.strip():
454
+ continue
455
+ try:
456
+ data = json.loads(line)
457
+ path = os.path.relpath(
458
+ prepared_collections.current_place / data["file"],
459
+ prepared_collections.current_path,
460
+ )
461
+ prefix = f"{path}:{data['line']}:{data['column']}: [{data['severity']}]"
462
+ if data["code"]:
463
+ print(f"{prefix} {data['message']} [{data['code']}]")
464
+ else:
465
+ print(f"{prefix} {data['message']}")
466
+ if data["hint"]:
467
+ prefix = " " * len(prefix)
468
+ for hint in data["hint"].splitlines():
469
+ print(f"{prefix} {hint}")
470
+ except Exception: # pylint: disable=broad-exception-caught
471
+ session.warn(f"Cannot parse mypy output: {line}")
472
+ found_error = True
473
+ if found_error:
474
+ session.error("Type checking failed")
475
+
476
+
477
+ def add_typing(
478
+ *,
479
+ extra_code_files: list[str],
480
+ run_mypy: bool,
481
+ mypy_config: str | os.PathLike | None,
482
+ mypy_package: str,
483
+ mypy_ansible_core_package: str | None,
484
+ mypy_extra_deps: list[str],
485
+ ) -> None:
486
+ """
487
+ Add nox session for typing.
488
+ """
489
+
490
+ def compose_dependencies() -> list[str]:
491
+ deps = []
492
+ if run_mypy:
493
+ deps.append(mypy_package)
494
+ if mypy_ansible_core_package is not None:
495
+ deps.append(mypy_ansible_core_package)
496
+ if os.path.isdir("tests/unit"):
497
+ deps.append("pytest")
498
+ if os.path.isfile("tests/unit/requirements.txt"):
499
+ deps.extend(["-r", "tests/unit/requirements.txt"])
500
+ for extra_dep in mypy_extra_deps:
501
+ deps.extend(shlex.split(extra_dep))
502
+ return deps
503
+
504
+ def execute_mypy(
505
+ session: nox.Session, prepared_collections: CollectionSetup
506
+ ) -> None:
507
+ # Run mypy
508
+ with session.chdir(prepared_collections.current_place):
509
+ command = ["mypy"]
510
+ if mypy_config is not None:
511
+ command.extend(
512
+ [
513
+ "--config-file",
514
+ os.path.join(
515
+ prepared_collections.current_collection.path, mypy_config
516
+ ),
517
+ ]
518
+ )
519
+ command.append("--namespace-packages")
520
+ command.append("--explicit-package-bases")
521
+ command.extend(["--output", "json"])
522
+ command.extend(session.posargs)
523
+ command.extend(
524
+ prepared_collections.prefix_current_paths(CODE_FILES + extra_code_files)
525
+ )
526
+ with silence_run_verbosity():
527
+ output = session.run(
528
+ *command,
529
+ env={"MYPYPATH": str(prepared_collections.current_place)},
530
+ silent=True,
531
+ success_codes=(0, 1, 2),
532
+ )
533
+
534
+ if output:
535
+ process_mypy_errors(session, prepared_collections, output)
536
+
537
+ def typing(session: nox.Session) -> None:
538
+ install(session, *compose_dependencies())
539
+ prepared_collections = prepare_collections(
540
+ session,
541
+ install_in_site_packages=False,
542
+ extra_deps_files=["tests/unit/requirements.yml"],
543
+ )
544
+ if not prepared_collections:
545
+ session.warn("Skipping mypy...")
546
+ if run_mypy and prepared_collections:
547
+ execute_mypy(session, prepared_collections)
548
+
549
+ typing.__doc__ = compose_description(
550
+ prefix={
551
+ "one": "Run type checker:",
552
+ "other": "Run type checkers:",
553
+ },
554
+ programs={
555
+ "mypy": run_mypy,
556
+ },
557
+ )
558
+ nox.session(name="typing", default=False)(typing)
559
+
560
+
561
+ def add_config_lint(
562
+ *,
563
+ run_antsibullnox_config_lint: bool,
564
+ ):
565
+ """
566
+ Add nox session for antsibull-nox config linting.
567
+ """
568
+
569
+ def antsibull_nox_config(session: nox.Session) -> None:
570
+ if run_antsibullnox_config_lint:
571
+ run_bare_script(
572
+ session,
573
+ "antsibull-nox-lint-config",
574
+ )
575
+
576
+ session.run("antsibull-nox", "lint-config")
577
+
578
+ antsibull_nox_config.__doc__ = "Lint antsibull-nox config"
579
+ nox.session(name="antsibull-nox-config", python=False, default=False)(
580
+ antsibull_nox_config
581
+ )
582
+
583
+
584
+ def add_lint_sessions(
585
+ *,
586
+ make_lint_default: bool = True,
587
+ extra_code_files: list[str] | None = None,
588
+ # isort:
589
+ run_isort: bool = True,
590
+ isort_config: str | os.PathLike | None = None,
591
+ isort_package: str = "isort",
592
+ # black:
593
+ run_black: bool = True,
594
+ run_black_modules: bool | None = None,
595
+ black_config: str | os.PathLike | None = None,
596
+ black_package: str = "black",
597
+ # flake8:
598
+ run_flake8: bool = True,
599
+ flake8_config: str | os.PathLike | None = None,
600
+ flake8_package: str = "flake8",
601
+ # pylint:
602
+ run_pylint: bool = True,
603
+ pylint_rcfile: str | os.PathLike | None = None,
604
+ pylint_modules_rcfile: str | os.PathLike | None = None,
605
+ pylint_package: str = "pylint",
606
+ pylint_ansible_core_package: str | None = "ansible-core",
607
+ pylint_extra_deps: list[str] | None = None,
608
+ # yamllint:
609
+ run_yamllint: bool = False,
610
+ yamllint_config: str | os.PathLike | None = None,
611
+ yamllint_config_plugins: str | os.PathLike | None = None,
612
+ yamllint_config_plugins_examples: str | os.PathLike | None = None,
613
+ yamllint_package: str = "yamllint",
614
+ # mypy:
615
+ run_mypy: bool = True,
616
+ mypy_config: str | os.PathLike | None = None,
617
+ mypy_package: str = "mypy",
618
+ mypy_ansible_core_package: str | None = "ansible-core",
619
+ mypy_extra_deps: list[str] | None = None,
620
+ # antsibull-nox config lint:
621
+ run_antsibullnox_config_lint: bool = True,
622
+ ) -> None:
623
+ """
624
+ Add nox sessions for linting.
625
+ """
626
+ has_formatters = run_isort or run_black or run_black_modules or False
627
+ has_codeqa = run_flake8 or run_pylint
628
+ has_yamllint = run_yamllint
629
+ has_typing = run_mypy
630
+ has_config_lint = run_antsibullnox_config_lint
631
+
632
+ add_lint(
633
+ has_formatters=has_formatters,
634
+ has_codeqa=has_codeqa,
635
+ has_yamllint=has_yamllint,
636
+ has_typing=has_typing,
637
+ has_config_lint=has_config_lint,
638
+ make_lint_default=make_lint_default,
639
+ )
640
+
641
+ if has_formatters:
642
+ add_formatters(
643
+ extra_code_files=extra_code_files or [],
644
+ run_isort=run_isort,
645
+ isort_config=isort_config,
646
+ isort_package=isort_package,
647
+ run_black=run_black,
648
+ run_black_modules=run_black_modules,
649
+ black_config=black_config,
650
+ black_package=black_package,
651
+ )
652
+
653
+ if has_codeqa:
654
+ add_codeqa(
655
+ extra_code_files=extra_code_files or [],
656
+ run_flake8=run_flake8,
657
+ flake8_config=flake8_config,
658
+ flake8_package=flake8_package,
659
+ run_pylint=run_pylint,
660
+ pylint_rcfile=pylint_rcfile,
661
+ pylint_modules_rcfile=pylint_modules_rcfile,
662
+ pylint_package=pylint_package,
663
+ pylint_ansible_core_package=pylint_ansible_core_package,
664
+ pylint_extra_deps=pylint_extra_deps or [],
665
+ )
666
+
667
+ if has_yamllint:
668
+ add_yamllint(
669
+ run_yamllint=run_yamllint,
670
+ yamllint_config=yamllint_config,
671
+ yamllint_config_plugins=yamllint_config_plugins,
672
+ yamllint_config_plugins_examples=yamllint_config_plugins_examples,
673
+ yamllint_package=yamllint_package,
674
+ )
675
+
676
+ if has_typing:
677
+ add_typing(
678
+ extra_code_files=extra_code_files or [],
679
+ run_mypy=run_mypy,
680
+ mypy_config=mypy_config,
681
+ mypy_package=mypy_package,
682
+ mypy_ansible_core_package=mypy_ansible_core_package,
683
+ mypy_extra_deps=mypy_extra_deps or [],
684
+ )
685
+
686
+ if has_config_lint:
687
+ add_config_lint(
688
+ run_antsibullnox_config_lint=run_antsibullnox_config_lint,
689
+ )
690
+
691
+
692
+ __all__ = [
693
+ "add_lint_sessions",
694
+ ]