Skip to content

Commit

Permalink
Merge pull request #14 from archonitelabs/pylint-win-fixes
Browse files Browse the repository at this point in the history
linter windows fixes
  • Loading branch information
jxy-s authored May 3, 2024
2 parents 782b898 + e87b539 commit 6a49edb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ extends: default

rules:
truthy: disable
new-lines: disable
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ To generate code coverage on Windows, Radiant uses OpenCppCoverage.
[github.opencppcoverage]: https://github.com/OpenCppCoverage/OpenCppCoverage
[codecov.radiant]: https://codecov.io/gh/archonitelabs/radiant-cpp
[codecov.extension]: https://docs.codecov.com/docs/the-codecov-browser-extension
[vscode.coverage-gutters]: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
[vscode.coverage-gutters]: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
31 changes: 18 additions & 13 deletions tools/rad/rad/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

"""Utility functions to generate coverage data for the Radiant project."""

import logging
import os
import pathlib
import subprocess
import logging
from xml.etree import ElementTree
from . import bazel

from . import bazel, repo


def _load_coverage_xml(path):
Expand Down Expand Up @@ -56,15 +57,19 @@ def _opencppcoverage(
if not executables:
return

output_xml = pathlib.Path(output_xml)
output = ["--export_type", "cobertura:" + str(output_xml)]
if output_xml is None:
coverage_path = repo.ROOT_PATH / "bazel-out" / "coverage.xml"
else:
coverage_path = pathlib.Path(output_xml)

output = ["--export_type", "cobertura:" + str(coverage_path)]

srcs = []
if srcs_glob:
if srcs_glob is not None:
srcs = ["--sources", srcs_glob]

pdb_substitute = []
if pdb_prefix:
if pdb_prefix is not None and pdb_prefix_replace is not None:
pdb_substitute = [
"--substitute_pdb_source_path",
str(pdb_prefix) + "?" + pdb_prefix_replace,
Expand Down Expand Up @@ -93,21 +98,21 @@ def _opencppcoverage(
res = False
break

xml = _load_coverage_xml(output_xml)
xml = _load_coverage_xml(coverage_path)
try:
os.remove(output_xml)
os.remove(coverage_path)
except FileNotFoundError:
pass
if not combined:
combined = xml
else:
_merge_coverage_xml(combined, xml)
combined = _merge_coverage_xml(combined, xml) if combined else xml

logging.log(
logging.INFO if res else logging.ERROR,
"coverage finished" if res else "coverage failed!",
)
if combined:
combined.write(output_xml, xml_declaration=True, method="xml", encoding="utf-8")
combined.write(
coverage_path, xml_declaration=True, method="xml", encoding="utf-8"
)


def generate_coverage(
Expand Down

0 comments on commit 6a49edb

Please sign in to comment.