tools: show the launch stage of lagging APIs#15614
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the ShowLaggingCommand to include the launch stage of lagging packages in its output by parsing service configuration YAML files from the googleapis repository. The review feedback recommends optimizing performance by deferring the GetLaunchStage call until after confirming a package is lagging, using standard string alignment instead of manual padding for the console output, and adding a file existence check to prevent potential exceptions during YAML parsing.
| { | ||
| return null; | ||
| } | ||
| var service = ApiAnalyzer.ParseServiceConfigYaml(Path.Combine(googleapis, api.ProtoPath, api.ServiceConfigFile)); |
There was a problem hiding this comment.
Add a check to ensure the service configuration file exists before attempting to parse it. This prevents potential FileNotFoundException if the local googleapis repository is incomplete.
var path = Path.Combine(googleapis, api.ProtoPath, api.ServiceConfigFile);
if (!File.Exists(path))
{
return null;
}
var service = ApiAnalyzer.ParseServiceConfigYaml(path);There was a problem hiding this comment.
Not done - if the file should exist but doesn't, it's better to fail so that the user can update their googleapis clone than silently not giving the output.
9c668cf to
5ef49ec
Compare
This just finds the launch stage from the service config, where it's present. (In many cases it's absent, but that's mostly historical.)
5ef49ec to
8d7f8ef
Compare
This just finds the launch stage from the service config, where it's present. (In many cases it's absent, but that's mostly historical.)