Skip to content

Commit

Permalink
Merge branch 'main' into trial_fired_by
Browse files Browse the repository at this point in the history
  • Loading branch information
RulaKhaled committed Sep 25, 2023
2 parents 0104728 + 3004a63 commit 50e7841
Show file tree
Hide file tree
Showing 15 changed files with 429 additions and 497 deletions.
1 change: 1 addition & 0 deletions database/models/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class RepositoryFlag(CodecovBaseModel, MixinBaseClass):
repository_id = Column(types.Integer, ForeignKey("repos.repoid"))
repository = relationship(Repository, backref=backref("flags"))
flag_name = Column(types.String(256), nullable=False)
deleted = Column(types.Boolean, nullable=True)


class CommitReport(CodecovBaseModel, MixinBaseClass):
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
https://github.com/codecov/shared/archive/bef9260a4b6218b5ce4b5b9152a71d7e6d63a954#egg=shared
https://github.com/codecov/shared/archive/c8db8d447b259fab3359cfb0d48f169de7c791d2.tar.gz#egg=shared
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
boto3
celery
Expand Down
42 changes: 34 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements.in
# pip-compile
#
amqp==5.1.0
# via kombu
Expand Down Expand Up @@ -85,9 +85,10 @@ faker==8.8.2
# via factory-boy
freezegun==1.2.2
# via pytest-freezegun
google-api-core==2.11.1
google-api-core[grpc]==2.11.1
# via
# google-cloud-core
# google-cloud-pubsub
# google-cloud-storage
google-auth==2.21.0
# via
Expand All @@ -97,6 +98,8 @@ google-auth==2.21.0
# shared
google-cloud-core==2.3.3
# via google-cloud-storage
google-cloud-pubsub==2.18.4
# via shared
google-cloud-storage==2.10.0
# via
# -r requirements.in
Expand All @@ -105,8 +108,24 @@ google-crc32c==1.1.2
# via google-resumable-media
google-resumable-media==2.5.0
# via google-cloud-storage
googleapis-common-protos==1.59.1
# via google-api-core
googleapis-common-protos[grpc]==1.59.1
# via
# google-api-core
# grpc-google-iam-v1
# grpcio-status
grpc-google-iam-v1==0.12.6
# via google-cloud-pubsub
grpcio==1.58.0
# via
# google-api-core
# google-cloud-pubsub
# googleapis-common-protos
# grpc-google-iam-v1
# grpcio-status
grpcio-status==1.58.0
# via
# google-api-core
# google-cloud-pubsub
h11==0.12.0
# via httpcore
httpcore==0.15.0
Expand Down Expand Up @@ -171,10 +190,16 @@ pluggy==0.13.1
# via pytest
prompt-toolkit==3.0.28
# via click-repl
protobuf==3.20.3
proto-plus==1.22.3
# via google-cloud-pubsub
protobuf==4.24.3
# via
# google-api-core
# google-cloud-pubsub
# googleapis-common-protos
# grpc-google-iam-v1
# grpcio-status
# proto-plus
# shared
psycopg2==2.9.3
# via -r requirements.in
Expand Down Expand Up @@ -224,6 +249,7 @@ python-json-logger==0.1.11
pytz==2022.1
# via
# celery
# shared
# timestring
pyyaml==6.0.1
# via
Expand Down Expand Up @@ -251,7 +277,7 @@ s3transfer==0.3.4
# via boto3
sentry-sdk==1.19.1
# via -r requirements.in
shared @ https://github.com/codecov/shared/archive/bef9260a4b6218b5ce4b5b9152a71d7e6d63a954.tar.gz
shared @ https://github.com/codecov/shared/archive/c8db8d447b259fab3359cfb0d48f169de7c791d2.tar.gz
# via -r requirements.in
six==1.15.0
# via
Expand Down Expand Up @@ -319,4 +345,4 @@ yarl==1.6.3
# via vcrpy

# The following packages are considered to be unsafe in a requirements file:
# setuptools
# setuptools
2 changes: 1 addition & 1 deletion services/notification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_notifiers_instances(self) -> Iterator[AbstractBaseNotifier]:
decoration_type=self.decoration_type,
)
checks_yaml_field = read_yaml_field(self.current_yaml, ("github_checks",))
current_flags = [rf.flag_name for rf in self.repository.flags]
current_flags = [rf.flag_name for rf in self.repository.flags if not rf.deleted]
for key, title, status_config in self.get_statuses(current_flags):
status_notifier_class = get_status_notifier_class(key, "status")
if (
Expand Down
34 changes: 24 additions & 10 deletions services/notification/notifiers/mixins/message/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
zero_change_regex = re.compile("0.0+%?")


def make_metrics(before, after, relative, show_complexity, yaml):
def make_metrics(before, after, relative, show_complexity, yaml, pull_url=None):
coverage_good = None
icon = " |"
if after is None:
Expand Down Expand Up @@ -116,23 +116,37 @@ def make_metrics(before, after, relative, show_complexity, yaml):
return "".join(("|", coverage, complexity, icon))


def make_patch_only_metrics(before, after, relative, show_complexity, yaml):
def make_patch_only_metrics(before, after, relative, show_complexity, yaml, pull_url):
if after is None:
# e.g. missing flags
coverage = " `?` |"
missing_line_str = " `?` |"

elif after is False:
# e.g. file deleted
coverage = " |"
missing_line_str = " |"

else:
layout = " `{relative}` |"
coverage = layout.format(
relative=format_number_to_str(
yaml, relative.coverage if relative else 0, style="{0}%", if_null="\xF8"
),
patch_cov = format_number_to_str(
yaml, relative.coverage if relative else 0, style="{0}%", if_null="\xF8"
)
coverage = f" {patch_cov} |"
missing_lines = relative.misses if relative else 0
partials = relative.partials if relative else 0
s = "s" if partials > 1 else ""
partials_str = "{n} partial{s}".format(
n=partials,
s=s,
)
missing_line_str = (
" [{m} Missing {partials}:warning: ]({pull_url}?src=pr&el=tree) |".format(
m=missing_lines,
partials=f"and {partials_str} " if partials else "",
pull_url=pull_url,
)
)
return "".join(("|", coverage))
return "".join(("|", coverage, missing_line_str))


def get_metrics_function(hide_project_coverage):
Expand All @@ -151,14 +165,14 @@ def get_table_header(hide_project_coverage, show_complexity):
+ " |"
)
else:
table_header = "| Coverage |"
table_header = "| Patch % | Lines |"

return table_header


def get_table_layout(hide_project_coverage, show_complexity):
if hide_project_coverage:
return "|---|---|"
return "|---|---|---|"
else:
return "|---|---|---|" + ("---|" if show_complexity else "")

Expand Down
Loading

0 comments on commit 50e7841

Please sign in to comment.