Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace autopep8 with Black as the Python formatter #115

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
long_description_content_type="text/markdown",
install_requires=[
"argparse",
"autopep8>=1.4.3",
"black>=23.10.0",
"icdiff",
"jsbeautifier",
"pycodestyle==2.10.0",
@@ -40,6 +40,6 @@
]
},
url="https://github.com/cs50/style50",
version="2.8.2",
version="2.9.0",
include_package_data=True,
)
6 changes: 3 additions & 3 deletions style50/languages.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import sys
from tokenize import generate_tokens, STRING, INDENT, COMMENT, TokenError

import autopep8
import black
import jsbeautifier

from . import StyleCheck, Error
@@ -66,9 +66,9 @@ def count_lines(self, code):
"""
return len(code.splitlines())

# TODO: Determine which options (if any) should be passed to autopep8
# TODO: Determine which options (if any) should be passed to black
def style(self, code):
return autopep8.fix_code(code, options={"max_line_length": 132, "ignore_local_config": True})
return black.format_str(code, mode=black.FileMode())


class Js(C):