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

Apply audit mode to TerminalConnection/Core/Settings and WinConPTY libraries #4016

Merged
merged 23 commits into from
Jan 3, 2020

Conversation

miniksa
Copy link
Member

@miniksa miniksa commented Dec 18, 2019

Summary of the Pull Request

  • Enables auditing of some Terminal libraries (Connection, Core, Settings)
  • Also audit WinConPTY.LIB since Connection depends on it

PR Checklist

  • Rolls audit out to more things
  • I work here
  • Tests should still pass
  • Am core contributor

Detailed Description of the Pull Request / Additional comments

This is turning on the auditing of these projects (as enabled by the heavier lifting in the other refactor) and then cleaning up the remaining warnings.

Validation Steps Performed

  • Built it
  • Ran the tests

…ng string views everywhere, size_ts over smaller sizes in prep for massive buffers, and so on and so on.
…ing used for calling ProcessString on the parser in the tests.
…sts. Fixed some rule of 5s, suppressed others. Suppressed constexpr suggestions. Use narrow_cast where applicable. Consts on unchanged variables. .at() for array accesses, and so on.
… constexpr and gluing everything back together. Otherwise, the usual suspects of array-to-pointer decay and noexcepts and whatnot.
@miniksa miniksa added Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. labels Dec 18, 2019
@miniksa miniksa self-assigned this Dec 18, 2019
@miniksa miniksa changed the base branch from master to dev/miniksa/gardening3_audit December 18, 2019 23:59
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Yea these comments aren't blocking

src/cascadia/TerminalCore/lib/terminalcore-lib.vcxproj Outdated Show resolved Hide resolved
src/terminal/adapter/adaptDispatch.cpp Outdated Show resolved Hide resolved
Comment on lines 243 to 251
try
{
return _terminalApi.EraseInDisplay(eraseType);
}
catch (...)
{
LOG_CAUGHT_EXCEPTION();
return false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are all these try/catch blocks just a temporary thing? I was rather hoping the long term plan was to use exceptions instead of return values for error reporting (at least outside the legacy APIs). Just being able to rid of the return value checking all over the place would make things so much more readable. And with exceptions you can also more easily differentiate between different failure cases (e.g. an unsupported operation vs an implementation failure).

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'd be happy to have it move entirely over to an exception based model. This was just the style at the time. I don't mean to put more work on you, but you seem to relish in it: if you would like to file a task and migrate all of the VT-related things from return-code-based to exception-based, I'd be happy to call it "code health".

Copy link
Collaborator

Choose a reason for hiding this comment

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

Serves me right for opening my big mouth. :) I didn't really have a specific plan for this, but I'll do some investigating on the weekend and file an issue when I have a better idea of how I think it might be achieved.

@ghost ghost closed this Jan 3, 2020
@zadjii-msft
Copy link
Member

@miniksa msftbot auto closed this b/c I merged #4005, since that was the target of this PR. That's my bad D:

@miniksa miniksa reopened this Jan 3, 2020
@miniksa miniksa changed the base branch from dev/miniksa/gardening3_audit to master January 3, 2020 15:24
@miniksa
Copy link
Member Author

miniksa commented Jan 3, 2020

@zadjii-msft, I fixed it. Restored the other branch, reopened and retargeted this, then deleted the other branch again.

@miniksa miniksa merged commit d711d73 into master Jan 3, 2020
@miniksa miniksa deleted the dev/miniksa/gardening3_audit2 branch January 3, 2020 18:44
@zadjii-msft
Copy link
Member

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conpty For console issues specifically related to conpty Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants