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

AI Fixer #58

Open
wants to merge 13 commits into
base: trunk
Choose a base branch
from
Open

AI Fixer #58

wants to merge 13 commits into from

Conversation

Luc45
Copy link
Member

@Luc45 Luc45 commented Jul 11, 2023

This PR adds the capability of automatically applying AI Recommendations of a test run to code.

This aims to make it easier for developers to apply the AI Recommendations without having to copy and paste much code manually. The modified files can then be reviewed by the developer, commited, and go through code review on a regular PR process. It just changes applies the AI Recommendations to the local files on a developer machine.

Usage:

  • qit run:security foo
  • After the test run, go to the Test Report and click to "Request AI Recommendations"
  • Once the AI Recommendations are available, you can use the Fixer:
  • qit fix 123456 /tmp/my-plugin

This will apply the AI Recommendations of Test Run ID 123456 to the plugin at that directory.

Currently, the Fixer usage is restricted behind a dev flag and requires Proxy authentication.

It should be made generally available in the future.

@Luc45 Luc45 requested a review from zhongruige July 11, 2023 14:11
@Luc45 Luc45 self-assigned this Jul 11, 2023
Copy link
Contributor

@zhongruige zhongruige left a comment

Choose a reason for hiding this comment

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

Awesome work on this @Luc45! I love the inclusion of an example plugin within the tests, too. This is great. Other than some minor suggested wording tweaks, I'm happy to add my approval to this. We just have a merge conflict that needs to be cleaned up as well before we can merge in.

PHP code or recommend non-existent functions.

It is crucial for every suggested fix to be carefully reviewed and tested by
a professional developer. Although this tool aims to ease the task of making
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor wording tweak suggestion:

Suggested change
a professional developer. Although this tool aims to ease the task of making
a developer on your team. Although this tool aims to ease the task of making

code secure, it is not a substitute for professional code review and should be
used as a helper tool.

We strongly encourage you to provide feedback about the suggestions. Your
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can add something here to guide them on how to provide the feedback, something even simple like having them open a new issue:

Suggested change
We strongly encourage you to provide feedback about the suggestions. Your
We strongly encourage you to provide feedback about the suggestions by opening a new issue. Your


if ( stripos( $file_in_json, '/ci/plugins/' ) ) {
/*
* PHPCS sends a path like this:
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding these great comments in this section, this is super helpful.

Copy link
Contributor

@MrJnrman MrJnrman left a comment

Choose a reason for hiding this comment

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

Tested and works like a charm! Thank you awesome work here @Luc45!

@zhongruige
Copy link
Contributor

Just noticed we have a merge conflict on this PR, but otherwise I think we should be good to merge this one in whenever you're ready @Luc45

@Luc45
Copy link
Member Author

Luc45 commented Aug 16, 2023

@zhongruige I'm holding a bit to merge this PR for the AI models to mature a bit, as requested.

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

3 participants