Skip to content

Commit

Permalink
fix reportOnlyChangedFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaKav committed Jan 21, 2022
1 parent 3836176 commit 77bff24
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
23 changes: 14 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13256,19 +13256,24 @@ const toTable = (data, options) => {

const rows = Object.keys(folders)
.sort()
.filter((folderPath) => {
if (!options.reportOnlyChangedFiles) {
return true;
}

const allFilesInFolder = Object.values(folders[folderPath]).map(
(f) => f.name
);

return allFilesInFolder.every((f) =>
options.changedFiles.all.some((c) => c.includes(f))
);
})
.reduce(
(acc, key) => [
...acc,
toFolderTd(key, options),
...folders[key]
.filter((file) => {
console.log(file);
return (
options.reportOnlyChangedFiles &&
!options.changedFiles.all.some((f) => f.includes(file))
);
})
.map((file) => toRow(file, key !== '', options)),
...folders[key].map((file) => toRow(file, key !== '', options)),
],
[]
);
Expand Down
10 changes: 9 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ const main = async () => {
hideBadge: false,
hideReport: false,
createNewComment: false,
reportOnlyChangedFiles: true,
hideComment: false,
xmlTitle: '',
multipleFiles,
// multipleFiles,
changedFiles: {
all: [
'functions/example_completed/example_completed.py',
'functions/example_manager/example_manager.py',
'functions/example_manager/example_static.py',
],
},
};

if (options.multipleFiles && options.multipleFiles.length) {
Expand Down
23 changes: 14 additions & 9 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,24 @@ const toTable = (data, options) => {

const rows = Object.keys(folders)
.sort()
.filter((folderPath) => {
if (!options.reportOnlyChangedFiles) {
return true;
}

const allFilesInFolder = Object.values(folders[folderPath]).map(
(f) => f.name
);

return allFilesInFolder.every((f) =>
options.changedFiles.all.some((c) => c.includes(f))
);
})
.reduce(
(acc, key) => [
...acc,
toFolderTd(key, options),
...folders[key]
.filter((file) => {
console.log(file);
return (
options.reportOnlyChangedFiles &&
!options.changedFiles.all.some((f) => f.includes(file))
);
})
.map((file) => toRow(file, key !== '', options)),
...folders[key].map((file) => toRow(file, key !== '', options)),
],
[]
);
Expand Down

0 comments on commit 77bff24

Please sign in to comment.