open-policy-agent/regal là dự án hướng lập trình viên trên GitHub với 417 sao, viết chủ yếu bằng Go. Regal is a linter and language server for Rego, bringing your policy development experience to the next level!
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Regal is a linter, debugger and language server for Rego,
making your Rego magnificent, and you the ruler of rules!
With its extensive set of linter rules, documentation and editor integrations, Regal is the perfect companion for policy
development, whether you're an experienced Rego developer or just starting out.
regal
adj : of notable excellence or magnificence : splendid
- Merriam Webster
Goals
Deliver an outstanding policy development experience by providing the best possible tools for that purpose
Identify common mistakes, bugs and inefficiencies in Rego policies, and suggest better approaches
Provide advice on best practices, coding style, and tooling
Allow users, teams and organizations to enforce custom rules on their policy code
What People Say About Regal
I really like that at each release of Regal I learn something new!
Of all the linters I'm exposed to, Regal is probably the most instructive one.
— Leonardo Taccari, NetBSD
Reviewing the Regal rules documentation. Pure gold.
— Dima Korolev, Miro
Such an awesome project!
— Shawn McGuire, Atlassian
I am really impressed with Regal. It has helped me write more expressive and deterministic Rego.
— Jimmy Ray, Boeing
See the adopters file for more Regal users.
Getting Started
Download Regal
# macOS
brew install regal
# linux x86
curl -L -o regal https://github.com/open-policy-agent/regal/releases/latest/download/regal_Linux_x86_64
chmod 755 ./regal
# windows
Invoke-WebRequest -Uri "https://github.com/open-policy-agent/regal/releases/latest/download/regal_Windows_x86_64.exe" -OutFile "regal.exe"
Please see Packages
for a list of package repositories which distribute Regal.
See all versions, and checksum files, at the Regal releases
page, and published Docker images at the packages
page.
Try it out!
First, author some Rego!
package authz
default allow = false
allow if {
isEmployee
"developer" in input.user.roles
}
isEmployee if regex.match("@acmecorp\\.com$", input.user.email)
Next, run regal lint pointed at one or more files or directories to have them linted.
regal lint policy/
Rule: non-raw-regex-pattern
Description: Use raw strings for regex patterns
Category: idiomatic
Location: policy/authz.rego:12:27
Text: isEmployee if regex.match("@acmecorp\\.com$", input.user.email)
Documentation: https://www.openpolicyagent.org/projects/regal/rules/idiomatic/non-raw-regex-pattern
Rule: use-assignment-operator
Description: Prefer := over = for assignment
Category: style
Location: policy/authz.rego:5:1
Text: default allow = false
Documentation: https://www.openpolicyagent.org/projects/regal/rules/style/use-assignment-operator
Rule: prefer-snake-case
Description: Prefer snake_case for names
Category: style
Location: policy/authz.rego:12:1
Text: isEmployee if regex.match("@acmecorp\\.com$", input.user.email)
Documentation: https://www.openpolicyagent.org/projects/regal/rules/style/prefer-snake-case
1 file linted. 3 violations found.
Note
If you're running Regal on an existing policy library, you may want to disable the style category initially, as it
will likely generate a lot of violations. You can do this by passing the --disable-category style flag to
regal lint.
Using Regal in Your Editor
Linting from the command line is a great way to get started with Regal, and even for some experienced developers
the preferred way to work with the linter. However, not only is Regal a linter, but a full-fledged development
companion for Rego development!
Integrating Regal in your favorite editor means you'll get immediate feedback from the linter as you work on your
policies. More than that, it'll unlock a whole new set of features that leverage Regal's
language server,
like context-aware completion suggestions, informative tooltips on hover,
or go-to-definition.
Elevate your policy development experience with Regal in VS Code, Neovim, Zed, Helix
and more on our Editor Support page!
To learn more about the features provided by the Regal language server, see the
Language Server page.
Using Regal in Your Build Pipeline
To ensure Regal's rules are enforced consistently in your project or organization,
we've made it easy to run Regal as part of your builds.
See the docs on Using Regal in your build pipeline to learn more
about how to set up Regal to lint your policies on every commit or pull request.
Next Steps
Now that you're up and running with Regal, take a look around some of our
documentation to get a feel for the different features and capabilities of
Regal.
Rules
Bugs: Common mistakes, potential bugs and inefficiencies in Rego policies.
Idiomatic: Suggestions for more idiomatic constructs.
Imports: Best practices for imports.
Performance: Rules for improving performance of policies.
Style: Rego Style Guide rules.
Testing: Rules for testing and development.
Custom: Custom rules where enforcement can be adjusted to match your preferences.
Configuration: Dig into some of the different configuration options available.
Editor Support: Get Regal integrated into your editor of choice.
Language Server: Learn more
about Regal's advanced editor capabilities.
DAP: Live debug your Rego policies with Regal's DAP support.
Fixing Issues: See Regal can help you fix issues in your Rego policies automatically.
CI/CD: Run Regal as part of your automated checks.
Custom Rules: Learn how to write your own rules for Regal.
Adopters: See who else is using Regal.
Learn More
Documentation
Please see Regal's Documentation Site for the
canonical documentation of Regal.
Contributing
contains information about how to hack on Regal itself.
Regal the Rego Linter, CNCF London meetup, June 2023
Blogs and Articles
Guarding the Guardrails - Introducing Regal the Rego Linter
by Anders Eknert (@anderseknert)
Scaling Open Source Community by Getting Closer to Users
by Charlie Egan (@charlieegan3)
Renovating Rego by Anders Eknert (@anderseknert)
Linting Rego with... Rego! by Anders Eknert (@anderseknert)
Regal: Rego(OPA)用リンタの導入手順 by Jun Fujita (@erueru-tech)
Regal を使って Rego を Lint する
by Shibata Takao (@shibata.takao)
Status
Regal is currently in beta. End-users should not expect any drastic changes, but any API may change without notice.
If you want to embed Regal in another project or product, please reach out!
Roadmap
The current Roadmap items are all related to the preparation for
Regal 1.0:
Go API: Refactor the Location object in Violation (#1554)
Rego API: Provide a stable and well-documented Rego API (#1555)
Go API: Audit and reduce the public Go API surface (#1556)
Custom Rules: Tighten up Authoring experience (#1559)
open-policy-agent/regal thuộc nhóm Developer Tools trên TopGit, cùng 10 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về open-policy-agent/regal ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/open-policy-agent/regal là nguồn chính thức.
open-policy-agent/regal có bao nhiêu sao?
open-policy-agent/regal có 417 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/open-policy-agent/regal. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
open-policy-agent/regal có phải mã nguồn mở không?
Có — open-policy-agent/regal phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/open-policy-agent/regal.
open-policy-agent/regal có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho open-policy-agent/regal. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
open-policy-agent/regal còn đang phát triển không?
Commit gần nhất trên open-policy-agent/regal là 11 ngày trước (theo timestamp GitHub). Repo có 65 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc regal có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về regal.