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

chore: Added new analytics parameter for git auto commit #29538

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public class AutoCommitEvent {
private String repoName;
private String authorName;
private String authorEmail;
private String repoUrl;
Comment on lines 16 to +19
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 NOTE
Codebase verification is a beta feature.

The review of the codebase has revealed the following:

  • The repoUrl field is accessed and used in AutoCommitEventHandlerCEImpl.java, which aligns with the intended changes.
  • The test files AutoCommitEventHandlerImplTest.java and GitAutoCommitHelperImplTest.java instantiate AutoCommitEvent without setting the repoUrl. This may need to be updated to reflect the new field and ensure that tests cover the new functionality.
  • The main file GitAutoCommitHelperImpl.java also instantiates AutoCommitEvent without setting the repoUrl, which is likely an oversight and should be corrected.

Based on these findings, the following actions are recommended:

  • Verify and update the test files to include the repoUrl field in their instantiation of AutoCommitEvent.

  • Update the instantiation of AutoCommitEvent in GitAutoCommitHelperImpl.java to set the repoUrl field.

  • The test files AutoCommitEventHandlerImplTest.java and GitAutoCommitHelperImplTest.java should be verified and potentially updated to set the repoUrl when instantiating AutoCommitEvent.

  • The GitAutoCommitHelperImpl.java file should be updated to set the repoUrl field when instantiating AutoCommitEvent.

Analysis chain

The addition of the repoUrl field to the AutoCommitEvent class is consistent with the PR objectives and the AI-generated summaries. Ensure that all parts of the codebase that instantiate or use the AutoCommitEvent class are updated to handle the new repoUrl field appropriately.



Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for instances where `AutoCommitEvent` is instantiated to ensure `repoUrl` is being set.
rg 'new AutoCommitEvent' --files-with-matches
# Search for instances where `AutoCommitEvent` is used to ensure `repoUrl` is being handled.
rg 'AutoCommitEvent' --files-with-matches

Length of output: 1218



Script:

#!/bin/bash
# Check the instantiation of `AutoCommitEvent` in the test files to ensure `repoUrl` is being set.
rg 'new AutoCommitEvent' app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/AutoCommitEventHandlerImplTest.java
rg 'new AutoCommitEvent' app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/GitAutoCommitHelperImplTest.java

# Check the instantiation of `AutoCommitEvent` in the main file to ensure `repoUrl` is being set.
rg 'new AutoCommitEvent' app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/GitAutoCommitHelperImpl.java

# Check the usage of `AutoCommitEvent` in the main files to ensure `repoUrl` is being handled.
rg 'AutoCommitEvent' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCEImpl.java
rg 'AutoCommitEvent' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCE.java
rg 'AutoCommitEvent' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandler.java
rg 'AutoCommitEvent' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandlerImpl.java

Length of output: 2737



Script:

#!/bin/bash
# Check for the access or modification of the `repoUrl` field in the files where `AutoCommitEvent` is used.
rg 'repoUrl' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCEImpl.java
rg 'repoUrl' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCE.java
rg 'repoUrl' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandler.java
rg 'repoUrl' app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandlerImpl.java

Length of output: 538

}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Mono<Boolean> autoCommitApplication(String defaultApplicationId, String b
autoCommitEvent.setWorkspaceId(application.getWorkspaceId());
autoCommitEvent.setAuthorName(gitProfile.getAuthorName());
autoCommitEvent.setAuthorEmail(gitProfile.getAuthorEmail());
autoCommitEvent.setRepoUrl(gitApplicationMetadata.getRemoteUrl());
// it's a synchronous call, no need to return anything
autoCommitEventHandler.publish(autoCommitEvent);
return Boolean.TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,10 @@ public List<AnalyticsEvents> getNonResourceEvents() {
/**
* Tells whether to hash userId or not for events
*
* @param String event
* @param String userId
* @param Boolean hashUserId
* @param event String
* @param userId String
* @param hashUserId Boolean
* @param isCloudHosting Boolean
* @return Boolean
*/
public static Boolean shouldHashUserId(String event, String userId, boolean hashUserId, boolean isCloudHosting) {
Expand Down
Loading
Loading