-
Notifications
You must be signed in to change notification settings - Fork 485
Added SearchResults as a global datatable #6368
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
Merged
+337
−17
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4163d97
Added SearchResults as a global datatable
Jenson3210 0f4596b
remove duplication in tests
Jenson3210 6213b55
bot comments + fix test
Jenson3210 a3afeb9
review comments + remove unwanted changes
Jenson3210 261c5b7
Review comments
Jenson3210 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
rewrite-core/src/main/java/org/openrewrite/table/SearchResults.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Copyright 2022 the original author or authors. | ||
| * <p> | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * <p> | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.openrewrite.table; | ||
|
|
||
| import lombok.Value; | ||
| import org.jspecify.annotations.Nullable; | ||
| import org.openrewrite.Column; | ||
| import org.openrewrite.DataTable; | ||
| import org.openrewrite.Recipe; | ||
|
|
||
| public class SearchResults extends DataTable<SearchResults.Row> { | ||
|
|
||
| public SearchResults(Recipe recipe) { | ||
| super(recipe, "Source files that had search results", | ||
| "Search results that were found during the recipe run."); | ||
| } | ||
|
|
||
| @Value | ||
| public static class Row { | ||
| //TODO: Question for Jonathan: should we not (similar to SourcesFileErrors) have a afterSourcePath and represent both? | ||
Jenson3210 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // What if a recipe changes the path and adds markers? Do we need both? | ||
| // If a later recipe removed the sourcefile, we will not have the markers anymore. Not foreseeing that as an issue as typically search and edit/delete will not go together. | ||
| @Column(displayName = "Source path of search result", | ||
| description = "The source path of the file with the search result markers present.") | ||
| @Nullable | ||
| String sourcePath; | ||
|
|
||
| //TODO: Question for Jonathan: what should the truncation length be? | ||
Jenson3210 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @Column(displayName = "Result", | ||
| description = "The trimmed printed tree of the LST element that the marker is attached to. Truncated after 1000 chars if longer.") | ||
| String result; | ||
|
|
||
| //TODO: Question for Jonathan: Should we not report both instance name and recipe name? Searching for the recipe id from the String is not always "easy" (see also the unit tests) | ||
Jenson3210 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @Column(displayName = "Parent of the recipe that had the search marker added", | ||
| description = "In a hierarchical recipe, the parent of the recipe that made a change. Empty if " + | ||
| "this is the root of a hierarchy or if the recipe is not hierarchical at all.") | ||
| String parentRecipe; | ||
|
|
||
| @Column(displayName = "Recipe that added the search marker", | ||
| description = "The specific recipe that added the Search marker.") | ||
| String recipe; | ||
|
|
||
| } | ||
| //TODO: Question for Jonathan: in `SourcesFileResults`, I see a `build` method which is not used in the OR codebase. Perhaps by our other system? Do we need to have this build method or not? `SourcesFileErrors` does not have it. | ||
| } | ||
jkschneider marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.