Skip to content

algoverzum/problemset

Repository files navigation

Algoverzum Problemset

An open problemset for teaching programming — from absolute basics to advanced competitive programming. Jointly maintained and used by MATFIN Foundation and Algo Pro Club.

License: CC-BY-SA 4.0

Autoformating and precommit setup guide

  • Install pre-commit, black and clang-format. These are the tools used for autoformating in the project.
pip install pre-commit
pip install black
pip install clang-format

Remark: It worked for ubuntu 22.04, but for 24.04 I needed this: sudo apt install pre-commit black clang-format.

  • Set up precommit hooks
pre-commit install

Autoformat usage guide

Black and clang-format automatically checks added python and c++ files before each commit and formats them if they do not fit the formating requirements. In this case the formated files need to be added and commited again.
To avoid having to do each commit twice, run the format.py python script in the root directory, which runs formating on all .py and .cpp files in the repository. If the script cannot run, because python is not a recognized command, then you should run this command in your terminal, which creates a link from the python command to the python3 command.

sudo ln -s $(which python3) /usr/bin/python

Alternatively you can setup VSCode to automatically format files according to black and clang-format. For black, you need to download an extension

extension id: ms-python.black-formatter

If you want to run formating on a specific file, you can use these commands

  • Black:
python -m black myfilename.py
  • clang-format
clang-format -i myfilename.cpp

About

An open problemset for teaching programming — from absolute basics to advanced competitive programming.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors