Skip to content

Commit

Permalink
docs: added coding standards (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
graza-io authored Nov 1, 2024
1 parent b662d47 commit 7ad8400
Showing 1 changed file with 62 additions and 0 deletions.
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
```

0 comments on commit 7ad8400

Please sign in to comment.