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
2 changes: 2 additions & 0 deletions example.easyp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ breaking:
ignore:
- some_dir
against_git_ref: master
use:
- FILES_CHECK

generate:
inputs:
Expand Down
4 changes: 4 additions & 0 deletions internal/api/temporaly_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log/slog"
"os"
"path/filepath"
"slices"
"strings"

"github.com/samber/lo"
Expand Down Expand Up @@ -95,9 +96,12 @@ func buildCore(_ context.Context, log logger.Logger, cfg config.Config, dirWalke
linterIgnoreDirs := append(cfg.Lint.Ignore, vendorPath)
breakingCheckIgnoreDirs := append(cfg.BreakingCheck.Ignore, vendorPath)

filesCheck := slices.Contains(cfg.BreakingCheck.Use, core.BreakingCheckFilesCheck)

breakingCheckConfig := core.BreakingCheckConfig{
IgnoreDirs: breakingCheckIgnoreDirs,
AgainstGitRef: cfg.BreakingCheck.AgainstGitRef,
FilesCheck: filesCheck,
}

// Convert managed mode configuration
Expand Down
3 changes: 2 additions & 1 deletion internal/config/breaking_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ package config
type BreakingCheck struct {
Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"`
// git ref to compare with
AgainstGitRef string `json:"against_git_ref,omitempty" yaml:"against_git_ref,omitempty"`
AgainstGitRef string `json:"against_git_ref,omitempty" yaml:"against_git_ref,omitempty"`
Use []string `json:"use,omitempty" yaml:"use,omitempty"`
Comment on lines +7 to +8
}
8 changes: 8 additions & 0 deletions internal/core/breaking_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ import (

var ErrRootOutsideProject = fmt.Errorf("breaking check root must be inside the git repository")

const (
BreakingCheckFilesCheck string = "FILES_CHECK"
)

type BreakingCheckConfig struct {
// branch name to compare with
AgainstGitRef string
// dirs should be ignored
IgnoreDirs []string

FilesCheck bool
}

func (c *Core) BreakingCheck(ctx context.Context, projectRoot, workingDir, path string) ([]IssueInfo, error) {
Expand Down Expand Up @@ -68,6 +74,8 @@ func (c *Core) BreakingCheck(ctx context.Context, projectRoot, workingDir, path
breakingChecker := &BreakingChecker{
against: againstProtoData,
current: currentProtoData,

filesCheck: c.breakingCheckConfig.FilesCheck,
}

return breakingChecker.Check()
Expand Down
2 changes: 2 additions & 0 deletions internal/core/breaking_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const breakingCheckRuleName = "BREAKING_CHECK"
type BreakingChecker struct {
against ProtoData
current ProtoData

filesCheck bool
}

func (b *BreakingChecker) Check() ([]IssueInfo, error) {
Expand Down