How can I run black formatting on a cookiecutter template?
Asked Answered
P

0

6

I am using pre-commit with black and flake8 hooks.

I got this error: cannot format when trying to black-format the following code

from {{cookiecutter.project_name}} import my_module

Is there anyway to indicate black, to skip/ignore cookiecutter-specific syntax?

Palikar answered 29/6, 2020 at 23:49 Comment(3)
I'd suggest running/testing the formatting after expansion -- linting template code can be trickySandry
It's just that I'm creating a scaffolding library. I need it to be flake8 compatible. It's a requirement. I think I'll do it by hand at the moment.Berberidaceous
How about excluding the {{cookiecutter.project_slug}} directory altogether? That's what I did on this project.Dissidence

© 2022 - 2024 — McMap. All rights reserved.