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

pantsbuild / pants / 23173035367

17 Mar 2026 12:47AM UTC coverage: 91.371% (-1.6%) from 92.933%
23173035367

push

github

web-flow
update helm (and friends) to a recent 3.x seies (#23143)

v4 is a major breaking change, so holding off on that. (There was also
just a 3.20, but 3.19 has this reassuring series of bug fixes and was
also quite recent.)

2 of 2 new or added lines in 2 files covered. (100.0%)

1263 existing lines in 73 files now uncovered.

86196 of 94336 relevant lines covered (91.37%)

3.87 hits per line

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

97.56
/src/python/pants/backend/project_info/count_loc.py
1
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from pants.core.goals.resolves import ExportableTool
5✔
4
from pants.core.util_rules.external_tool import TemplatedExternalTool, download_external_tool
5✔
5
from pants.engine.console import Console
5✔
6
from pants.engine.fs import MergeDigests, PathGlobs, SpecsPaths
5✔
7
from pants.engine.goal import Goal, GoalSubsystem
5✔
8
from pants.engine.intrinsics import merge_digests, path_globs_to_digest
5✔
9
from pants.engine.platform import Platform
5✔
10
from pants.engine.process import Process, execute_process_or_raise
5✔
11
from pants.engine.rules import collect_rules, concurrently, goal_rule, implicitly
5✔
12
from pants.engine.unions import UnionRule
5✔
13
from pants.option.option_types import ArgsListOption
5✔
14
from pants.util.logging import LogLevel
5✔
15
from pants.util.strutil import pluralize
5✔
16

17

18
class SuccinctCodeCounter(TemplatedExternalTool):
5✔
19
    options_scope = "scc"
5✔
20
    name = "SCC"
5✔
21
    help = "The Succinct Code Counter, aka `scc` (https://github.com/boyter/scc)."
5✔
22

23
    default_version = "3.0.0"
5✔
24
    default_known_versions = [
5✔
25
        "3.0.0|linux_arm64 |04f9e797b70a678833e49df5e744f95080dfb7f963c0cd34f5b5d4712d290f33|1768037",
26
        "3.0.0|linux_x86_64|13ca47ce00b5bd032f97f3af7aa8eb3c717b8972b404b155a378b09110e4aa0c|1948341",
27
        "3.0.0|macos_arm64 |846cb1b25025a0794d455719bc17cfb3f588576a58af1d95036f6c654e294f98|2006145",
28
        "3.0.0|macos_x86_64|9c3064e477ab36e16204ad34f649372034bca4df669615eff5de4aa05b2ddf1a|2048134",
29
    ]
30
    default_url_template = (
5✔
31
        "https://github.com/boyter/scc/releases/download/v{version}/scc-{version}-{platform}.zip"
32
    )
33
    default_url_platform_mapping = {
5✔
34
        "macos_arm64": "arm64-apple-darwin",
35
        "macos_x86_64": "x86_64-apple-darwin",
36
        "linux_arm64": "arm64-unknown-linux",
37
        "linux_x86_64": "x86_64-unknown-linux",
38
    }
39

40
    args = ArgsListOption(
5✔
41
        example="--no-cocomo",
42
        passthrough=True,
43
        extra_help="Refer to to https://github.com/boyter/scc.",
44
    )
45

46
    def generate_exe(self, _: Platform) -> str:
5✔
47
        return "./scc"
2✔
48

49

50
class CountLinesOfCodeSubsystem(GoalSubsystem):
5✔
51
    name = "count-loc"
5✔
52
    help = "Count lines of code."
5✔
53

54

55
class CountLinesOfCode(Goal):
5✔
56
    subsystem_cls = CountLinesOfCodeSubsystem
5✔
57
    environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY
5✔
58

59

60
@goal_rule
5✔
61
async def count_loc(
5✔
62
    console: Console,
63
    succinct_code_counter: SuccinctCodeCounter,
64
    specs_paths: SpecsPaths,
65
    platform: Platform,
66
) -> CountLinesOfCode:
67
    if not specs_paths.files:
2✔
UNCOV
68
        return CountLinesOfCode(exit_code=0)
×
69

70
    specs_digest, scc_program = await concurrently(
2✔
71
        path_globs_to_digest(PathGlobs(globs=specs_paths.files)),
72
        download_external_tool(succinct_code_counter.get_request(platform)),
73
    )
74
    input_digest = await merge_digests(MergeDigests((scc_program.digest, specs_digest)))
2✔
75
    result = await execute_process_or_raise(
2✔
76
        **implicitly(
77
            Process(
78
                argv=(scc_program.exe, *succinct_code_counter.args),
79
                input_digest=input_digest,
80
                description=f"Count lines of code for {pluralize(len(specs_paths.files), 'file')}",
81
                level=LogLevel.DEBUG,
82
            )
83
        )
84
    )
85
    console.print_stdout(result.stdout.decode())
2✔
86
    return CountLinesOfCode(exit_code=0)
2✔
87

88

89
def rules():
5✔
90
    return (*collect_rules(), UnionRule(ExportableTool, SuccinctCodeCounter))
5✔
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

© 2026 Coveralls, Inc