Skip to content

Use the "withFileTypes" options with fs.readdir().#14994

Merged
ericsnowcurrently merged 36 commits intomicrosoft:mainfrom
ericsnowcurrently:fix-14983-better-findInterpretersInDir-filtering
Jan 11, 2021
Merged

Use the "withFileTypes" options with fs.readdir().#14994
ericsnowcurrently merged 36 commits intomicrosoft:mainfrom
ericsnowcurrently:fix-14983-better-findInterpretersInDir-filtering

Conversation

@ericsnowcurrently
Copy link
Copy Markdown

For #14983.

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • [ ] Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • [ ] Has telemetry for enhancements.
  • [ ] Unit tests & system/integration tests are added/updated.
  • [ ] Test plan is updated as appropriate.
  • [ ] package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • [ ] The wiki is updated with any design decisions/details.

Copy link
Copy Markdown

@kimadeline kimadeline left a comment

Choose a reason for hiding this comment

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

Do we have any tests that need to be updated as part of this PR?

export function listDir(dirname: string): Promise<string[]> {
return fsapi.readdir(dirname);
export function listDir(dirname: string): Promise<fs.Dirent[]> {
return fs.promises.readdir(dirname, { withFileTypes: true });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just wanted to point out that the assumption is that passing this option does not make things any more expensive than it previous was.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It makes it cheaper, in fact. 😄

Copy link
Copy Markdown

@kimadeline kimadeline left a comment

Choose a reason for hiding this comment

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

My comments above are not blocking.

@ericsnowcurrently
Copy link
Copy Markdown
Author

There aren't any tests already for findInterpretersInDir(), but I don't mind adding some. 😄

kimadeline pushed a commit to kimadeline/vscode-python that referenced this pull request Dec 21, 2020
ericsnowcurrently pushed a commit that referenced this pull request Jan 5, 2021
…15087)

This reverts commit 0837629. It unreverts 651a6b9 (#14981).

Note that #14994 has the fix for the problem for which the original commit was reverted in the first place.
@ericsnowcurrently ericsnowcurrently force-pushed the fix-14983-better-findInterpretersInDir-filtering branch from 2483ede to 27ac913 Compare January 5, 2021 23:02
matched = cfg.filterFile(filename);
} catch (err) {
if (cfg.ignoreErrors) {
logError(`filterFile() failed for "${filename}" (${err})`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I was expecting us to continue here instead of return.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also, I expect to ignore errors and continue by default.

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #14994 (6eb5fde) into main (dac8669) will increase coverage by 0%.
The diff coverage is 35%.

@@           Coverage Diff           @@
##            main   #14994    +/-   ##
=======================================
  Coverage     65%      65%            
=======================================
  Files        557      560     +3     
  Lines      26215    26358   +143     
  Branches    3727     3745    +18     
=======================================
+ Hits       17060    17160   +100     
- Misses      8459     8501    +42     
- Partials     696      697     +1     
Impacted Files Coverage Δ
src/client/common/utils/text.ts 49% <0%> (-2%) ⬇️
...rc/client/pythonEnvironments/common/commonUtils.ts 52% <33%> (-26%) ⬇️
.../pythonEnvironments/common/externalDependencies.ts 61% <100%> (-3%) ⬇️
src/client/tensorBoard/helpers.ts 77% <0%> (-6%) ⬇️
src/client/interpreter/activation/service.ts 76% <0%> (-3%) ⬇️
src/client/common/installer/productInstaller.ts 43% <0%> (-1%) ⬇️
src/client/common/utils/decorators.ts 78% <0%> (-1%) ⬇️
src/client/linters/bandit.ts 46% <0%> (ø)
src/client/telemetry/index.ts 76% <0%> (ø)
... and 12 more

@ericsnowcurrently ericsnowcurrently merged commit ff859ae into microsoft:main Jan 11, 2021
@ericsnowcurrently ericsnowcurrently deleted the fix-14983-better-findInterpretersInDir-filtering branch January 11, 2021 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants