250 lines
5.3 KiB
Markdown
250 lines
5.3 KiB
Markdown
# Contributing to Aurganize V6.2
|
|
|
|
Thank you for contributing to Aurganize! This document provides guidelines and instructions for contributing to the project.
|
|
|
|
## 📋 Table of Contents
|
|
|
|
- [Code of Conduct](#code-of-conduct)
|
|
- [Getting Started](#getting-started)
|
|
- [Development Workflow](#development-workflow)
|
|
- [Coding Standards](#coding-standards)
|
|
- [Commit Message Guidelines](#commit-message-guidelines)
|
|
- [Pull Request Process](#pull-request-process)
|
|
- [Testing Requirements](#testing-requirements)
|
|
|
|
## 🤝 Code of Conduct
|
|
|
|
- Be respectful and inclusive
|
|
- Provide constructive feedback
|
|
- Accept constructive criticism gracefully
|
|
- Focus on what is best for the project
|
|
|
|
## 🚀 Getting Started
|
|
|
|
1. **Fork the repository**
|
|
2. **Clone your fork:**
|
|
```bash
|
|
git clone https://github.com/YOUR_USERNAME/aurganize-v62.git
|
|
cd aurganize-v62
|
|
```
|
|
3. **Add upstream remote:**
|
|
```bash
|
|
git remote add upstream https://github.com/yourorg/aurganize-v62.git
|
|
```
|
|
4. **Setup development environment:** Follow [README.md](README.md)
|
|
|
|
## 🔄 Development Workflow
|
|
|
|
### 1. Sync with Upstream
|
|
```bash
|
|
git checkout develop
|
|
git fetch upstream
|
|
git merge upstream/develop
|
|
git push origin develop
|
|
```
|
|
|
|
### 2. Create Feature Branch
|
|
```bash
|
|
# Branch from develop
|
|
git checkout develop
|
|
git checkout -b feature/your-feature-name
|
|
```
|
|
|
|
**Branch naming conventions:**
|
|
- `feature/` - New features
|
|
- `bugfix/` - Bug fixes
|
|
- `hotfix/` - Urgent production fixes
|
|
- `refactor/` - Code refactoring
|
|
- `docs/` - Documentation changes
|
|
- `test/` - Adding/improving tests
|
|
|
|
### 3. Make Changes
|
|
|
|
- Write code following our [coding standards](#coding-standards)
|
|
- Write/update tests
|
|
- Update documentation if needed
|
|
- Test locally before committing
|
|
|
|
### 4. Commit Changes
|
|
```bash
|
|
git add .
|
|
git commit -m "feat: add user authentication"
|
|
```
|
|
|
|
See [commit message guidelines](#commit-message-guidelines) below.
|
|
|
|
### 5. Push to Your Fork
|
|
```bash
|
|
git push origin feature/your-feature-name
|
|
```
|
|
|
|
### 6. Create Pull Request
|
|
|
|
- Go to GitHub repository
|
|
- Click "New Pull Request"
|
|
- Select your feature branch
|
|
- Fill out PR template completely
|
|
- Request review from team members
|
|
|
|
## 📝 Coding Standards
|
|
|
|
### Go (Backend)
|
|
|
|
**Style Guide:**
|
|
- Follow [Effective Go](https://golang.org/doc/effective_go)
|
|
- Use `gofmt` for formatting
|
|
- Use `golangci-lint` for linting
|
|
|
|
**File Organization:**
|
|
```go
|
|
package handlers
|
|
|
|
// Imports grouped and sorted
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
"github.com/yourorg/aurganize-v62/backend/internal/models"
|
|
)
|
|
|
|
// Constants first
|
|
const (
|
|
DefaultTimeout = 30 * time.Second
|
|
)
|
|
|
|
// Types next
|
|
type AuthHandler struct {
|
|
service *services.AuthService
|
|
}
|
|
|
|
// Constructor
|
|
func NewAuthHandler(service *services.AuthService) *AuthHandler {
|
|
return &AuthHandler{service: service}
|
|
}
|
|
|
|
// Methods
|
|
func (h *AuthHandler) Login(c echo.Context) error {
|
|
// Implementation
|
|
}
|
|
```
|
|
|
|
**Naming Conventions:**
|
|
- **Packages:** lowercase, single word (e.g., `handlers`)
|
|
- **Files:** lowercase, underscore-separated (e.g., `auth_handler.go`)
|
|
- **Functions:** PascalCase for exported, camelCase for private
|
|
- **Variables:** camelCase
|
|
- **Constants:** PascalCase or SCREAMING_SNAKE_CASE for globals
|
|
|
|
**Error Handling:**
|
|
```go
|
|
// Always check errors
|
|
result, err := someFunction()
|
|
if err != nil {
|
|
return fmt.Errorf("failed to do something: %w", err)
|
|
}
|
|
|
|
// Use %w to wrap errors (enables errors.Is and errors.As)
|
|
```
|
|
|
|
**Comments:**
|
|
```go
|
|
// Package-level comment
|
|
// package handlers provides HTTP request handlers for the API.
|
|
package handlers
|
|
|
|
// Exported functions must have doc comments
|
|
// Login handles user authentication requests.
|
|
// It validates credentials and returns a JWT token.
|
|
func Login(c echo.Context) error {
|
|
// Implementation comments for complex logic
|
|
// ...
|
|
}
|
|
```
|
|
|
|
### TypeScript (Frontend)
|
|
|
|
**Style Guide:**
|
|
- Follow [TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html)
|
|
- Use ESLint and Prettier (configured)
|
|
|
|
**File Organization:**
|
|
```typescript
|
|
// Imports
|
|
import type { User } from '$lib/types';
|
|
import { authStore } from '$lib/stores/auth';
|
|
|
|
// Types/Interfaces
|
|
interface LoginForm {
|
|
email: string;
|
|
password: string;
|
|
}
|
|
|
|
// Constants
|
|
const MAX_LOGIN_ATTEMPTS = 5;
|
|
|
|
// Functions
|
|
export async function login(form: LoginForm): Promise<User> {
|
|
// Implementation
|
|
}
|
|
```
|
|
|
|
**Naming Conventions:**
|
|
- **Files:** kebab-case (e.g., `auth-service.ts`)
|
|
- **Components:** PascalCase (e.g., `LoginForm.svelte`)
|
|
- **Functions:** camelCase
|
|
- **Constants:** SCREAMING_SNAKE_CASE
|
|
- **Types/Interfaces:** PascalCase
|
|
|
|
**Svelte Components:**
|
|
```svelte
|
|
<script lang="ts">
|
|
// Props
|
|
export let userId: string;
|
|
export let showDetails = false;
|
|
|
|
// Reactive declarations
|
|
$: fullName = `${firstName} ${lastName}`;
|
|
|
|
// Functions
|
|
function handleClick() {
|
|
// ...
|
|
}
|
|
</script>
|
|
|
|
<div>
|
|
<!-- Template -->
|
|
</div>
|
|
|
|
<style>
|
|
/* Scoped styles */
|
|
</style>
|
|
```
|
|
|
|
### SQL (Database)
|
|
|
|
**Style:**
|
|
- Keywords in UPPERCASE
|
|
- Table/column names in lowercase with underscores
|
|
- Indent for readability
|
|
```sql
|
|
-- Good
|
|
SELECT
|
|
u.id,
|
|
u.email,
|
|
t.name AS tenant_name
|
|
FROM users u
|
|
INNER JOIN tenants t ON u.tenant_id = t.id
|
|
WHERE u.is_active = TRUE
|
|
ORDER BY u.created_at DESC;
|
|
|
|
-- Bad
|
|
select u.id, u.email, t.name from users u join tenants t on u.tenant_id=t.id where u.is_active=true;
|
|
```
|
|
|
|
## 💬 Commit Message Guidelines
|
|
|
|
We follow [Conventional Commits](https://www.conventionalcommits.org/).
|
|
|
|
### Format |