Skip to content

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BettyPy - Python Style Guide for Betty

Build Status License Python Version Linux macOS Windows

BettyPy is a Python style guide for the Betty programming language. It enforces best practices and ensures clean, readable, and maintainable code.


Table of Contents

Click to expand

Description

BettyPy provides a set of rules and guidelines for writing Python code in the Betty programming language. It helps developers maintain consistent coding standards and improve code quality.


Features

Feature Description
Empty files Detects and warns about empty files in the project.
Line Length Ensures that lines do not exceed 80 characters for better readability.
Indentation Enforces 4 spaces per indentation level to maintain consistent formatting.
Docstring Checks for missing or improperly formatted docstrings in code.
Comment Ensures comments are clear, properly formatted, and start with a space.
Codetag Detects TODO, FIXME, and other annotations in the code.
Import Identifies unused imports and suggests their removal.
Last Line Ensures the file ends with a newline character.
Function Name Verifies that function names follow the snake_case naming convention.
Unused Function Detects unused functions in the code.
Variable Name Ensures variable names follow the snake_case naming convention.
Unused Variable Detects unused variables in the code.

Installation

Linux

To install BettyPy on Linux, follow these steps:

$ git clone https://github.com/ItsZmainDev/BettyPy.git
$ cd BettyPy
$ sudo ./install.sh
Windows - Not available yet

Note: Windows support is experimental and may not work as expected. Use at your own risk. To install BettyPy on Windows, follow these steps:

$ git clone https://github.com/ItsZmainDev/BettyPy.git
$ cd BettyPy
$ install_windows.bat

Usage

Run BettyPy on your Python file with the following command:

$ bettypy <path_to_your_python_file>

Example

Example Python file

# This is an example Python file

def function_example():
	# print("cette ligne est trop longue et dépasse 80 caractères, ce qui est inacceptable dans le style de codage de Betty.")
    print("cette ligne n'est pas indentée correctement et doit être corrigée.")

####test

Command to run BettyPy

$ bettypy example.py

Output of BettyPy

root@eddc83f1bb46:/home/ubuntu/BettyPy# bettypy tests/testfile.py 
[2025-04-14 22:30:46] [INFO] tests/testfile.py - Starting analysis...
[2025-04-14 22:30:46] [WARNING] tests/testfile.py:4: line too long (125 characters)
[2025-04-14 22:30:46] [WARNING] tests/testfile.py:5: line too long (82 characters)
[2025-04-14 22:30:46] [WARNING] tests/testfile.py:7: comment should start with a space after #
[2025-04-14 22:30:46] [WARNING] tests/testfile.py:7: comment too short (4 characters)
[2025-04-14 22:30:46] [WARNING] tests/testfile.py: file should end with a new line
[2025-04-14 22:30:46] [WARNING] tests/testfile.py:3: Function 'def function_example():' is missing a docstring.
[2025-04-14 22:30:46] [WARNING] tests/testfile.py:: line should be indented with tabs, not spaces. Please use tabs for indentation.
[2025-04-14 22:30:46] [ERROR] Analysis completed with 7 errors.
root@eddc83f1bb46:/home/ubuntu/BettyPy# 

Requirements

  • Linux or macOS (Windows support is experimental)

Contributing

We welcome contributions to improve BettyPy! Follow these steps to get started:

Option 1: Fork and Submit a Pull Request

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or bug fix:
    $ git checkout -b my-feature
  3. Make your changes and commit them with a clear message:
    $ git commit -m "Add my feature"
  4. Push your changes to your fork:
    $ git push origin my-feature
  5. Open a pull request to the main repository.
  6. Your changes will be reviewed, and if approved, merged into the main branch.
Note:
  • For build the project, you need to use the command:
$ go build cmd/bettypy/main.go

Option 2: Report an Issue

  1. Found a bug or have a feature request? Create an issue in the GitHub repository.
  2. Provide a clear and detailed description of the problem or suggestion.
  3. Include relevant details, such as steps to reproduce the issue or examples of the desired feature.
  4. If you'd like to work on the issue, assign it to yourself or request assignment.
  5. Once your work is complete, submit a pull request referencing the issue.

Review Process

  • All pull requests are reviewed by project maintainers.
  • Feedback will be provided if changes are needed.
  • Once approved, your contribution will be merged, and you’ll be credited for your work.

Thank you for helping improve BettyPy!


Acknowledgments

Holberton School

Holberton School Logo

This project was inspired by the Betty style guide for C, developed at Holberton School. BettyPy was created as a personal project to bring similar coding standards to Python. If it can help students or developers, all the better!


Authors ©


License

This project is licensed under the Mozilla Public License 2.0. See the LICENSE file for details.

About

BettyPy is a Python style guide for the Betty programming language. It provides a set of rules and guidelines for writing clean, readable, and maintainable code in Betty. The goal of BettyPy is to promote best practices and improve the overall quality of code written in Betty.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages