Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added coding standards #1

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions docs/develop/coding-standards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Coding Standards
sidebar_label: Coding Standards
---

# Coding Standards

- [Code Formatting](#code-formatting)
- [Comments](#comments)
- [Repo Structure](#repo-structure)

## Code Formatting

Code should be formatted with <a href="https://golang.org/cmd/gofmt/" target="_blank" rel="noopener noreferrer">gofmt</a>.

## Comments

TBD.

## Repo Structure

Each plugin should reside in a separate GitHub repository, named `tailpipe-plugin-{plugin name}`. The repo should contain:

- `README.md`
- `LICENSE`
- `Makefile`
- `main.go` - along with corresponding `go.mod` and `go.sum` files.

Along with the following directories
- `{plugin name}` (required): This should contain `plugin.go`.
- `mappers` (optional): May contain go files for any specific mappers required by the plugin in format `{model_name}_mapper.go`.
- `models` (required): Contains go files for models (table row schema) used by the plugin.
- `sources` (optional): May contain go files for any sources required that aren't provided by the SDK, along with any required configuration schemas.
- `tables` (required): Contains go files for table definitions `{model_name}_table.go` and table specific configuration `{model_name}_table_config.go`.

### Example: Repo Structure

```sh
tailpipe-plugin-example
├── LICENSE
├── Makefile
├── README.md
├── example
│   └── plugin.go
├── go.mod
├── go.sum
├── main.go
├── mappers
│   ├── access_log_mapper.go
│   └── audit_log_mapper.go
├── models
│   ├── access_log.go
│   └── audit_log.go
├── sources
│   ├── audit_log_api_source.go
│   └── audit_log_api_source_config.go
└── tables
├── access_log_table.go
├── access_log_table_config.go
├── audit_log_table.go
└── audit_log_table_config.go
```
Loading