Skip to content

Commit

Permalink
Fixes for Healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
richmahn committed Dec 14, 2024
1 parent e3dfeed commit e1ee361
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions models/repo/door43healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
IssueCodeRelation IssueCode = "relation_lang_invalid" // relation not valid
IssueCodePublisher IssueCode = "publisher_has_uw" // publisher empty or is 'unfoldingWord'
IssueCodeTitle IssueCode = "title_has_uw" // title is empty or still contains 'unfoldingWord'
IssueCodeAbbreviation IssueCode = "abbreviation_invalid" // abbreviation is not valid for given subject
IssueCodeIdentifier IssueCode = "abbreviation_invalid" // abbreviation is not valid for given subject
IssueCodeLanguage IssueCode = "language_is_en" // language is empty or still English
IssueCodeIngredientTitle IssueCode = "ingredient_title_is_en" // ingredient title is empty or still English
IssueCodeIngredientMissing IssueCode = "ingredient_missing" // ingredient's path is missing
Expand All @@ -67,7 +67,7 @@ var IssueCodeOrder = []IssueCode{
IssueCodeRelation,
IssueCodePublisher,
IssueCodeTitle,
IssueCodeAbbreviation,
IssueCodeIdentifier,
IssueCodeLanguage,
IssueCodeIngredientTitle,
IssueCodeIngredientMissing,
Expand Down Expand Up @@ -118,7 +118,7 @@ var IssueCodeNegatives = map[IssueCode]string{
IssueCodeRelation: "Relation is not the language of the resource",
IssueCodePublisher: "Publisher is still 'unfoldingWord'",
IssueCodeTitle: "Title still contains 'unfoldingWord'",
IssueCodeAbbreviation: "Abbreviation is not valid for given subject",
IssueCodeIdentifier: "Identifier is not valid for the resource's subject",
IssueCodeLanguage: "Language is still English",
IssueCodeIngredientTitle: "Ingredient is still in English",
IssueCodeIngredientMissing: "Ingredient path is missing",
Expand All @@ -132,7 +132,7 @@ var IssueCodePositives = map[IssueCode]string{
IssueCodeRelation: "Relations use the language of the resource",
IssueCodePublisher: "Publisher has been properly changed",
IssueCodeTitle: "Title has been properly changed",
IssueCodeAbbreviation: "Abbreviation is valid for given subject",
IssueCodeIdentifier: "Identifier is valid for the resource's subject",
IssueCodeLanguage: "Language has been set",
IssueCodeIngredientTitle: "Ingredient titles have been translated",
IssueCodeIngredientMissing: "Ingredient paths exists",
Expand All @@ -146,7 +146,7 @@ var IssueDetailsFormatStrings = map[IssueCode]string{
IssueCodeRelation: "Relation in manifest.yaml **`%s`** does not match resource language **`%s`**.",
IssueCodePublisher: "Publisher in manifest.yaml is still 'unfoldingWord'.",
IssueCodeTitle: "Resouce title in manifest.yaml still contains 'unfoldingWord'.",
IssueCodeAbbreviation: "Abbreviation in manifest.yaml should not be **`%s`** for the subject **`%s`**.",
IssueCodeIdentifier: "Identifier in manifest.yaml should not be **`%s`** for the subject **`%s`**.",
IssueCodeLanguage: "Language in manifest.yaml is still English **`en`**.",
IssueCodeIngredientTitle: "The title in for the project '%s' is still in English: %s",
IssueCodeIngredientMissing: "The path for project **`%s`** is does not exist in the repo: **`%s`**",
Expand All @@ -160,9 +160,9 @@ var IssueSuggestionsFormatStrings = map[IssueCode]string{
IssueCodeRelation: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and change **`%s`** to **`%s/%s`**.",
IssueCodePublisher: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and change `unfoldingWord` to the correct publisher, e.g. %s.",
IssueCodeTitle: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and remove 'unfoldingWord ' from the beginning of title, **`%s`** => **`%s`**, or translate into your language.",
IssueCodeAbbreviation: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and change **`%s`** to the correct abbreviation for the subject **`%s`**, which is **`%s`**.",
IssueCodeLanguage: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and change **`en`** to the correct language code for your project's language, the title of the language, and the direction.",
IssueCodeIngredientTitle: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and translate the title of the projects. For example, translate **'%s'** to the resource's language.",
IssueCodeIdentifier: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and change **`%s`** to the correct **`identifier`** for the subject **`%s`**, which is **`%s`**.",
IssueCodeLanguage: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and change **`en`** to the correct **`language code`** for your project's language, the **`title`** of the language, and the **`direction`**.",
IssueCodeIngredientTitle: "Edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and translate the **`title`** of the projects. For example, translate **'%s'** to the resource's language.",
IssueCodeIngredientMissing: "Either edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and remove the project **`%s`** or add the missing file or path, **`%s`**, to the repository.",
IssueCodeIngredientEmpty: "Either edit the [manifest.yaml](%s/src/branch/%s/manifest.yaml) file and remove the project **`%s`** or add content to the file **`%s`**.",
IssueCodeReleaseNeeded: "It looks like %s of the **`%s`** branch's %ss has been fixed. You should create a release for the resource with [gatewayAdmin](https://gateway-admin.netlify.app/).",
Expand Down
6 changes: 3 additions & 3 deletions services/door43metadata/door43healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ func PerformHealthcheck(ctx context.Context, dm *repo_model.Door43Metadata) (*re
if subject, ok := dcs.ResourceToSubjectMap[dm.Abbreviation]; !ok || subject != dm.Subject {
item := &repo_model.Door43HealthcheckIssue{
Door43MetadataID: dm.ID,
IssueCode: repo_model.IssueCodeAbbreviation,
IssueCode: repo_model.IssueCodeIdentifier,
SeverityLevel: repo_model.SeverityLevelError,
Details: fmt.Sprintf(repo_model.IssueCodeAbbreviation.IssueDetailsFormatString(), dm.Abbreviation, dm.Subject),
Suggestion: fmt.Sprintf(repo_model.IssueCodeAbbreviation.IssueSuggestionFormatString(), dm.Repo.Link(), dm.Ref, dm.Abbreviation, dm.Subject, dcs.SubjectToResourceMap[dm.Subject]),
Details: fmt.Sprintf(repo_model.IssueCodeIdentifier.IssueDetailsFormatString(), dm.Abbreviation, dm.Subject),
Suggestion: fmt.Sprintf(repo_model.IssueCodeIdentifier.IssueSuggestionFormatString(), dm.Repo.Link(), dm.Ref, dm.Abbreviation, dm.Subject, dcs.SubjectToResourceMap[dm.Subject]),
Current: true,
}
if _, err := db.GetEngine(ctx).Insert(item); err != nil {
Expand Down

0 comments on commit e1ee361

Please sign in to comment.