Skip to content

Commit 5cd72da

Browse files
authored
Format code with black (#7)
* Added black to requirements and pipeline, ran black to reformat files * Add editorconfig
1 parent 885ef38 commit 5cd72da

File tree

15 files changed

+121
-56
lines changed

15 files changed

+121
-56
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.{html,css,js,json,xml,yaml,yml}]
14+
indent_size = 2
15+
16+
[*.{md,ps1,sh,py,rst}]
17+
indent_size = 4

azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ stages:
8989
- script: flake8 .
9090
displayName: 'CR-QC: Static analysis (flake8)'
9191

92+
- script: black --check .
93+
displayName: 'CR-QC: Format check'
94+
9295
- script: mypy .
9396
displayName: 'CR-QC: Type check (mypy)'
9497

django_sass/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ def find_static_scss() -> List[str]:
3838
return scss_files
3939

4040

41-
def compile_sass(inpath: str, outpath: str, output_style: str = None, precision: int = None,
42-
source_map: bool = False, include_paths: List[str] = None) -> None:
41+
def compile_sass(
42+
inpath: str,
43+
outpath: str,
44+
output_style: str = None,
45+
precision: int = None,
46+
source_map: bool = False,
47+
include_paths: List[str] = None,
48+
) -> None:
4349
"""
4450
Calls sass.compile() within context of Django's known static file paths,
4551
and writes output CSS and/or sourcemaps to file.

django_sass/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class DjangoSassConfig(AppConfig):
5-
name = 'django_sass'
5+
name = "django_sass"

django_sass/management/commands/sass.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def handle(self, *args, **options) -> None:
9595
precision=o_precision,
9696
source_map=o_srcmap,
9797
)
98-
self.stdout.write("Updated files at %s" % time.time())
98+
self.stdout.write(
99+
"Updated files at %s" % time.time()
100+
)
99101
except sass.CompileError as exc:
100102
self.stdout.write(str(exc))
101103

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tool.black]
2+
line-length = 80
3+
target-version = ['py36', 'py37', 'py38']
4+
# Regular expression of files to exclude.
5+
exclude = '''
6+
/(
7+
migrations
8+
)/
9+
'''

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-e ./
2+
black
23
flake8
34
mypy
45
pytest

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from setuptools import setup, find_packages
33

44

5-
with open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf8") as readme:
5+
with open(
6+
os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf8"
7+
) as readme:
68
README = readme.read()
79

810
setup(
@@ -11,8 +13,10 @@
1113
author="CodeRed LLC",
1214
author_email="[email protected]",
1315
url="https://github.com/coderedcorp/django-sass",
14-
description=("The absolute simplest way to use Sass with Django. Pure Python, "
15-
"minimal dependencies, and no special configuration required!"),
16+
description=(
17+
"The absolute simplest way to use Sass with Django. Pure Python, "
18+
"minimal dependencies, and no special configuration required!"
19+
),
1620
long_description=README,
1721
long_description_content_type="text/markdown",
1822
license="BSD license",

testproject/app1/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class App1Config(AppConfig):
5-
name = 'app1'
5+
name = "app1"

testproject/app2/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class App2Config(AppConfig):
5-
name = 'app2'
5+
name = "app2"

0 commit comments

Comments
 (0)