Skip to content

Commit

Permalink
fix: remove new feature comment section (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry authored Nov 22, 2024
1 parent ff51806 commit 426a499
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 81 deletions.
22 changes: 0 additions & 22 deletions services/notification/notifiers/mixins/message/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,28 +179,6 @@ def create_message(
section_writer,
)

extra_message = []

if not self.repository.test_analytics_enabled:
extra_message.append(
"- [Flaky Tests Detection](https://docs.codecov.com/docs/test-result-ingestion-beta) - Detect and resolve failed and flaky tests"
)
if not self.repository.bundle_analysis_enabled and set(
{"javascript", "typescript"}
).intersection(self.repository.languages or {}):
extra_message.append(
"- [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis) - Avoid shipping oversized bundles"
)

if extra_message:
for i in [
"----",
"🚨 Try these New Features:",
"",
*extra_message,
]:
write(i)

return [m for m in message if m is not None]

def _possibly_write_install_app(
Expand Down
55 changes: 0 additions & 55 deletions services/notification/notifiers/tests/unit/test_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3037,61 +3037,6 @@ def test_message_hide_details_bitbucket(
assert exp == res
assert result == expected_result

@pytest.mark.parametrize(
"test_analytics_enabled,bundle_analysis_enabled",
[(False, False), (False, True), (True, False), (True, True)],
)
def test_build_message_new_feature_message(
self,
dbsession,
mock_configuration,
mock_repo_provider,
sample_comparison,
test_analytics_enabled,
bundle_analysis_enabled,
):
mock_configuration.params["setup"]["codecov_dashboard_url"] = "test.example.br"
comparison = sample_comparison
pull = comparison.pull
notifier = CommentNotifier(
repository=sample_comparison.head.commit.repository,
title="title",
notifier_yaml_settings={"layout": "reach, diff, flags, files, footer"},
notifier_site_settings=True,
current_yaml={},
repository_service=mock_repo_provider,
)
repository = sample_comparison.head.commit.repository
if bundle_analysis_enabled:
repository.languages = ["javascript"]
if test_analytics_enabled:
repository.test_analytics_enabled = False
dbsession.flush()
result = notifier.build_message(comparison)

promotional_message = "🚨 Try these New Features:"
flake_message = "- [Flaky Tests Detection](https://docs.codecov.com/docs/test-result-ingestion-beta) - Detect and resolve failed and flaky tests"
bundle_message = "- [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis) - Avoid shipping oversized bundles"

end_of_message = []

if test_analytics_enabled or bundle_analysis_enabled:
end_of_message += [promotional_message, ""]
assert promotional_message in result

if test_analytics_enabled:
end_of_message.append(flake_message)
assert flake_message in result

if bundle_analysis_enabled:
end_of_message.append(bundle_message)
assert bundle_message in result

if len(end_of_message):
assert result[-len(end_of_message) :] == end_of_message
else:
assert result[-1] == ""


class TestFileSectionWriter(object):
def test_filesection_no_extra_settings(self, sample_comparison, mocker):
Expand Down
13 changes: 9 additions & 4 deletions tasks/profiling_normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@ def normalize_data(self, current_yaml, data: Dict) -> Dict:
files_dict,
)
)
for name in files_dict:
files_dict[name]["executable_lines"] = sorted(
files_dict[name]["executable_lines"]
)
files_dict.update(
{
name: {
**files_dict[name],
"executable_lines": sorted(files_dict[name]["executable_lines"]),
}
for name in files_dict
}
)
return {"runs": runs, "files": files_dict}

def _extract_report_into_dict(self, current_yaml, report, element, files_dict):
Expand Down

0 comments on commit 426a499

Please sign in to comment.