interagent/schematic

Generated code's comments don't comply with go's conventions

ernesto-jimenez opened this issue · 1 comments

Here's the golint output from the generated code with a simple schema generated with prmd

example.go:1:1: package comment should be of the form "Package hello ..."
example.go:25:2: exported const Version should have comment (or a comment on this block) or be unexported
example.go:35:1: comment on exported function NewService should be of the form "NewService ..."
example.go:46:1: comment on exported method Service.NewRequest should be of the form "NewRequest ..."
example.go:86:1: comment on exported method Service.Do should be of the form "Do ..."
example.go:109:1: exported method Service.Get should have comment or be unexported
example.go:112:1: exported method Service.Patch should have comment or be unexported
example.go:115:1: exported method Service.Post should have comment or be unexported
example.go:118:1: exported method Service.Put should have comment or be unexported
example.go:121:1: exported method Service.Delete should have comment or be unexported
example.go:125:6: exported type ListRange should have comment or be unexported
example.go:133:1: exported method ListRange.SetHeader should have comment or be unexported
example.go:180:1: comment on exported type Resource should be of the form "Resource ..." (with optional leading article)
example.go:186:6: exported type ResourceCreateOpts should have comment or be unexported
example.go:188:1: comment on exported method Service.ResourceCreate should be of the form "ResourceCreate ..."
example.go:194:1: comment on exported method Service.ResourceDelete should be of the form "ResourceDelete ..."
example.go:199:1: comment on exported method Service.ResourceInfo should be of the form "ResourceInfo ..."
example.go:205:1: comment on exported method Service.ResourceList should be of the form "ResourceList ..."
example.go:211:6: exported type ResourceUpdateOpts should have comment or be unexported
example.go:213:1: comment on exported method Service.ResourceUpdate should be of the form "ResourceUpdate ..."
example.go:129:2: struct field FirstId should be FirstID
example.go:130:2: struct field LastId should be LastID

How to reproduce

#!/usr/bin/env bash

rm -rf schemata meta.json schema.json README.md example.go
mkdir schemata

echo "---> Prepare"
prmd init resource > schemata/resource.json
echo '{
  "description": "Hello world prmd API",
  "id": "hello-prmd",
  "links": [{
  "href": "https://api.hello.com",
  "rel": "self"
  }],
  "title": "Hello Prmd",
  "version": "0.1"
}' > meta.json
echo "---> Combine"
prmd combine -m meta.json schemata > schema.json
echo "---> Verify"
prmd verify schema.json && echo "OK"
echo "---> Document"
prmd doc schema.json > README.md
echo "---> Schematic"
schematic schema.json > example.go
golint example.go

I fixed some of them, but some of them will remains since their are depending on the description property of the schema.