Showing 13 of 13 total issues
Function main
has 83 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func main() {
var opts config.StartupFlags
var cfg = config.Config{
Listen: config.ListenConfig{
Port: 4040,
Logger
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type Logger struct {
zap *zap.SugaredLogger
}
Method Collection.Init
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *Collection) Init(cfg *config.NamespaceConfig) {
cfg.MustCompile()
labels := cfg.OrderedLabelNames
counterLabels := labels
Function processSource
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
Open
func processSource(logger *log.Logger, nsCfg *config.NamespaceConfig, t tail.Follower, parser parser.Parser, metrics *metrics.Collection, hasCounterOnlyLabels bool) error {
relabelings := relabeling.NewRelabelings(nsCfg.RelabelConfigs)
relabelings = append(relabelings, relabeling.DefaultRelabelings...)
relabelings = relabeling.UniqueRelabelings(relabelings)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processSource
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func processSource(logger *log.Logger, nsCfg *config.NamespaceConfig, t tail.Follower, parser parser.Parser, metrics *metrics.Collection, hasCounterOnlyLabels bool) error {
relabelings := relabeling.NewRelabelings(nsCfg.RelabelConfigs)
relabelings = append(relabelings, relabeling.DefaultRelabelings...)
relabelings = relabeling.UniqueRelabelings(relabelings)
Function processNamespace
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func processNamespace(logger *log.Logger, nsCfg *config.NamespaceConfig, metrics *metrics.Collection, stopChan <-chan bool, stopHandlers *sync.WaitGroup) error {
var followers []tail.Follower
logParser := parser.NewParser(nsCfg)
Function processSource
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func processSource(logger *log.Logger, nsCfg *config.NamespaceConfig, t tail.Follower, parser parser.Parser, metrics *metrics.Collection, hasCounterOnlyLabels bool) error {
Function processNamespace
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func processNamespace(logger *log.Logger, nsCfg *config.NamespaceConfig, metrics *metrics.Collection, stopChan <-chan bool, stopHandlers *sync.WaitGroup) error {
Function observeMetrics
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func observeMetrics(logger *log.Logger, fields map[string]string, name string, extractor func(map[string]string, string) (float64, bool, error), parseErrors prometheus.Counter) (float64, bool) {
Function Listen
has 5 return statements (exceeds 4 allowed). Open
Open
func Listen(conn string, formatSpec string) (syslog.LogPartsChannel, *syslog.Server, func() error, error) {
channel := make(syslog.LogPartsChannel)
handler := syslog.NewChannelHandler(channel)
server := syslog.NewServer()
Function floatFromFieldsMulti
has 5 return statements (exceeds 4 allowed). Open
Open
func floatFromFieldsMulti(fields map[string]string, name string) (float64, bool, error) {
f, ok, err := floatFromFields(fields, name)
if err == nil {
return f, ok, nil
}
Function processNamespace
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func processNamespace(logger *log.Logger, nsCfg *config.NamespaceConfig, metrics *metrics.Collection, stopChan <-chan bool, stopHandlers *sync.WaitGroup) error {
var followers []tail.Follower
logParser := parser.NewParser(nsCfg)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
2: cannot find package "go.uber.org/zap" in any of: Open
Open
"go.uber.org/zap"
- Exclude checks