• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

salsadigitalauorg / shipshape / 13380471727

17 Feb 2025 11:55PM UTC coverage: 67.1% (-0.2%) from 67.267%
13380471727

Pull #78

github

yusufhm
refactor: update connection plugin infrastructure and management

This commit updates the connection plugin system by:
- Introducing a BaseConnection struct to provide common functionality
- Implementing a new plugin manager for connection plugins
- Updating connection plugin types and interfaces
- Migrating existing connection plugins to use the new base implementation
- Improving plugin registration, configuration, and error handling
- Removing deprecated registry and global state management
- Updating command and fact plugin references to use the new connection plugin manager
Pull Request #78: feat: plugin refactor

425 of 944 new or added lines in 31 files covered. (45.02%)

27 existing lines in 10 files now uncovered.

3769 of 5617 relevant lines covered (67.1%)

6.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/plugin/types.go
1
// Package plugin provides the base interfaces and types for all Shipshape plugins.
2
package plugin
3

4
import "fmt"
5

6
// Plugin is the base interface that all plugins must implement.
7
type Plugin interface {
8
        // GetName returns the unique identifier for this plugin type.
9
        GetName() string
10
        // GetId returns the unique identifier for this plugin instance.
11
        GetId() string
12
        // GetErrors returns the errors for this plugin.
13
        GetErrors() []error
14
        // AddErrors adds an error to the plugin's error list.
15
        AddErrors(errs ...error)
16
}
17

18
// Factories represents a generic plugin factory registry.
19
type Factories[T Plugin] map[string]func(string) T
20

21
// FactoriesNoId represents a plugin factory registry for
22
// plugins that don't require ids.
23
type FactoriesNoId[T Plugin] map[string]func() T
24

25
// SupportLevel defines the level of support for plugin dependencies.
26
type SupportLevel string
27

28
const (
29
        SupportRequired SupportLevel = "required"
30
        SupportOptional SupportLevel = "optional"
31
        SupportNone     SupportLevel = "not-supported"
32
)
33

34
// ErrSupportRequired is returned when a required plugin dependency is missing.
35
type ErrSupportRequired struct {
36
        Plugin      string
37
        SupportType string
38
}
39

NEW
40
func (m *ErrSupportRequired) Error() string {
×
NEW
41
        return fmt.Sprintf("%s required for '%s'", m.SupportType, m.Plugin)
×
NEW
42
}
×
43

44
// ErrSupportNotFound is returned when a plugin dependency cannot be found.
45
type ErrSupportNotFound struct {
46
        Plugin        string
47
        SupportType   string
48
        SupportPlugin string
49
}
50

NEW
51
func (m *ErrSupportNotFound) Error() string {
×
NEW
52
        return fmt.Sprintf("%s '%s' not found for '%s'",
×
NEW
53
                m.SupportType, m.SupportPlugin, m.Plugin)
×
NEW
54
}
×
55

56
// ErrSupportNone is returned when a plugin dependency is not supported.
57
type ErrSupportNone struct {
58
        Plugin        string
59
        SupportType   string
60
        SupportPlugin string
61
}
62

NEW
63
func (m *ErrSupportNone) Error() string {
×
NEW
64
        if m.SupportPlugin == "" {
×
NEW
65
                return fmt.Sprintf("%s not supported for '%s'", m.SupportType, m.Plugin)
×
NEW
66
        }
×
NEW
67
        return fmt.Sprintf("%s '%s' not supported for '%s'",
×
NEW
68
                m.SupportType, m.SupportPlugin, m.Plugin)
×
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc