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

Ignore packages with commit instead of version #8

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hbmartin
Copy link
Owner

No description provided.

@hbmartin
Copy link
Owner Author

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

PR Review

⏱️ Estimated effort to review [1-5]

3, because the PR involves changes across multiple files with modifications in both logic and structure. The changes include refactoring, error handling improvements, and new method extractions which require careful review to ensure functionality remains consistent and error handling is robust.

🧪 Relevant tests

Yes

🔍 Possible issues

Error Handling: The new error handling in warn_for_new_versions_range and warn_for_new_versions captures exceptions but only logs them to stderr. This might not be sufficient for all deployment environments where more sophisticated error reporting or handling might be necessary.

🔒 Security concerns

No

Code feedback:
relevant filelib/spm_version_updates/git.rb
suggestion      

Consider using sort_by instead of sort! for better performance when sorting complex objects or when the sorting criteria might become more complex in the future. [medium]

relevant lineversions.sort!.reverse!

relevant filelib/spm_version_updates/plugin.rb
suggestion      

Extract the repeated error handling logic into a separate method to reduce duplication and improve maintainability. [important]

relevant linerescue ArgumentError => e

relevant filelib/spm_version_updates/plugin.rb
suggestion      

Consider implementing a retry mechanism or a more sophisticated error recovery strategy in the new warn_for_branch method to handle transient issues when fetching the last commit. [medium]

relevant linelast_commit = Git.branch_last_commit(repository_url, branch)

relevant filelib/spm_version_updates/plugin.rb
suggestion      

Use a more descriptive variable name than e in the rescue blocks to improve code readability and maintainability. [medium]

relevant linerescue ArgumentError => e


✨ Review tool usage guide:

Overview:
The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

  • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
[pr_reviewer]
some_config1=...
some_config2=...

See the review usage page for a comprehensive guide on using this tool.

Copy link

@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 @hbmartin - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Docstrings: 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.

lib/spm_version_updates/plugin.rb Show resolved Hide resolved
@@ -182,6 +182,12 @@ module Danger
expect(@dangerfile.status_report[:warnings]).to eq([])
end

it "Up to next major but null version" do
Copy link

Choose a reason for hiding this comment

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

issue (testing): Test case 'Up to next major but null version' lacks assertions for specific warnings.

Please add assertions to verify that the correct warnings are generated when the version is null. This will ensure that the new logic in warn_for_new_versions_range and warn_for_new_versions is correctly handling null or invalid versions.

@@ -182,6 +182,12 @@ module Danger
expect(@dangerfile.status_report[:warnings]).to eq([])
end

it "Up to next major but null version" do
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Consider adding more test cases for error handling in version parsing.

Given the changes in error handling for version parsing in warn_for_new_versions_range and warn_for_new_versions, it would be beneficial to include tests that trigger and verify the handling of ArgumentError.

Suggested change
it "Up to next major but null version" do
it "Up to next major but null version" do
expect { @my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/PackageV1Commit.xcodeproj") }.to_not raise_error
expect(@dangerfile.status_report[:warnings]).to eq([])
end
it "Does not crash or warn when resolved version is missing from xcodeproj" do
expect { @my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/NoResolvedVersion.xcodeproj") }.to_not raise_error
end

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 93.83%. Comparing base (a36af65) to head (e860ceb).

Files Patch % Lines
lib/spm_version_updates/plugin.rb 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
- Coverage   95.07%   93.83%   -1.24%     
==========================================
  Files           5        5              
  Lines         142      146       +4     
==========================================
+ Hits          135      137       +2     
- Misses          7        9       +2     

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

hbmartin and others added 2 commits April 17, 2024 11:27
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants