mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-28 05:55:17 -07:00
Disallow redundant typecasts. (#15030)
This commit is contained in:
committed by
GitHub
parent
fcc3b2b5ec
commit
942bcfc61e
@@ -136,7 +136,7 @@ describe('Global Activity Detector Functions', () => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
it('should record activity on existing detector', () => {
|
||||
const detector = getActivityDetector()!;
|
||||
const detector = getActivityDetector();
|
||||
const beforeTime = detector.getLastActivityTime();
|
||||
vi.advanceTimersByTime(100);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export async function resolveTelemetrySettings(options: {
|
||||
settings.enabled;
|
||||
|
||||
const rawTarget =
|
||||
(argv.telemetryTarget as string | TelemetryTarget | undefined) ??
|
||||
argv.telemetryTarget ??
|
||||
env['GEMINI_TELEMETRY_TARGET'] ??
|
||||
(settings.target as string | TelemetryTarget | undefined);
|
||||
const target = parseTelemetryTargetValue(rawTarget);
|
||||
@@ -80,7 +80,7 @@ export async function resolveTelemetrySettings(options: {
|
||||
settings.otlpEndpoint;
|
||||
|
||||
const rawProtocol =
|
||||
(argv.telemetryOtlpProtocol as string | undefined) ??
|
||||
argv.telemetryOtlpProtocol ??
|
||||
env['GEMINI_TELEMETRY_OTLP_PROTOCOL'] ??
|
||||
settings.otlpProtocol;
|
||||
const otlpProtocol = (['grpc', 'http'] as const).find(
|
||||
|
||||
@@ -101,7 +101,7 @@ describe('Telemetry Metrics', () => {
|
||||
vi.resetModules();
|
||||
vi.doMock('@opentelemetry/api', () => {
|
||||
const actualApi = originalOtelMockFactory();
|
||||
(actualApi.metrics.getMeter as Mock).mockReturnValue(mockMeterInstance);
|
||||
actualApi.metrics.getMeter.mockReturnValue(mockMeterInstance);
|
||||
return actualApi;
|
||||
});
|
||||
|
||||
|
||||
@@ -291,8 +291,7 @@ describe('StartupProfiler', () => {
|
||||
|
||||
profiler.flush(mockConfig);
|
||||
|
||||
const calls = (recordStartupPerformance as ReturnType<typeof vi.fn>).mock
|
||||
.calls;
|
||||
const calls = recordStartupPerformance.mock.calls;
|
||||
const outerCall = calls.find((call) => call[2].phase === 'outer');
|
||||
const innerCall = calls.find((call) => call[2].phase === 'inner');
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export async function runInDevTraceSpan<R>(
|
||||
span.setAttribute('output-json', safeJsonStringify(meta.output));
|
||||
}
|
||||
for (const [key, value] of Object.entries(meta.attributes)) {
|
||||
span.setAttribute(key, value as AttributeValue);
|
||||
span.setAttribute(key, value);
|
||||
}
|
||||
if (meta.error) {
|
||||
span.setStatus({
|
||||
|
||||
@@ -15,7 +15,6 @@ import type { ApprovalMode } from '../policy/types.js';
|
||||
|
||||
import type { CompletedToolCall } from '../core/coreToolScheduler.js';
|
||||
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
||||
import type { FileDiff } from '../tools/tools.js';
|
||||
import { AuthType } from '../core/contentGenerator.js';
|
||||
import type { LogAttributes, LogRecord } from '@opentelemetry/api-logs';
|
||||
import {
|
||||
@@ -115,9 +114,7 @@ export class StartSessionEvent implements BaseTelemetryEvent {
|
||||
.getAllTools()
|
||||
.filter((tool) => tool instanceof DiscoveredMCPTool);
|
||||
this.mcp_tools_count = mcpTools.length;
|
||||
this.mcp_tools = mcpTools
|
||||
.map((tool) => (tool as DiscoveredMCPTool).name)
|
||||
.join(',');
|
||||
this.mcp_tools = mcpTools.map((tool) => tool.name).join(',');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +296,7 @@ export class ToolCallEvent implements BaseTelemetryEvent {
|
||||
call.response.resultDisplay !== null &&
|
||||
'diffStat' in call.response.resultDisplay
|
||||
) {
|
||||
const diffStat = (call.response.resultDisplay as FileDiff).diffStat;
|
||||
const diffStat = call.response.resultDisplay.diffStat;
|
||||
if (diffStat) {
|
||||
this.metadata = {
|
||||
model_added_lines: diffStat.model_added_lines,
|
||||
|
||||
Reference in New Issue
Block a user