Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
/ style-configs Public archive

Code format config files for C++ and Python

License

Notifications You must be signed in to change notification settings

RoboJackets/style-configs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

style-configs

This repo contains config files that specify how code should be formatted, allowing us to easily keep code formatting consistent in an automated way.

Contents:

  • .clang-format - Config file for clang-format, which formats C/C++ code
  • .style.yapf - Config file for yapf, which formats Python code

Note: These config files are used by multiple RoboJackets teams, so please consult with each of them before making changes.

Usage

These configs can be used in another project to define how the code in that project should be formatted. To add these configs to a project:

# enter the project's directory
cd my-project

# add git submodule
git submodule add https://github.com/robojackets/style-configs

# symlink the config files to the root of the project
ln -s style-configs/.clang-format ./
ln -s style-configs/.style.yapf ./

# commit your changes
git add .
git commit -m 'added robojackets style configs'

After the configs are added to your project, you can use stylize to format your code. Note that by default stylize will change your files in-place, so it may be a good idea to commit any outstanding changes before you run it.

# install stylize from pypi
pip install stylize

# see instructions for how to use stylize
stylize --help

# run stylize, specifying the config files and an exclude directory
stylize --clang_style=file --yapf_style=.style.yapf --exclude_dirs build

# show exactly what was changed by the formatter (assuming you committed code before running)
git diff

About

Code format config files for C++ and Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published