Skip to content

Commit ea3e551

Browse files
committed
Add Contribution Guid & Code Style Guid
1 parent 7a190cb commit ea3e551

9 files changed

+218
-2
lines changed

.github/workflows/ubuntu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ on:
77
push:
88
branches:
99
- main
10+
- dev
1011
pull_request:
1112
branches:
1213
- main
14+
- dev
1315

1416
# Allows you to run this workflow manually from the Actions tab
1517
workflow_dispatch:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ We welcome contributions from the community!
118118
7. Open a Pull Request
119119

120120
### Development Guidelines
121-
- Follow the code style guide
121+
- Follow the [Code Style Guide](docs/CODE_STYLE_GUIDE.md)
122122
- Write tests for new features
123123
- Update documentation for any changes
124-
- See CONTRIBUTING.md for detailed guidelines
124+
- See [Contributing Guide](docs/CONTRIBUTING.md) for detailed guidelines
125125

126126
<br>
127127

docs/CODE_STYLE_GUIDE.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# TensorBlock Studio Code Style Guide
2+
3+
This guide outlines the coding conventions and practices used in the TensorBlock Studio project. Following these guidelines ensures code consistency and maintainability across the codebase.
4+
5+
## General Formatting
6+
7+
- Use UTF-8 character encoding for all files
8+
- Use spaces for indentation (2 spaces)
9+
- Insert a final newline at the end of each file
10+
- Trim trailing whitespaces
11+
- Keep lines at a reasonable length (recommended 100 characters)
12+
13+
## TypeScript Guidelines
14+
15+
### Naming Conventions
16+
17+
- Use **camelCase** for variables, functions, and properties
18+
- Use **PascalCase** for classes, interfaces, types, enums, and React components
19+
- Use **UPPERCASE_SNAKE_CASE** for constants
20+
- Prefix interfaces with `I` (e.g., `IUser`)
21+
- Prefix types with `T` (e.g., `TConfig`)
22+
- Prefix enum names with `E` (e.g., `EStatus`)
23+
24+
### Imports and Exports
25+
26+
- Use named exports for utility functions and components
27+
- Use default exports for main component files
28+
- Group imports in the following order:
29+
1. React and React-related libraries
30+
2. Third-party libraries
31+
3. Project modules (with relative paths)
32+
4. Types and interfaces
33+
5. Assets (styles, images, etc.)
34+
- Use single quotes for imports
35+
36+
### TypeScript Best Practices
37+
38+
- Use explicit type annotations for function parameters and return types
39+
- Use interfaces for object shapes when possible
40+
- Avoid using `any` type; use more specific types or `unknown` when necessary
41+
- Use TypeScript's built-in utility types when appropriate (e.g., `Partial<T>`, `Pick<T>`)
42+
- Use optional chaining (`?.`) and nullish coalescing (`??`) operators
43+
44+
## React Guidelines
45+
46+
### Component Structure
47+
48+
- Prefer functional components with hooks over class components
49+
- Keep components focused on a single responsibility
50+
- Extract complex logic into custom hooks
51+
- Extract reusable UI elements into separate components
52+
- Use React fragments (`<>...</>`) to avoid unnecessary DOM elements
53+
54+
### Props and State
55+
56+
- Destructure props in function parameters
57+
- Define prop types using TypeScript interfaces
58+
- Use the useState hook for component state
59+
- Use the useEffect hook for side effects
60+
- Follow the React hooks rules (only call hooks at the top level)
61+
62+
### Event Handling
63+
64+
- Use arrow functions for event handlers
65+
- Name event handlers with the format `handle{Event}` (e.g., `handleClick`)
66+
- Pass event handlers as props with the format `on{Event}` (e.g., `onClick`)
67+
68+
## CSS and Styling
69+
70+
- Use Tailwind CSS for styling components
71+
- Follow a mobile-first approach when implementing responsive designs
72+
- Use the `@apply` directive in CSS files only when necessary
73+
- Keep styling consistent with the design system
74+
75+
## Testing
76+
77+
- Write tests for all new features
78+
- Use descriptive test names that explain what is being tested
79+
- Follow the Arrange-Act-Assert pattern in tests
80+
- Mock external dependencies in unit tests
81+
82+
## Git Guidelines
83+
84+
- Write clear, concise commit messages in the imperative mood
85+
- Keep commits focused on a single task or fix
86+
- Reference issue numbers in commit messages when applicable
87+
- Use feature branches for new features and bugfixes
88+
89+
## Documentation
90+
91+
- Add JSDoc comments for functions, interfaces, and classes
92+
- Keep documentation up-to-date with code changes
93+
- Document complex algorithms or business logic with inline comments
94+
- Update the README.md and other documentation files when introducing significant changes
95+
96+
By adhering to these guidelines, we maintain a consistent and high-quality codebase that is easier to understand, maintain, and extend.

docs/CONTRIBUTING.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Contributing to TensorBlock Studio
2+
3+
Thank you for your interest in contributing to TensorBlock Studio! This document provides guidelines and instructions for contributing to the project.
4+
5+
## Code of Conduct
6+
7+
All contributors are expected to adhere to our code of conduct, which promotes a welcoming and inclusive environment for everyone.
8+
9+
## Getting Started
10+
11+
### Setting Up the Development Environment
12+
13+
1. **Fork the repository** on GitHub
14+
2. **Clone your fork** to your local machine:
15+
```bash
16+
git clone https://github.com/yourusername/TensorBlock-Studio.git
17+
cd TensorBlock-Studio
18+
```
19+
3. **Install dependencies**:
20+
```bash
21+
npm install
22+
```
23+
4. **Set up environment variables**:
24+
- Copy `.env.example` to `.env`
25+
- Add any required API keys or configuration values
26+
27+
### Development Workflow
28+
29+
1. **Create a new branch** for your feature or bugfix:
30+
```bash
31+
git checkout -b feature/your-feature-name
32+
# or
33+
git checkout -b fix/issue-description
34+
```
35+
2. **Make your changes** following our [Code Style Guide](CODE_STYLE_GUIDE.md)
36+
3. **Run the development server**:
37+
```bash
38+
npm run dev
39+
```
40+
4. **Test your changes** to ensure they work as expected
41+
42+
## Submitting Changes
43+
44+
### Pull Requests
45+
46+
1. **Commit your changes** with clear, descriptive commit messages:
47+
```bash
48+
git commit -m "Add: implementation of feature X"
49+
```
50+
2. **Push your branch** to your fork:
51+
```bash
52+
git push origin feature/your-feature-name
53+
```
54+
3. **Open a Pull Request** against the main repository:
55+
- Provide a clear title and description
56+
- Reference any related issues
57+
- Fill out the pull request template
58+
59+
### Pull Request Guidelines
60+
61+
- Keep PRs focused on a single feature or bugfix
62+
- Make sure your code follows our [Code Style Guide](CODE_STYLE_GUIDE.md)
63+
- All tests must pass
64+
- Update documentation for any changes to APIs or features
65+
- Include screenshots or GIFs for UI changes when possible
66+
67+
## Development Standards
68+
69+
### Testing
70+
71+
- Write tests for new features and bugfixes
72+
- Ensure all existing tests pass before submitting a PR
73+
- Run tests locally with:
74+
```bash
75+
npm run test
76+
```
77+
78+
### Documentation
79+
80+
- Update documentation when changing or adding features
81+
- Document new components and functions with JSDoc comments
82+
- Update README.md if your changes affect how users interact with the application
83+
84+
### Code Quality
85+
86+
- Follow the TypeScript and React best practices outlined in our [Code Style Guide](CODE_STYLE_GUIDE.md)
87+
- Use ESLint to ensure code quality:
88+
```bash
89+
npm run lint
90+
```
91+
92+
## Feature Requests and Bug Reports
93+
94+
- Use the GitHub issue tracker to report bugs or request features
95+
- Check for existing issues before creating a new one
96+
- Provide detailed steps to reproduce bugs
97+
- Include information about your environment (OS, browser, etc.)
98+
99+
## Project Structure
100+
101+
```
102+
├── app/ # Electron main process files
103+
├── docs/ # Documentation
104+
├── src/
105+
│ ├── components/ # React components
106+
│ ├── services/ # Application services
107+
│ ├── styles/ # Global styles
108+
│ └── types/ # TypeScript type definitions
109+
```
110+
111+
## Communication
112+
113+
- Use GitHub issues for bug reports and feature requests
114+
- Join our community discussions for general questions and ideas
115+
116+
Thank you for contributing to TensorBlock Studio!

docs/docs_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ This documentation provides a comprehensive overview of the TensorBlock Studio a
88
- [Components](components.md) - UI components documentation
99
- [Services](services.md) - Core services documentation
1010
- [Types](types.md) - Data types and interfaces
11+
- [Code Style Guide](CODE_STYLE_GUIDE.md) - Coding standards and best practices
12+
- [Contributing Guide](CONTRIBUTING.md) - Guidelines for contributing to the project
1113

1214
## Project Overview
1315

-378 KB
Binary file not shown.
-820 KB
Binary file not shown.
-613 KB
Binary file not shown.
-558 KB
Binary file not shown.

0 commit comments

Comments
 (0)