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

pybuilder / pybuilder / 16613314016

30 Jul 2025 04:14AM UTC coverage: 84.008% (-0.1%) from 84.146%
16613314016

push

github

arcivanov
Release 0.13.16

2167 of 2671 branches covered (81.13%)

Branch coverage included in aggregate %.

5534 of 6496 relevant lines covered (85.19%)

36.25 hits per line

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

48.72
/src/main/python/pybuilder/plugins/python/pymetrics_plugin.py
1
#   -*- coding: utf-8 -*-
2
#
3
#   This file is part of PyBuilder
4
#
5
#   Copyright 2011-2020 PyBuilder Team
6
#
7
#   Licensed under the Apache License, Version 2.0 (the "License");
8
#   you may not use this file except in compliance with the License.
9
#   You may obtain a copy of the License at
10
#
11
#       http://www.apache.org/licenses/LICENSE-2.0
12
#
13
#   Unless required by applicable law or agreed to in writing, software
14
#   distributed under the License is distributed on an "AS IS" BASIS,
15
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
#   See the License for the specific language governing permissions and
17
#   limitations under the License.
18

19
import os
44✔
20

21
from pybuilder.core import use_plugin, after, task, init
44✔
22

23
use_plugin("python.core")
44✔
24
use_plugin("analysis")
44✔
25

26

27
@init
44✔
28
def init_pylint(project):
44✔
29
    project.plugin_depends_on("pymetrics")
×
30

31

32
@after("prepare")
44✔
33
def check_pymetrics_available(project, logger, reactor):
44✔
34
    logger.debug("Checking availability of pymetrics")
44✔
35
    reactor.pybuilder_venv.verify_can_execute(["pymetrics", "--nosql", "--nocsv"], "pymetrics",
44✔
36
                                              "plugin python.pymetrics")
37
    logger.debug("pymetrics has been found")
44✔
38

39

40
@task("analyze")
44✔
41
def execute_pymetrics(project, logger, reactor):
44✔
42
    logger.info("Executing pymetrics on project sources")
×
43
    source_dir = project.expand_path("$dir_source_main_python")
×
44

45
    files_to_scan = []
×
46
    for root, _, files in os.walk(source_dir):
×
47
        for file_name in files:
×
48
            if file_name.endswith(".py"):
×
49
                files_to_scan.append(os.path.join(root, file_name))
×
50

51
    csv_file = project.expand_path("$dir_reports/pymetrics.csv")
×
52

53
    command = ["pymetrics", "--nosql", "-c", csv_file] + files_to_scan
×
54

55
    report_file = project.expand_path("$dir_reports/pymetrics")
×
56

57
    env = project.pluginenv.copy()
×
58
    env.update({"PYTHONPATH": source_dir})
×
59
    reactor.pybuilder_venv.execute_command(command, report_file, env=env)
×
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