Skip to content

Copy lockfiles when no package_filters #1658

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

Merged
merged 3 commits into from
Apr 10, 2025

Conversation

marschattha
Copy link
Member

@marschattha marschattha commented Apr 5, 2025

A common issue I have noticed in testing this is that if the version of the linter in the lockfile is specified to be different than in qlty.toml (often the default known_good_version) we get the version mismatch error during version check post tool install.

Maybe we should skip version check in this case?

@Copilot Copilot bot review requested due to automatic review settings April 5, 2025 00:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

qlty-check/src/tool/php/composer.rs:216

  • [nitpick] Consider using consistent log formatting specifiers (e.g. using {} with .display() like in other parts) for lock file paths to improve consistency across the codebase.
debug!(
                        "Copying lock file from {:?} to {:?}",
                        lock_file, staging_lock_file
                    );

Copy link
Contributor

qltysh bot commented Apr 5, 2025

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

Total Coverage for cli: This PR will increase coverage by 0.08%.

File Coverage Changes
Path File Coverage Δ Indirect
qlty-check/src/tool/node/package_json.rs -1.0
qlty-check/src/tool/php.rs -0.6
qlty-check/src/tool/php/composer.rs 0.3
qlty-check/src/tool/ruby/gemfile.rs -0.3
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 Apr 5, 2025

2 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 20): update_package_json 2

@brynary
Copy link
Member

brynary commented Apr 5, 2025

@marschattha on the version check, what do you think of this?:

  • IF a version is specified in the qlty.toml we check for it
  • ELSE we do not run the version check

@marschattha
Copy link
Member Author

@marschattha on the version check, what do you think of this?:

  • IF a version is specified in the qlty.toml we check for it
  • ELSE we do not run the version check

Thinking and doing the prototype of that, might not be a good idea as it would stop checking for a lot more cases than it needs to as it is find to do that when the version is latest or known_good, just not ideal when installing using lockfile.
I think the version check provides a good constraint and should prevent bugs.
Maybe limiting it to cases where we copy lockfiles might be enough?

@brynary
Copy link
Member

brynary commented Apr 7, 2025

Hmm, I think the issue here is that the version check does two different, important things:

  1. Make sure the linter is installed properly
  2. Validate the version is expected

We can get the benefit of number 1 by running the version command and simply not validating the output.

So, what if we break down the concept of a version check into a validated version check which checks the output vs. an invalidated version check which just makes sure it exits 0.

Would that help?

@marschattha
Copy link
Member Author

Ah we were already skipping version check for ruby and node packages when using package files, was just missing it in php.

@marschattha
Copy link
Member Author

Hmm, I think the issue here is that the version check does two different, important things:

  1. Make sure the linter is installed properly
  2. Validate the version is expected

We can get the benefit of number 1 by running the version command and simply not validating the output.

So, what if we break down the concept of a version check into a validated version check which checks the output vs. an invalidated version check which just makes sure it exits 0.

Would that help?

Just saw this, yup that makes sense, we should do that in a separate PR.

@marschattha marschattha force-pushed the ma/copy_lockfiles_when_no_package_filters branch from 850a42a to 0223fb3 Compare April 7, 2025 19:05
@marschattha marschattha force-pushed the ma/copy_lockfiles_when_no_package_filters branch from 0223fb3 to 56f7f56 Compare April 7, 2025 21:21
@marschattha marschattha requested a review from brynary April 8, 2025 16:02
@marschattha marschattha merged commit 84470a0 into main Apr 10, 2025
14 checks passed
@marschattha marschattha deleted the ma/copy_lockfiles_when_no_package_filters branch April 10, 2025 22:53
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