Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ require (
github.com/hashicorp/go-plugin v1.8.0 // indirect
github.com/infracost/config v0.15.0
github.com/infracost/go-proto v1.26.0
github.com/infracost/proto v1.160.0
github.com/infracost/proto v1.162.0
github.com/owenrumney/go-lsp v0.2.3
)

require (
github.com/Masterminds/semver/v3 v3.4.0
github.com/google/go-github/v83 v83.0.0
github.com/google/uuid v1.6.0
github.com/infracost/cli v0.0.14-0.20260721085413-f5bfd98bc908
github.com/infracost/cli v0.0.14-0.20260804140208-7a2d6f549f20
github.com/stretchr/testify v1.11.1
golang.org/x/oauth2 v0.36.0
google.golang.org/grpc v1.82.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQx
github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/infracost/cli v0.0.14-0.20260721085413-f5bfd98bc908 h1:H4387VfyF6ZPvFmGstdu/Xg0Z1iN59P1kVLors7THfc=
github.com/infracost/cli v0.0.14-0.20260721085413-f5bfd98bc908/go.mod h1:miQvm3ZzWlWOXJoCLX6coT1UqTbutwOSY8Gfjh2lnes=
github.com/infracost/cli v0.0.14-0.20260804140208-7a2d6f549f20 h1:KO0mbxzqTqVPrdXGsv6JBwIMP5hjINmd3NHLbMaXjsA=
github.com/infracost/cli v0.0.14-0.20260804140208-7a2d6f549f20/go.mod h1:DV+6A2N4fCBs861GoKJc6dMd0LtCmDu4uaqqCDy74/I=
github.com/infracost/config v0.15.0 h1:4RauFYVYI54ZtVoRvfRLJuBk7tOd23NdPWueL7jyXsA=
github.com/infracost/config v0.15.0/go.mod h1:e5HTh8g+nua+Xrj5KGMbF0FXLQAIVQJ7gijLWVTXPF8=
github.com/infracost/go-proto v1.26.0 h1:DkvnNA3jbYp/i6PALl59JHO552W5Hw+bEhfhg5JH7e0=
github.com/infracost/go-proto v1.26.0/go.mod h1:9m9zdHPl6mME24y3J0CdTBWXr+d03mfgXuy+9JzA/wU=
github.com/infracost/proto v1.160.0 h1:qPH7Afh1//xlZyPYnFYpF3koi1nGpeMMDRfMWHzi3Fg=
github.com/infracost/proto v1.160.0/go.mod h1:Z8vPWBWblwJlw+/ksO+BtsXwf9NiOcSTWx0WRWNbfUA=
github.com/infracost/proto v1.162.0 h1:RiHzCo4gek4wciUYDmfo8XXyEGT7SHiSJWDx8xZiJ+I=
github.com/infracost/proto v1.162.0/go.mod h1:Z8vPWBWblwJlw+/ksO+BtsXwf9NiOcSTWx0WRWNbfUA=
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down
30 changes: 0 additions & 30 deletions internal/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"log/slog"
Expand Down Expand Up @@ -43,8 +42,6 @@ import (
"github.com/infracost/lsp/internal/vcs"
)

var featureFlagUnmarshalOptions = protojson.UnmarshalOptions{DiscardUnknown: true}

func (s *Scanner) processLoadedProviders(ctx context.Context, input *provider.TreeInput) ([]*provider.Resource, []*provider.FinopsPolicyResult, []string) {
plugins, err := s.Plugins.ProviderPlugins(ctx)
if err != nil {
Expand Down Expand Up @@ -82,20 +79,6 @@ func (s *Scanner) processLoadedProviders(ctx context.Context, input *provider.Tr
return resources, finops, errs
}

func (s *Scanner) applyFeatureFlags(params dashboard.RunParameters) error {
if len(params.FeatureFlags) == 0 || s.Plugins == nil {
return nil
}
flags := new(event.FeatureFlags)
if err := featureFlagUnmarshalOptions.Unmarshal(params.FeatureFlags, flags); err != nil {
return fmt.Errorf("unmarshal feature flags: %w", err)
}
s.Plugins.EnableK8sPlugins = flags.GetEnableK8SPlugins()
return nil
}

var errProjectSkipped = errors.New("project skipped")

// Scanner orchestrates parsing and pricing of IaC projects.
type Scanner struct {
// Plugins owns the full parser/provider plugin lifecycle (S3 download,
Expand Down Expand Up @@ -232,10 +215,6 @@ func (s *Scanner) FetchRunParams(ctx context.Context, rootDir string) string {
slog.Warn("fetchRunParams: failed to get run parameters", "error", err)
return ""
}
if err := s.applyFeatureFlags(params); err != nil {
slog.Warn("fetchRunParams: failed to apply feature flags", "error", err)
}

tagPolicies := make([]*event.TagPolicy, 0, len(params.TagPolicies))
for i, raw := range params.TagPolicies {
slog.Debug("fetchRunParams: raw tag policy", "index", i, "json", string(raw))
Expand Down Expand Up @@ -573,10 +552,6 @@ func (s *Scanner) scanProject(ctx context.Context, rootDir string, cfg *repoconf
parseDuration := time.Since(parseStart)

result := &ScanResult{}
if errors.Is(err, errProjectSkipped) {
slog.Debug("scanProject: project skipped", "name", project.Name, "type", projectType)
return result, nil
}

// Check diagnostics even on error — the parser may return both.
if parseResp != nil && parseResp.Diagnostics != nil {
Expand Down Expand Up @@ -852,11 +827,6 @@ func (s *Scanner) parse(ctx context.Context, path string, project *repoconfig.Pr
s.resetPlugins()
return nil, fmt.Errorf("loading parser plugin for project type %q: %w", projectType, err)
}
if s.Plugins.SkipPluginExecution(pp.Info.GetName()) {
slog.Debug("parse: skipping project handled by gated plugin", "project_type", projectType, "plugin", pp.Info.GetName())
return nil, errProjectSkipped
}

genericOpts := buildGenericOptions(project, rootDir, namingPolicyAttributeRequirements(finopsPolicies))
rawOpts, err := buildIaCOptions(project, projectType)
if err != nil {
Expand Down
Loading