Skip to content
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

Low-hanging nullable fruit #5186

Merged
merged 19 commits into from
Apr 25, 2022
Merged

Conversation

50Wliu
Copy link
Contributor

@50Wliu 50Wliu commented Apr 24, 2022

There's a bunch of low-hanging fruit to get variables properly classified as nullable (and null-checked).

This pass gets most of src/omnisharp strict-clean, with the exception of server.ts and anything that depends on IHostExecutableResolver.

I'm hoping most of the changes should be self-explanatory, let me know if anything looks suspicious. Any changes to functionality are unintentional.

Also let me know if you'd prefer not to receive these types of PRs, because I get that they change a lot of files and reviewing is probably a bit of a small headache.

Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

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

Thanks for these changes. Enabling more of the TS compilers strict checking is certainly a goal for us. As well as moving from tslint to eslint.

There are a few failing unit tests that have checks like expect(options.path).to.be.null that will need to be updated.

@50Wliu 50Wliu force-pushed the low-hanging-nullable-fruit branch from 1acc7dc to 6576c95 Compare April 25, 2022 04:43
Copy link
Contributor Author

@50Wliu 50Wliu left a comment

Choose a reason for hiding this comment

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

Ready for review again. Changed all the string-related settings to default to the empty string rather than having to deal with TypeScript warning that it could be undefined. The only time it could be undefined is if the config is removed from package.json, which I think is highly unlikely without corresponding code changes...

// True means 'always' and false means 'auto'.
return value ? "always" : "auto";
}

if (omnisharpConfig.has('useGlobalMono')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not confident this fallback logic ever worked...I'm running the singleCsproj integration test suite right now which doesn't have useGlobalMono defined, but this still returns true (with get returning "auto", the default).

I suppose the upside is this whole section is going away soon, so I don't suppose it matters too much.

Copy link
Member

Choose a reason for hiding this comment

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

This bit of code will be removed prior to the next release to address #5120

Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

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

Latest round of changes look good. Thanks!

// True means 'always' and false means 'auto'.
return value ? "always" : "auto";
}

if (omnisharpConfig.has('useGlobalMono')) {
Copy link
Member

Choose a reason for hiding this comment

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

This bit of code will be removed prior to the next release to address #5120

@JoeRobich JoeRobich merged commit 1d477d2 into dotnet:master Apr 25, 2022
@50Wliu 50Wliu deleted the low-hanging-nullable-fruit branch April 25, 2022 19:20
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.

None yet

2 participants