Blog
Tips

Coding Guide Spotlight: Rego Style Guide

In this occasional series, Sema highlights strong coding practices created by practitioners– style guides, best practices, and advice on algorithms and data structures.

Jun 6, 2022
#
min read
Share
X

Table of contents

Styra, the founders of Open Policy Agent (OPA), have recently released a new style guide for Rego.

As Anders Eknert, Developer Advocate at Styra, wrote: 

Hey everyone! Since several people have asked for a style guide for Rego, I decided to write one. 

The Styra team took lessons from hundreds of thousands of lines of Rego code as well as interviews with leading Rego community members to build this guide. 

The purpose of this style guide is to provide a collection of recommendations and best practices. 

It will be actively maintained, so check the changelogs for updates.

It already has 108 stars. Well done.

What we like

  • Clearly organized
  • Big picture context provided
  • Not only General Advice but also Rules, Variables, and more

Sample: Use opa fmt

Want to learn more?

Want to help?

  • Share your thoughts and ideas by raising an issue in the GitHub project. As Anders wrote: “First iteration, so feedback is much appreciated!” 
  • If you like it, don't forget to give the project a ⭐️
  • Share it with anyone who might be interested :)

Using this Guide in Code Reviews

Sema has built a free code review assistant and developer portfolio tool for GitHub. You can easily access this Style Guide while you do code reviews.

Sign up for free at https://www.semasoftware.com/ 

No items found.
Want to learn more?
Learn more about AI Code Monitor with a Demo

Are you ready?

Sema is now accepting pre-orders for GBOMs as part of the AI Code Monitor.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.