Giter VIP home page Giter VIP logo

pre-commit's Introduction


๐Ÿ›  Ultralytics Pre-commit Hooks

This repository contains pre-commit hooks developed by Ultralytics for ensuring code quality and standards in our software development practices. By leveraging these hooks, developers can automate the process of code validation, thus maintaining a high level of code hygiene.

Ultralytics Actions

๐Ÿ—‚ Repository Structure

The repository is thoughtfully structured to facilitate easy navigation and understanding:

  • A hooks directory comprising all the individual Python scripts, each serving as a distinct hook for specific checks or code quality assurances.
  • The .pre-commit-hooks.yaml file located at the root, which specifies the available hooks for easy integration into your projects.

Hook Scripts in hooks Directory ๐Ÿ“‚

Each script housed within the hooks directory is a self-contained Python program designed to carry out a particular pre-commit check. For example:

  • capitalize_comments.py: This script ensures that the first letter of standalone inline comments begins with a capital letter, fostering readability and a professional codebase demeanor.

Defining Hooks in .pre-commit-hooks.yaml ๐Ÿ“˜

Hooks available for installation are declared within the .pre-commit-hooks.yaml file. An example definition would resemble:

- id: hook-id
  name: 'A Name Describing What the Hook Does'
  entry: hooks/name_of_your_hook_script.py
  language: python
  types: [python]

Where the elements are as follows:

  • hook-id represents a unique identifier for the hook you are configuring.
  • A Name Describing What the Hook Does: A brief, intuitive name that indicates the functionality of the hook.
  • name_of_your_hook_script.py is the filename for the Python script that resides in the hooks directory and codifies the logic for the hook.

โž• Adding Additional Hooks

If you're interested in contributing a fresh hook, here's how you can add one:

  1. Craft Your Hook Script: Write a Python script that encapsulates the functionality of your new hook. This script should be placed within the hooks directory. For maintainability and ease-of-understanding, ensure your script contains appropriate error handling and outputs useful messages.
  2. Declare Your New Hook: Extend the .pre-commit-hooks.yaml with a new block that follows the definition pattern showcased earlier.
  3. Local Testing: Before integrating your hook into the repository, ensure that you have tested it in a local project setting to affirm its operational behavior.
  4. Sync to Repository: After satisfactory local validation, commit your work to the repository and initiate a push to share your hook with the community.

๐Ÿ”ง Installing Hooks in Your Project

To harness the power of Ultralytics pre-commit hooks within your project, add their specifications into your .pre-commit-config.yaml like so:

- repo: https://github.com/ultralytics/pre-commit-hooks
  rev: main  # You might prefer pinning this to a specific git tag or commit SHA.
  hooks:
    - id: hook-id

Execute this command within your project's directory to set up the pre-commit framework:

pre-commit install

With this action, the identified pre-commit hooks from Ultralytics will now be a part of your workflow, automatically running during the commit phase.

๐Ÿ’ก Contribute

Ultralytics thrives on community collaboration; we immensely value your involvement! We urge you to peruse our Contributing Guide for detailed insights on how you can participate. Don't forget to share your feedback with us by contributing to our Survey. A heartfelt thank you ๐Ÿ™ goes out to everyone who has already contributed!

Ultralytics open-source contributors

๐Ÿ“„ License

Ultralytics presents two distinct licensing paths to accommodate a variety of scenarios:

  • AGPL-3.0 License: This official OSI-approved open-source license is perfectly aligned with the goals of students, enthusiasts, and researchers who believe in the virtues of open collaboration and shared wisdom. Details are available in the LICENSE document.
  • Enterprise License: Tailored for commercial deployment, this license authorizes the unfettered integration of Ultralytics software and AI models within commercial goods and services, without the copyleft stipulations of AGPL-3.0. Should your use case demand an enterprise solution, direct your inquiries to Ultralytics Licensing.

๐Ÿ“ฎ Contact

For bugs or feature suggestions pertaining to Ultralytics, please lodge an issue via GitHub Issues. You're also invited to participate in our Discord community to engage in discussions and seek advice!


Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics Instagram space Ultralytics Discord

pre-commit's People

Contributors

glenn-jocher avatar pderrenger avatar ultralyticsassistant avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.