Skip to content

Commit 24e4052

Browse files
committed
fix: move version validation
1 parent 1f032fb commit 24e4052

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/commands/run.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ func (c *runCommand) persistentPostRunE(_ *cobra.Command, _ []string) error {
185185
}
186186

187187
func (c *runCommand) preRunE(_ *cobra.Command, args []string) error {
188-
if c.cfg.GetConfigDir() != "" && c.cfg.Version != "2" {
189-
return fmt.Errorf("invalid version of the configuration: %q", c.cfg.Version)
190-
}
191-
192188
dbManager, err := lintersdb.NewManager(c.log.Child(logutils.DebugKeyLintersDB), c.cfg,
193189
lintersdb.NewLinterBuilder(), lintersdb.NewPluginModuleBuilder(c.log), lintersdb.NewPluginGoBuilder(c.log))
194190
if err != nil {

pkg/config/loader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ func (l *Loader) Load(opts LoadOptions) error {
6060
l.cfg.Linters.Exclusions.Generated = GeneratedModeStrict
6161
}
6262

63+
if l.cfg.GetConfigDir() != "" && l.cfg.Version != "2" {
64+
return fmt.Errorf("unsupported version of the configuration: %q (require configuration v2)", l.cfg.Version)
65+
}
66+
6367
if !l.cfg.InternalCmdTest {
6468
for _, n := range slices.Concat(l.cfg.Linters.Enable, l.cfg.Linters.Disable) {
6569
if n == "typecheck" {

0 commit comments

Comments
 (0)