diff --git a/categories/categories.go b/categories/categories.go index 1e0577f..9204c37 100644 --- a/categories/categories.go +++ b/categories/categories.go @@ -168,7 +168,12 @@ var Deployment = api.Category{ Slug: "deployment", Description: `This category evaluates your project's ability to be deployed in the real world. -It is not yet implemented, but may contain rules about Dockerfiles and configurability, among others.`, +It is not yet implemented, but may contain rules about Dockerfiles and configurability, among others. + +Recommendations: +- [SeldonCore](https://github.com/SeldonIO/seldon-core) - An open source platform to deploy your machine learning models on Kubernetes at massive scale. + Seldon handles scaling to thousands of production machine learning models and provides advanced machine learning capabilities out of the box including + Advanced Metrics, Request Logging, Explainers, Outlier Detectors, A/B Tests, Canaries and more.`, } var Custom = api.Category{ diff --git a/commands/render.go b/commands/render.go new file mode 100644 index 0000000..0889241 --- /dev/null +++ b/commands/render.go @@ -0,0 +1,43 @@ +package commands + +import ( + "fmt" + "io/ioutil" + "path" + + "github.com/bvobart/mllint/utils" + "github.com/bvobart/mllint/utils/markdown" + "github.com/spf13/cobra" +) + +func NewRenderCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "render FILE", + Short: "Render an " + formatInlineCode("mllint") + " report to your terminal.", + Long: fmt.Sprintf(`Renders an %s report to your terminal in a pretty way.`, formatInlineCode("mllint")), + RunE: render, + Args: cobra.ExactArgs(1), + SilenceErrors: true, + SilenceUsage: true, + } + return cmd +} + +func render(cmd *cobra.Command, args []string) error { + filename := args[0] + if !utils.FileExists(filename) { + return fmt.Errorf("cannot find file: %s", filename) + } + + if path.Ext(filename) != ".md" { + return fmt.Errorf("mllint can only render Markdown files, but the provided filename does not end with '.md': %s", filename) + } + + contents, err := ioutil.ReadFile(filename) + if err != nil { + return fmt.Errorf("cannot read from the given file: %w", err) + } + + fmt.Println(markdown.Render(string(contents))) + return nil +} diff --git a/commands/root.go b/commands/root.go index 9abe2be..8075c8c 100644 --- a/commands/root.go +++ b/commands/root.go @@ -36,6 +36,7 @@ func NewRootCommand() *cobra.Command { cmd.AddCommand(NewRunCommand()) cmd.AddCommand(NewListCommand()) cmd.AddCommand(NewConfigCommand()) + cmd.AddCommand(NewRenderCommand()) cmd.AddCommand(NewVersionCommand()) cmd.AddCommand(NewDescribeCommand()) return cmd