Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine error and warning boxes that have the same message #8154

Merged
merged 7 commits into from
Jun 17, 2024

Conversation

eivindjahren
Copy link
Contributor

@eivindjahren eivindjahren commented Jun 14, 2024

Resolves #8151

Screencast.from.2024-06-14.12-03-22.webm
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure tests pass locally (after every commit!)

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

@eivindjahren eivindjahren added the release-notes:user-impact Automatically categorise as breaking for people using CLI/GUI label Jun 14, 2024
@eivindjahren eivindjahren self-assigned this Jun 14, 2024
@eivindjahren eivindjahren force-pushed the combine_messages branch 2 times, most recently from ab537a9 to c1f3af0 Compare June 14, 2024 12:28
@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 79.72973% with 15 lines in your changes missing coverage. Please review.

Project coverage is 86.58%. Comparing base (77fa511) to head (b6dd0fb).
Report is 6 commits behind head on main.

Files Patch % Lines
src/ert/gui/suggestor/_suggestor_message.py 75.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8154      +/-   ##
==========================================
+ Coverage   76.93%   86.58%   +9.64%     
==========================================
  Files         383      384       +1     
  Lines       23813    23883      +70     
  Branches      625      636      +11     
==========================================
+ Hits        18320    20678    +2358     
+ Misses       5412     3132    -2280     
+ Partials       81       73       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 112 to 119
if self._expanded:
self.lbl.setText(self._collapsed_text())
self._expand_collapse_label.setText(self._expand_link())
self._expanded = False
else:
self.lbl.setText(self._expanded_text())
self._expand_collapse_label.setText(self._hide_link())
self._expanded = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do even simpler, but maybe not as readable.
self._expanded = not self._expanded

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 139 to 147
return (
'<div style="font-size: 16px; line-height: 24px;">'
+ f'<b style="color: {self._text_color}">'
+ self._header
+ "</b>"
+ self._message
+ location_paragraphs
+ "</div>"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this duplication of lines 101-109? Would it make things better to extract this as a separate formatting function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted common text.

Comment on lines 132 to 137
location_paragraphs += (
f'<p><b style="color: {self._text_color}">location:</b>{loc}</p>'
)
first = False
else:
location_paragraphs += f"<p>{loc}</p>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also be a candidate to extract as a separate formatting function?
I am unsure if the readability is better after that though, but at least we avoid differing implementations if that would ever happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I extracted the duplication that you wanted but did extract some.

Copy link
Contributor

@andreas-el andreas-el left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@eivindjahren eivindjahren merged commit 90998f2 into equinor:main Jun 17, 2024
38 checks passed
@eivindjahren eivindjahren deleted the combine_messages branch June 17, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:user-impact Automatically categorise as breaking for people using CLI/GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

combine duplicate error messages
3 participants