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 link to Plugin Editor for each found issue to jump user to file and line of code #251

Closed
1 task done
Tracked by #283
westonruter opened this issue Sep 7, 2023 · 3 comments · Fixed by #298
Closed
1 task done
Tracked by #283
Assignees

Comments

@westonruter
Copy link
Member

Is your enhancement related to a problem? Please describe.

Currently when running PHPCS checks in the admin, it will mention the file and line number that an issue occurs on. However, it could go further by adding a link to open that line of code in the plugin editor so that the user could fix the issue right there (such as if they are a developer).

We implemented this in the AMP plugin, so that when an AMP validation error occurs the user can jump to the responsible code. We also provide a filter so that the user's own IDE can be opened to the responsible line of code.

Here's the logic for constructing the editor link: https://github.com/ampproject/amp-wp/blob/956c8d298764e4b22b936347d7c8b591b2fadfc2/includes/validation/class-amp-validation-error-taxonomy.php#L2356-L2473

Here's the logic for jumping to the line of code since core doesn't support that itself: https://github.com/ampproject/amp-wp/blob/956c8d298764e4b22b936347d7c8b591b2fadfc2/includes/validation/class-amp-validation-error-taxonomy.php#L1034-L1062

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mukeshpanchal27
Copy link
Member

Thank you, @westonruter, for the report. Personally, I like the idea of adding the Plugin Editor link for issues. I would like to hear @felixarntz and @spacedmonkey's thoughts here.

@felixarntz
Copy link
Member

@westonruter @mukeshpanchal27 I like that idea. How would we visually handle this? A new column on each result with the link, something like "View in code editor"?

One technical caveat I just want to ensure we keep in mind is that we'll have to make sure to only show those links/columns conditionally if the site is configured to support the Plugin Editor (which is disabled on many sites for e.g. security reasons).

But overall, that plan sounds good to me.

@felixarntz
Copy link
Member

This issue has been addressed in legacy-plugin, but still needs to be addressed in trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants