
supabase/splinter 是从 https://github.com/supabase/splinter. 导入的特工技能候选人。
概览
supabase/splinter 是从 https://github.com/supabase/splinter. 导入的特工技能候选人。
概述(AI 翻译)
文档:https://supabase.github.io/splinter
源代码:https://github.com/supabase/splinter
Splinter为Supabase项目维护一套lints。它使用SQL查询来识别常见的数据库模式问题。有些lints是通用的,用于Postgres项目,而另一些则是Supabase功能特有的,将数据存储在Postgres中,例如认证和存储。
用途
如果你只想对项目进行 lint 处理,可以在仓库根节点的 splinter.sql 中提供包含所有 lints 最新版本的单一查询。
API暴露绒屑和pgrst.db_schemas
几个lints(例如auth_users_exposed、materialized_view_in_api、foreign_table_in_api)只报告可通过Data API访问的对象——即在pgrst.db_schemas设置中列出的模式中的对象。PostgREST在运行时设置该值,但在普通的psql连接中不存在。
当 pgrst.db_schemas 未设置时,这些 lint 默认仅使用 **public 模式。如果你的项目暴露了额外的模式,在运行 lints 前,将值设置为与你的 PostgREST 配置匹配,这样这些模式也能被覆盖:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
splinter (Supabase Postgres LINTER)
Documentation: https://supabase.github.io/splinter
Source Code: https://github.com/supabase/splinter
Splinter maintains a set of lints for Supabase projects. It uses SQL queries to identify common database schema issues. Some lints are general purpose for Postgres projects while others are specific to Supabase features storing their data in Postgres e.g. auth and storage.
Usage
If you are only interested in linting a project, a single query containing the latest version of all lints is availble in splinter.sql in the repo root.
API-exposure lints and pgrst.db_schemas
Several lints (e.g. auth_users_exposed, materialized_view_in_api, foreign_table_in_api) only report objects that are reachable through the Data API — that is, objects in a schema listed in the pgrst.db_schemas setting. PostgREST sets this value at runtime, but it is not present in a plain psql connection.
When pgrst.db_schemas is unset, these lints default to the public schema only. If your project exposes additional schemas, set the value to match your PostgREST config before running the lints so those schemas are covered too:
set pgrst.db_schemas = 'public, graphql_public, ...';
Without this, exposures in non-public schemas will not be reported.
Lint Interface
Each lint creates a view that returns a common interface. The interface is:
- name (text) not null – Name of the lint
- title (text) not null – Human readable title of the lint
- level (text) not null – The level of issue. One of ERROR/WARN/INFO
- facing (text) not null – Is it an internal (to supabase) or an external (user centric) lint. One of INTERNAL/EXTERNAL
- categories (text[]) not null – Relevant tags for the issue. Any/All of SECURITY/PERFORMANCE (list may grow)
- description (text) not null – This is a description of the lint and why its an issue
- detail (text) not null – A text description of the issue that includes references to the specific table/column/constraint/whatever that fails the lint
- remediation (text) optional – A reference to documentation to describe the issue and how to resolve it
- metadata (jsonb) optional – Lint specific information, for example referenced entities, or entity types
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add supabase/splinter