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

Change composer to install packages in worksapce root #1481

Conversation

marschattha
Copy link
Member

@marschattha marschattha commented Feb 6, 2025

For a lack of better way to pass workspace root to composer.rs this is a draft PR.

@marschattha marschattha requested a review from brynary February 6, 2025 23:09
Copy link
Contributor

qltysh bot commented Feb 6, 2025

Diff Coverage: The code coverage on the diff in this pull request is 33.3%.

Total Coverage: This PR will decrease coverage by 0.06%.

File Coverage Changes
Path File Coverage Δ Indirect
qlty-check/src/executor/driver.rs -0.9
qlty-check/src/planner/plugin.rs 0.6
qlty-check/src/tool/command_builder.rs 2.6
qlty-check/src/tool/download.rs 0.7
qlty-check/src/tool/node.rs -1.4
qlty-check/src/tool/php.rs 2.8
qlty-check/src/tool/php/composer.rs 0.2
qlty-check/src/tool/python.rs -1.6
qlty-check/src/tool/ruby.rs -1.1
qlty-check/src/tool/ruby/sys/linux.rs -1.6
qlty-check/src/tool/ruby/sys/macos.rs 3.1
qlty-check/src/tool/ruby_source.rs -2.3
qlty-check/src/tool/tool_builder.rs 1.1
qlty-cli/src/initializer/scanner/gemfile.rs 0.3
qlty-cloud/src/auth/auth_flow.rs -0.5
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Copy link
Contributor

qltysh bot commented Feb 6, 2025

Diff Coverage: The code coverage on the diff in this pull request is 30.7%.

Total Coverage: This PR will decrease coverage by 0.08%.

File Coverage Changes
Path File Coverage Δ Indirect
qlty-check/src/executor/driver.rs -0.9
qlty-check/src/planner/plugin.rs 0.6
qlty-check/src/tool/command_builder.rs 2.6
qlty-check/src/tool/download.rs 0.7
qlty-check/src/tool/node.rs -1.4
qlty-check/src/tool/php.rs -0.9
qlty-check/src/tool/php/composer.rs 0.2
qlty-check/src/tool/python.rs -1.6
qlty-check/src/tool/ruby.rs -1.1
qlty-check/src/tool/ruby/sys/linux.rs -1.6
qlty-check/src/tool/ruby/sys/macos.rs 3.1
qlty-check/src/tool/ruby_source.rs -2.3
qlty-check/src/tool/tool_builder.rs 1.1
qlty-cli/src/initializer/scanner/gemfile.rs 0.3
qlty-cloud/src/auth/auth_flow.rs -0.5
qlty-config/src/library.rs -0.5
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Copy link
Contributor

qltysh bot commented Feb 6, 2025

4 new issues

Tool Category Rule Count
qlty Duplication Found 15 lines of similar code in 4 locations (mass = 61) 4

qlty successfully analyzed this pull request in 5m.

Copy link
Member

@brynary brynary left a comment

Choose a reason for hiding this comment

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

I added some specific comments, however I am a bit confused about the overall strategy, specifically the usage of workspace_root vs. temp_path. I think addressing the comments should hopefully help clarify.

However, this is important behavior and necessarily somewhat complex, so I think it would be valuable to add a thorough explanation of how this works as comments to the top of composer.rs file

.gitignore Outdated Show resolved Hide resolved
qlty-check/src/tool/php.rs Outdated Show resolved Hide resolved
@@ -169,7 +172,7 @@ impl Tool for PhpPackage {
let mut env = HashMap::new();
env.insert(
"COMPOSER_VENDOR_DIR".to_string(),
path_to_native_string(PathBuf::from(format!("{}/vendor", self.directory()))),
path_to_native_string(self.workspace_root.join("vendor")),
Copy link
Member

Choose a reason for hiding this comment

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

I notice that we seem to construct COMPOSER_VENDOR_DIR here and also on line 79 in composer.rs with the same logic. Are these producing the same values?

If so, and the values need to be in sync, we should only compute the value once to avoid a bug if one location changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I think this is no longer needed anymore, since we are going to be installing packages in the project_root/vendor anyway.
This was here before to tell the plugin the vendor path during invocation runs which was previously in the tool install.

@marschattha marschattha closed this Feb 7, 2025
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.

2 participants