diff --git a/internal/langserver/handlers/command/aztfmigrate_command.go b/internal/langserver/handlers/command/aztfmigrate_command.go index 45091b32..468918e8 100644 --- a/internal/langserver/handlers/command/aztfmigrate_command.go +++ b/internal/langserver/handlers/command/aztfmigrate_command.go @@ -218,7 +218,7 @@ func (c AztfMigrateCommand) Handle(ctx context.Context, arguments []json.RawMess } for index, r := range resources { - reportProgress(ctx, fmt.Sprintf("Migrating resource %d/%d...", index+1, len(resources)), 40+int(50.0*index/len(resources))) + reportProgress(ctx, fmt.Sprintf("Migrating resource %d/%d...", index+1, len(resources)), 40+uint32(50.0*index/len(resources))) if err := r.GenerateNewConfig(tempTerraform); err != nil { log.Printf("[ERROR] %+v", err) _ = clientNotifier.Notify(ctx, "window/showMessage", lsp.ShowMessageParams{ @@ -340,7 +340,7 @@ provider "azapi" { return config } -func reportProgress(ctx context.Context, message string, percentage int) { +func reportProgress(ctx context.Context, message string, percentage uint32) { clientCaller, err := context2.ClientCaller(ctx) if err != nil { log.Printf("[ERROR] failed to get client caller: %+v", err) @@ -382,7 +382,7 @@ func reportProgress(ctx context.Context, message string, percentage int) { Kind: "report", Cancellable: false, Message: message, - Percentage: uint32(percentage), + Percentage: percentage, }, }) } diff --git a/internal/lsp/range.go b/internal/lsp/range.go index c1b0a27e..bfb03e18 100644 --- a/internal/lsp/range.go +++ b/internal/lsp/range.go @@ -32,7 +32,9 @@ func HCLRangeToLSP(rng hcl.Range) lsp.Range { func HCLPosToLSP(pos hcl.Pos) lsp.Position { return lsp.Position{ - Line: uint32(pos.Line - 1), + // #nosec G105 + Line: uint32(pos.Line - 1), + // #nosec G105 Character: uint32(pos.Column - 1), } } diff --git a/internal/lsp/token_encoder.go b/internal/lsp/token_encoder.go index 6dd82e60..c78ad856 100644 --- a/internal/lsp/token_encoder.go +++ b/internal/lsp/token_encoder.go @@ -105,10 +105,15 @@ func (te *TokenEncoder) encodeTokenOfIndex(i int) []uint32 { deltaStartChar := token.Range.Start.Column - 1 - previousStartChar data = append(data, []uint32{ + // #nosec G105 uint32(deltaLine), + // #nosec G105 uint32(deltaStartChar), + // #nosec G105 uint32(tokenLength), + // #nosec G105 uint32(tokenTypeIdx), + // #nosec G105 uint32(modifierBitMask), }...) } else {