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

Add command lint-port #720

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

autoantwort
Copy link
Contributor

@autoantwort autoantwort commented Sep 28, 2022

Adds command x-lint-port that checks for common port issues and the usage of deprecated functions. The command is also able to fix the most of these issues.

Copy link
Contributor

@Thomas1664 Thomas1664 left a comment

Choose a reason for hiding this comment

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

I know that this is still a draft.

In general you should be careful with adding const to local variables because this might avoid moving in some cases

src/vcpkg/portlint.cpp Outdated Show resolved Hide resolved
namespace vcpkg::Lint
{

constexpr StringLiteral VERSION_RELAXED = "version";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
constexpr StringLiteral VERSION_RELAXED = "version";
static constexpr StringLiteral VERSION_RELAXED = "version";

The others as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

src/vcpkg/commands.lint-port.cpp Show resolved Hide resolved
src/vcpkg/portlint.cpp Show resolved Hide resolved
@Thomas1664
Copy link
Contributor

In general, it might be possible to parallelize linting as well if there weren't any calls to check_exit() and alike.

@autoantwort
Copy link
Contributor Author

autoantwort commented Sep 29, 2022

In general, it might be possible to parallelize linting as well if there weren't any calls to check_exit() and alike.

Linting all ports currently takes 140 ms. I don't thing there is any need for performance improvements.

Copy link
Member

@vicroms vicroms left a comment

Choose a reason for hiding this comment

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

Some parts of this PR can be made unit-testable with a few tweaks.

src/vcpkg/portlint.cpp Outdated Show resolved Hide resolved
src/vcpkg/portlint.cpp Show resolved Hide resolved
src/vcpkg/portlint.cpp Outdated Show resolved Hide resolved
# Conflicts:
#	azure-pipelines/end-to-end-tests-dir/format-manifest.ps1
#	azure-pipelines/end-to-end-tests-dir/versions.ps1
@autoantwort autoantwort marked this pull request as ready for review November 27, 2022 03:57
@autoantwort
Copy link
Contributor Author

@vicroms I have added unit tests

@reitowo
Copy link
Contributor

reitowo commented Jan 29, 2023

I think we can do both, the post build check can warn user, and we can expand this flag to something like --x-lint-port --fix-usage to automatically fix all ports usage issue and actually eliminate the issue.

@autoantwort
Copy link
Contributor Author

I think you don't need a new flag for that. Simply use the --fix flag. Do you implement this and create a PR against my branch?

@reitowo
Copy link
Contributor

reitowo commented Jan 29, 2023

Yes, I will create a PR against this branch once I tested.

@reitowo
Copy link
Contributor

reitowo commented Jan 31, 2023

People use different ways to install usage, should vcpkg provide a unified vcpkg_install_usage?

@autoantwort
Copy link
Contributor Author

I think the current situation is fine.

# Conflicts:
#	locales/messages.json
#	src/vcpkg/base/messages.cpp
# Conflicts:
#	locales/messages.json
@talregev
Copy link

talregev commented Mar 8, 2023

@autoantwort Any news from your linter?

@autoantwort
Copy link
Contributor Author

No, I am done and wait for review from @vicroms

@talregev
Copy link

@vicroms @Neumann-A @Thomas1664
Any news of review this PR?

Copy link
Contributor

@Thomas1664 Thomas1664 left a comment

Choose a reason for hiding this comment

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

My earlier comment to add static to some string literals is still unfixed but like my new comment not a big deal.
I also noticed the use of std::string::size_type instead of std::size_t or size_t which is also not a problem.

src/vcpkg/portlint.cpp Show resolved Hide resolved
include/vcpkg/portlint.h Show resolved Hide resolved
@talregev
Copy link

@autoantwort Are you going to fix the conflicts?

@autoantwort
Copy link
Contributor Author

I can fix them, but they don't prevent this PR from being reviewed.

# Conflicts:
#	include/vcpkg/base/messages.h
#	src/vcpkg/base/messages.cpp
@talregev
Copy link

@Thomas1664 this PR is ready for review by @vicroms from your side?

@Thomas1664
Copy link
Contributor

@Thomas1664 this PR is ready for review by @vicroms from your side?

The vcpkg team reviews PRs independently from community feedback such as my review comments.

# Conflicts:
#	include/vcpkg/base/messages.h
#	src/vcpkg/base/messages.cpp
# Conflicts:
#	src/vcpkg/commands.add-version.cpp
# Conflicts:
#	src/vcpkg/commands.cpp
@talregev
Copy link

Any news?

@BillyONeal
Copy link
Member

Any news?

I think this keeps getting skipped over because we need to sell a concrete proposal of what this command actually does to our PM team and management, and we aren't getting time to reverse engineer what that looks like from this PR in order to do so.

@talregev
Copy link

Any news?

I think this keeps getting skipped over because we need to sell a concrete proposal of what this command actually does to our PM team and management, and we aren't getting time to reverse engineer what that looks like from this PR in order to do so.

All you need is time?

@BillyONeal
Copy link
Member

All you need is time?

We need like a spec of what the command is supposed to do

@autoantwort autoantwort marked this pull request as draft November 28, 2023 00:22
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.

7 participants