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

feat(auto-approve): add sample app repo processes #5053

Merged
merged 16 commits into from
May 16, 2023
Merged

feat(auto-approve): add sample app repo processes #5053

merged 16 commits into from
May 16, 2023

Conversation

sofisl
Copy link
Contributor

@sofisl sofisl commented May 12, 2023

Fixes #5006

cc @bourgeoisor

  • Adds a Go Dependency process
  • Adds a Docker Dependency process
  • Adds a Python Sample App (specific to the requirements in the bug) process
  • Updates the language for Java Dependency (it was 50, documentation still said 3)

Will remove the Node Dependency requirement in a F/U PR (the Node team does not need max files)

@sofisl sofisl requested a review from a team as a code owner May 12, 2023 19:54
@sofisl sofisl assigned chingor13 and unassigned bcoe May 15, 2023
Copy link
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

Can we break this into smaller PRs for unrelated things? It makes the reviews easier to follow and rollback if necessary.

* @param title the title of the PR
* @returns whether the old dependency, new dependency, and dependency in the title all match
*/
export function doesDependencyChangeMatchPRTitleGo(
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is go-specific, why does this allow passing in a dependency regex? The group logic is tied to positional matcher in the provided regex. Also, if this is only used in one place, keep it local to that one place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I still needed to add a dependency regex parameter because there is a "file matching" process. If we ever want to add more specific rules to a different file (not a go.mod), then we might need to pass in a different regex.

* @param versions the versions object returned from getVersions, getVersionsV2, and getJavaVersions
* @returns true if the version is only bumped a minor, not a major
*/
export function runVersioningValidationWithShaOrRev(
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming of this method does not help readability. A better common naming scheme IMO for something returning a true/false value would be isValidSomething.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we revert these changes or fix the formatting?

@@ -55,6 +55,8 @@ export interface Versions {
oldMinorVersion: string;
newMajorVersion: string;
newMinorVersion: string;
oldShaOrRevTag?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a need to overload this class? Can we have a separate class for a SHA diff. The function that parses the diff could return a Versions | ShaDiff type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good!

@sofisl
Copy link
Contributor Author

sofisl commented May 16, 2023

Can we break this into smaller PRs for unrelated things? It makes the reviews easier to follow and rollback if necessary.

I removed the change to the Node dependency max files, since that is the only backwards-looking fix (everything else is a feature). Let me know if you want me to do more for readability.

@sofisl sofisl requested a review from chingor13 May 16, 2023 18:51
*/
public doesDependencyChangeMatchPRTitleGo(
versions: VersionsWithShaDiff,
dependencyTitleRegex: RegExp,
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a constant? As before, it's possible that a regex doesn't have all the groups you are expecting.

Another alternative is to reference the instance variable here.

* that particular file. From there, you will get the previous dependency, new
* dependency, and previous version number and changed version number.
*/
export interface VersionsWithShaDiff {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider extends Versions instead of duplicating the fields

*/

export class GoDependency extends BaseLanguageRule {
classRule = {
Copy link
Contributor

Choose a reason for hiding this comment

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

note for a future possible refactor: this classRule nested type does not help you out. Consider flattening these instance variables. Additionally, if they are not actually configurable, make them constants.

@sofisl sofisl requested a review from chingor13 May 16, 2023 21:18
@sofisl sofisl merged commit fee988b into main May 16, 2023
@sofisl sofisl deleted the sampleRepos branch May 16, 2023 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[auto-approve] feature requests for compatibility with sample applications
4 participants