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

refactor: ♻️ Refactor dictionary comprehension for generating report #1600

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

Anselmoo
Copy link
Owner

@Anselmoo Anselmoo commented Sep 22, 2024

All PR-Submissions:


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open
    Pull Requests for the same
    update/change?

New ✨✨ Feature-Submissions:


  • Does your submission pass tests?
  • Have you lint your code locally prior to submission? Fixed:
  • This PR is for a new feature, not a bug fix.

Changes to ⚙️ Core-Features:


  • Have you added an explanation of what your changes do and why you'd like
    us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Summary by Sourcery

Refactor the report generation function to use dictionary comprehension, enhancing code readability and maintainability.

Enhancements:

  • Refactor dictionary comprehension in the report generation function to improve code readability and maintainability.

Copy link

semanticdiff-com bot commented Sep 22, 2024

Review changes with SemanticDiff.

Analyzed 1 of 1 files.

Overall, the semantic diff is 32% smaller than the GitHub diff.

Filename Status
✔️ spectrafit/report.py 31.34% smaller

Copy link
Contributor

sourcery-ai bot commented Sep 22, 2024

Reviewer's Guide by Sourcery

This pull request refactors the generate_report method in the spectrafit/report.py file. The main change is the use of a dictionary comprehension to initialize the report dictionary, replacing the previous approach of initializing an empty dictionary and then adding key-value pairs.

File-Level Changes

Change Details Files
Refactored the initialization of the 'report' dictionary using a dictionary comprehension
  • Replaced the empty dictionary initialization and subsequent assignments with a single dictionary comprehension
  • Moved the 'Fit Statistics' and 'Variables and Values' assignments into the dictionary comprehension
  • Kept the conditional assignment of 'Correlations of Components' outside the dictionary comprehension
spectrafit/report.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@github-actions github-actions bot added the python Pull requests that update Python code label Sep 22, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Anselmoo - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Copy link

sonarcloud bot commented Sep 22, 2024

Copy link

codecov bot commented Sep 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (cd9c6ce) to head (bf9c347).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1600   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        44           
  Lines         4466      4464    -2     
=========================================
- Hits          4466      4464    -2     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spectrafit/report.py 100.00% <100.00%> (ø)

@Anselmoo Anselmoo merged commit 0445e3f into main Sep 22, 2024
33 checks passed
@Anselmoo Anselmoo deleted the refactor/report branch September 22, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant