Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

fix!: markdown processing returns errors #802

Merged
merged 10 commits into from
May 12, 2022

Conversation

j-poecher
Copy link
Contributor

closes #629

in case an error occurs while parsing the configuration contained in a markdown tile and error will be returned and no evaluation of SLIs will be done.

What is considered an error?

  • duplicate entries for any of the keys: KQG.Total.Pass, KQG.Total.Warning, KQG.Compare.WithScore, KQG.Compare.Results and KQG.Compare.Function
  • KQG.Total.Pass, KQG.Total.Warning: any value that is not a non-negative decimal including an optional %. So basically anything that does not match: ^(\d+|\d+\.\d+)([%]?)$
  • KQG.Compare.WithScore: any value other than pass, all, pass_or_warn
  • KQG.Compare.Results: any not integral value as well as integers that are less than 1
  • KQG.Compare.Function: any value other than avg, p50, p90, p95

@@ -16,61 +54,158 @@ func NewMarkdownTileProcessing() *MarkdownTileProcessing {
}

// Process will overwrite the default values for SLOScore and SLOComparison with the contents found in the markdown
func (p *MarkdownTileProcessing) Process(tile *dynatrace.Tile, defaultScore keptncommon.SLOScore, defaultComparison keptncommon.SLOComparison) (*keptncommon.SLOScore, *keptncommon.SLOComparison) {
func (p *MarkdownTileProcessing) Process(tile *dynatrace.Tile, defaultScore keptncommon.SLOScore, defaultComparison keptncommon.SLOComparison) (*markdownParsingResult, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Process returns unexported type *dashboard.markdownParsingResult, which can be annoying to use

"testing"
)

type CombinedURLHandler struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type CombinedURLHandler should have comment or be unexported

templatingHandler *TemplatingPayloadBasedURLHandler
}

func NewCombinedURLHandler(t *testing.T, templateFile string) *CombinedURLHandler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewCombinedURLHandler should have comment or be unexported

}
}

func (h *CombinedURLHandler) AddExactFile(url string, fileName string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method CombinedURLHandler.AddExactFile should have comment or be unexported

h.fileHandler.AddExact(url, fileName)
}

func (h *CombinedURLHandler) AddExactTemplate(url string, templatingData interface{}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method CombinedURLHandler.AddExactTemplate should have comment or be unexported

// we allow the user to use a markdown to specify SLI/SLO properties, e.g: KQG.Total.Pass
// if we find KQG. we process the markdown
return parseMarkdownConfiguration(tile.Markdown, defaultScore, defaultComparison)
}

const (
TotalPass = "kqg.total.pass"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported const TotalPass should have comment (or a comment on this block) or be unexported

@sonarcloud
Copy link

sonarcloud bot commented May 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link
Contributor

The following Docker Images have been built:
keptncontrib/dynatrace-service:0.23.0-dev-PR-802,keptncontrib/dynatrace-service:0.23.0-dev-PR-802.202205111542

Copy link
Collaborator

@arthurpitman arthurpitman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@j-poecher j-poecher changed the title fix: markdown processing returns errors fix!: markdown processing returns errors May 12, 2022
@j-poecher j-poecher merged commit e68b556 into master May 12, 2022
@j-poecher j-poecher deleted the fix/629/markdown-processing-returns-errors branch May 12, 2022 11:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MarkdownTileProcessing should produce errors for dashboard markdown tiles that have bad syntax
2 participants