Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.8
version: v2.10
args: --timeout=4m
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ linters:
- third_party$
- builtin$
- examples$
rules:
- linters:
- goconst
path: _test\.go
formatters:
enable:
- gci
Expand Down
29 changes: 29 additions & 0 deletions block_constraint.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,35 @@ func blockAttribute(block *newsdoc.Block, name string) (string, bool) {
return "", false
}

func setBlockAttribute(block *newsdoc.Block, name string, value string) {
switch blockAttributeKey(name) {
case blockAttrUUID:
block.UUID = value
case blockAttrID:
block.ID = value
case blockAttrType:
block.Type = value
case blockAttrURI:
block.URI = value
case blockAttrURL:
block.URL = value
case blockAttrTitle:
block.Title = value
case blockAttrRel:
block.Rel = value
case blockAttrName:
block.Name = value
case blockAttrValue:
block.Value = value
case blockAttrContentType:
block.Contenttype = value
case blockAttrRole:
block.Role = value
case blockAttrSensitivity:
block.Sensitivity = value
}
}

// DescribeCountConstraint returns a human readable (english) description of the
// count contstraint for the block constraint.
func (bc BlockConstraint) DescribeCountConstraint(kind BlockKind) string {
Expand Down
2 changes: 1 addition & 1 deletion cmd/revisor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func main() {
}

if err := app.Run(os.Args); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err.Error())
_, _ = fmt.Fprintln(os.Stderr, err.Error()) //nolint:gosec // stderr, not HTTP output

os.Exit(1)
}
Expand Down
21 changes: 21 additions & 0 deletions document_constraint.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,27 @@ func documentMatchAttribute(d *newsdoc.Document, name string, variants []Variant
return "", false
}

func setDocumentAttribute(d *newsdoc.Document, name string, value string) bool {
switch documentAttributeKey(name) {
case docAttrUUID:
d.UUID = value
case docAttrType:
d.Type = value
case docAttrURI:
d.URI = value
case docAttrURL:
d.URL = value
case docAttrTitle:
d.Title = value
case docAttrLanguage:
d.Language = value
default:
return false
}

return true
}

func documentAttribute(d *newsdoc.Document, name string) (string, bool) {
switch documentAttributeKey(name) {
case docAttrUUID:
Expand Down
Loading