Skip to content

Commit

Permalink
fix(#98): one suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed May 2, 2024
1 parent e7b9ae1 commit ec6aeed
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/formatted-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class FormattedSummary implements Scalar<string> {
### Problems
${this.problems}
### Suggestions
### Suggestion
${this.suggestions}
`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async function run() {
await new Feedback(
new FormattedSummary(
composed.problems,
composed.suggestions
composed.suggestion
),
octokit,
issue,
Expand Down
28 changes: 19 additions & 9 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {MdSuggestions} from "./prompts/md-suggestions";
import {Suggestions} from "./prompts/suggestions";
import {Polish} from "./prompts/polish";
import {Top} from "./prompts/top";
import {OneSuggestion} from "./prompts/one-suggestion";

Check warning on line 34 in src/models.ts

View check run for this annotation

Codecov / codecov/patch

src/models.ts#L34

Added line #L34 was not covered by tests

/**
* Models.
Expand Down Expand Up @@ -85,25 +86,34 @@ export class Models {
).exec()
)
).exec();
const suggestions = await new NamedGoal(
"suggestions.md",
const suggestion = await new NamedGoal(

Check warning on line 89 in src/models.ts

View check run for this annotation

Codecov / codecov/patch

src/models.ts#L89

Added line #L89 was not covered by tests
"one",
this.def,
new Default(),
new MdSuggestions(
new OneSuggestion(
problems,
await new NamedGoal(
"suggestions",
"suggestions.md",
this.def,
new Default(),
new Suggestions(
report,
problems
new MdSuggestions(
await new NamedGoal(
"suggestions",
this.def,
new Default(),
new Suggestions(
report,
problems
)
).exec()
)
).exec()
).exec(),
report
)
).exec();
return {
problems: problems,
suggestions: suggestions
suggestion: suggestion
}
}
}
61 changes: 61 additions & 0 deletions src/prompts/one-suggestion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2023-2024 Tracehub.git
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/**
* One suggestion.
*/
export class OneSuggestion implements Scalar<string> {

Check warning on line 28 in src/prompts/one-suggestion.ts

View check run for this annotation

Codecov / codecov/patch

src/prompts/one-suggestion.ts#L28

Added line #L28 was not covered by tests

/**
* Ctor.
* @param probmels Problems
* @param suggestions Suggestions
* @param report Report
*/
constructor(
private readonly probmels: any,
private readonly suggestions: any,
private readonly report: string

Check warning on line 39 in src/prompts/one-suggestion.ts

View check run for this annotation

Codecov / codecov/patch

src/prompts/one-suggestion.ts#L37-L39

Added lines #L37 - L39 were not covered by tests
) {
}

value(): string {
return `

Check warning on line 44 in src/prompts/one-suggestion.ts

View check run for this annotation

Codecov / codecov/patch

src/prompts/one-suggestion.ts#L43-L44

Added lines #L43 - L44 were not covered by tests
Take a look at suggestions we propose for solving outlined problems with quality
of following bug report. Such long list of suggestions is absolutely useless.
Nobody reads it and nobody pays attention. In order to be useful,
please suggest only one specific improvement to be made.
The suggestion must be short, less than 30 words.
Suggestions:
${this.suggestions}
Problems:
${this.probmels}
Report:
${this.report}
`
}
}

0 comments on commit ec6aeed

Please sign in to comment.