• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/python/pants/backend/python/lint/bandit/subsystem.py
1
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

UNCOV
4
from __future__ import annotations
×
5

UNCOV
6
from dataclasses import dataclass
×
7

UNCOV
8
from pants.backend.python.goals import lockfile
×
UNCOV
9
from pants.backend.python.lint.bandit.skip_field import SkipBanditField
×
UNCOV
10
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
×
UNCOV
11
from pants.backend.python.target_types import (
×
12
    ConsoleScript,
13
    InterpreterConstraintsField,
14
    PythonResolveField,
15
    PythonSourceField,
16
)
UNCOV
17
from pants.core.goals.resolves import ExportableTool
×
UNCOV
18
from pants.core.util_rules.config_files import ConfigFilesRequest
×
UNCOV
19
from pants.engine.rules import collect_rules
×
UNCOV
20
from pants.engine.target import FieldSet, Target
×
UNCOV
21
from pants.engine.unions import UnionRule
×
UNCOV
22
from pants.option.option_types import ArgsListOption, FileOption, SkipOption
×
23

24

UNCOV
25
@dataclass(frozen=True)
×
UNCOV
26
class BanditFieldSet(FieldSet):
×
UNCOV
27
    required_fields = (PythonSourceField,)
×
28

UNCOV
29
    source: PythonSourceField
×
UNCOV
30
    interpreter_constraints: InterpreterConstraintsField
×
UNCOV
31
    resolve: PythonResolveField
×
32

UNCOV
33
    @classmethod
×
UNCOV
34
    def opt_out(cls, tgt: Target) -> bool:
×
35
        return tgt.get(SkipBanditField).value
×
36

37

UNCOV
38
class Bandit(PythonToolBase):
×
UNCOV
39
    options_scope = "bandit"
×
UNCOV
40
    name = "Bandit"
×
UNCOV
41
    help_short = (
×
42
        "A tool for finding security issues in Python code (https://bandit.readthedocs.io)."
43
    )
44

UNCOV
45
    default_main = ConsoleScript("bandit")
×
UNCOV
46
    default_requirements = [
×
47
        "bandit>=1.7.0,<1.8",
48
        # When upgrading, check if Bandit has started using PEP 517 (a `pyproject.toml` file).
49
        # If so, remove `setuptools` here.
50
        "setuptools",
51
        # GitPython 3.1.20 was yanked because it breaks Python 3.8+, but Poetry's lockfile
52
        # generation still tries to use it.
53
        "GitPython>=3.1.24",
54
    ]
55

UNCOV
56
    default_lockfile_resource = ("pants.backend.python.lint.bandit", "bandit.lock")
×
57

UNCOV
58
    skip = SkipOption("lint")
×
UNCOV
59
    args = ArgsListOption(example="--skip B101,B308 --confidence")
×
UNCOV
60
    config = FileOption(
×
61
        default=None,
62
        advanced=True,
63
        help="Path to a Bandit YAML config file (https://bandit.readthedocs.io/en/latest/config.html).",
64
    )
65

UNCOV
66
    @property
×
UNCOV
67
    def config_request(self) -> ConfigFilesRequest:
×
68
        # Refer to https://bandit.readthedocs.io/en/latest/config.html. Note that there are no
69
        # default locations for Bandit config files.
70
        return ConfigFilesRequest(
×
71
            specified=self.config, specified_option_name=f"{self.options_scope}.config"
72
        )
73

74

UNCOV
75
def rules():
×
UNCOV
76
    return (
×
77
        *collect_rules(),
78
        *lockfile.rules(),
79
        UnionRule(ExportableTool, Bandit),
80
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc