File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed
Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ async function run() {
5151 if ( config . commitSuggestions ) {
5252 await ado . commitSuggestionsToPullRequest ( {
5353 pullRequestId : config . pullRequestId ,
54- fixedFiles : codespell . fixed ,
54+ files : [ ... new Set ( [ ... codespell . fixed , ... codespell . modified ] ) ] ,
5555 suggestions : config . commentSuggestions ? codespell . suggestions : [ ]
5656 } ) ;
5757 }
@@ -64,7 +64,7 @@ async function run() {
6464 }
6565
6666 // Report task result
67- const noMisspellingsFound = ( codespell . suggestions . length === 0 && codespell . fixed . length === 0 ) ;
67+ const noMisspellingsFound = ( codespell . suggestions . length === 0 ) ;
6868 setResult (
6969 noMisspellingsFound
7070 ? TaskResult . Succeeded
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export class AzureDevOpsClient {
9292
9393 public async commitSuggestionsToPullRequest ( options : {
9494 pullRequestId : number ,
95- fixedFiles : IFile [ ] ,
95+ files : IFile [ ] ,
9696 suggestions : IFileSuggestion [ ]
9797 } ) {
9898 try {
@@ -110,10 +110,10 @@ export class AzureDevOpsClient {
110110 . filter ( thread => ! thread . isDeleted && thread . status === CommentThreadStatus . Active ) ;
111111
112112 // Commit all files which have been automatically fixed or have suggestions that aren't already in an active thread
113- const fixedFilesToCommit = ( options . fixedFiles || [ ] ) ;
113+ const filesToCommit = ( options . files || [ ] ) ;
114114 const sugestionsToCommit = ( options . suggestions || [ ] )
115115 . filter ( suggestion => ! activeThreads . some ( thread => this . isThreadForSuggestion ( userId , thread , suggestion ) ) ) ;
116- const filePathsToCommit = [ ...new Set ( fixedFilesToCommit . concat ( sugestionsToCommit ) . map ( f => f . path ) ) ] ;
116+ const filePathsToCommit = [ ...new Set ( filesToCommit . concat ( sugestionsToCommit ) . map ( f => f . path ) ) ] ;
117117 if ( filePathsToCommit . length === 0 ) {
118118 return ;
119119 }
Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ import { IFile, IFileSuggestion } from "./types";
55
66export interface ICodeSpellResult {
77 returnCode : number ;
8- fixed : IFile [ ] ;
9- suggestions : IFileSuggestion [ ] ;
8+ modified : IFile [ ] ; // auto-modified by post-fix commands
9+ fixed : IFile [ ] ; // auto-fixed by codespell
10+ suggestions : IFileSuggestion [ ] ; // manual fixes are needed
1011}
1112
1213export class CodespellRunner {
@@ -98,8 +99,7 @@ export class CodespellRunner {
9899
99100 // Include any locally modified files in the list of fixed files
100101 // These could be from the post-fix command or from comment commands
101- const modifiedFiles = await this . getModifiedFilePaths ( ) ;
102- fixedFiles . push ( ...modifiedFiles . map ( f => ( { path : f } ) ) ) ;
102+ const modifiedFiles : IFile [ ] = ( await this . getModifiedFilePaths ( ) ) . map ( f => ( { path : f } ) ) ;
103103
104104 // Tell the user what we found
105105 const noMisspellingsFound = ( suggestions . length === 0 && fixedFiles . length === 0 ) ;
@@ -117,6 +117,7 @@ export class CodespellRunner {
117117
118118 return {
119119 returnCode : returnCode ,
120+ modified : modifiedFiles ,
120121 fixed : fixedFiles ,
121122 suggestions : suggestions
122123 } ;
You can’t perform that action at this time.
0 commit comments