Skip to content

A repository of coding standards and best practices for maintaining consistent and high-quality code across UnifiedBits projects. It includes guidelines for multiple languages and tools to ensure readability, maintainability, and smooth collaboration.

Notifications You must be signed in to change notification settings

Bluehead80/code-style-guidelines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Code Style Guidelines 📚

Code Style Guidelines

Welcome to the Code Style Guidelines repository! This project aims to provide a comprehensive set of coding standards and best practices to maintain consistent and high-quality code across UnifiedBits projects. Our guidelines cover multiple programming languages and tools, ensuring readability, maintainability, and smooth collaboration among team members.

Table of Contents

  1. Introduction
  2. Languages Covered
  3. Getting Started
  4. Guidelines
  5. Testing Standards
  6. CI/CD Practices
  7. Contributing
  8. License
  9. Releases

Introduction

In software development, consistency is key. Following a set of coding standards helps ensure that everyone on the team writes code in a similar manner. This leads to better readability and maintainability. The Code Style Guidelines repository is designed to help you adopt best practices in your coding journey.

For detailed information and updates, please visit our Releases section.

Languages Covered

This repository includes guidelines for the following programming languages:

  • C++
  • C#
  • Dart
  • Flutter
  • Java
  • JavaScript
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Rust
  • TypeScript

Getting Started

To get started with our coding standards, clone this repository:

git clone https://github.com/Bluehead80/code-style-guidelines.git

Once you have cloned the repository, navigate to the directory:

cd code-style-guidelines

Here, you will find folders and files dedicated to each language. Review the specific guidelines for the language you are working with.

Guidelines

General Principles

  1. Readability: Code should be easy to read and understand. Use meaningful names for variables, functions, and classes.
  2. Consistency: Follow the same style throughout the codebase. Use the same naming conventions and formatting.
  3. Documentation: Comment your code where necessary. Use docstrings for functions and classes to explain their purpose.
  4. Version Control: Use Git for version control. Make clear and concise commit messages.

Language-Specific Guidelines

C++

  • Use camelCase for variable names and PascalCase for class names.
  • Indent with spaces, not tabs. Use four spaces per indentation level.
  • Place #include directives at the top of the file.

C#

  • Follow the .NET naming conventions. Use PascalCase for public members and camelCase for private members.
  • Use XML documentation comments for public methods and classes.
  • Keep lines of code to a maximum of 120 characters.

Dart

  • Use lowerCamelCase for variable and function names.
  • Prefer const and final for variables when applicable.
  • Organize imports into three sections: Dart SDK, third-party packages, and local files.

Flutter

  • Use Widgets to build the UI. Keep the business logic separate.
  • Follow the Material Design guidelines for consistency.
  • Utilize StatelessWidget and StatefulWidget appropriately.

Java

  • Use camelCase for variable and method names, and PascalCase for class names.
  • Use Javadoc comments for public methods and classes.
  • Follow the Java Code Conventions for formatting.

JavaScript

  • Use camelCase for variable names and PascalCase for classes.
  • Use const and let instead of var for variable declarations.
  • Follow ESLint rules for consistent code style.

Kotlin

  • Use camelCase for variable and function names.
  • Use PascalCase for class names.
  • Utilize data classes for simple data holding.

PHP

  • Use camelCase for variable names and PascalCase for class names.
  • Follow the PSR-1 and PSR-2 standards for coding style.
  • Use PHPDoc for documentation.

Python

  • Follow the PEP 8 style guide for Python code.
  • Use snake_case for variable and function names.
  • Keep lines to a maximum of 79 characters.

Ruby

  • Use snake_case for method and variable names.
  • Use PascalCase for class names.
  • Follow the Ruby Style Guide for formatting.

Rust

  • Use snake_case for variable and function names.
  • Use CamelCase for struct and enum names.
  • Follow the Rust Style Guide for best practices.

TypeScript

  • Use camelCase for variable names and PascalCase for class names.
  • Utilize interfaces for type definitions.
  • Keep code clean and maintainable by following TypeScript best practices.

Testing Standards

Testing is crucial for ensuring code quality. Follow these standards:

  1. Write unit tests for all functions and classes.
  2. Use a testing framework appropriate for your language (e.g., JUnit for Java, pytest for Python).
  3. Aim for at least 80% code coverage.

CI/CD Practices

Implementing Continuous Integration and Continuous Deployment (CI/CD) helps automate the development process. Follow these practices:

  1. Use a CI/CD tool (e.g., GitHub Actions, Jenkins) to automate builds and tests.
  2. Run tests on every pull request to ensure code quality.
  3. Deploy to production only after passing all tests.

Contributing

We welcome contributions to improve this repository. To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Make your changes and commit them.
  4. Submit a pull request.

Please ensure that your contributions follow the coding standards outlined in this repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

For the latest updates and downloadable files, please check our Releases section. Here, you can find versioned releases that you can download and execute.


Thank you for checking out the Code Style Guidelines repository! Together, we can maintain high-quality code and foster a collaborative environment at UnifiedBits. Happy coding!

About

A repository of coding standards and best practices for maintaining consistent and high-quality code across UnifiedBits projects. It includes guidelines for multiple languages and tools to ensure readability, maintainability, and smooth collaboration.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published