Skip to content

Conversation

@aseembits93
Copy link
Contributor

Not throwing an exception, letting the program proceed even though the formatter was not found, putting it on the user to install it later. Or we can ask to install it for them.

click.echo(f"✅ Formatter exists on system")
click.echo()
except FileNotFoundError as e:
click.echo(f"⚠️ Formatter not found: {formatter}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a helpful message to help the user resolve the problem. Suggest installing it or ensuring it is present

click.echo(f"⚠️ Formatter not found: {formatter}")
click.echo()
# Not throwing an exception, letting the program proceed even though the formatter was not found, putting it on the user to install it later
# raise e from None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

if formatter in ["black", "ruff"]:
try:
result = subprocess.run([formatter], capture_output=True, check=False)
click.echo(f"✅ Formatter exists on system")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might not need to print this, we want to reduce the cognitive load for something thats not needed

try:
result = subprocess.run([formatter], capture_output=True, check=False)
click.echo(f"✅ Formatter exists on system")
click.echo()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this blank line do? is this necessary?

formatter_cmds.append("disabled")
if formatter in ["black", "ruff"]:
try:
result = subprocess.run([formatter], capture_output=True, check=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shouldnt we use shutil.which to check if its in file path rather than running the process?
And we might have to test this in other OS for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to test for existence the same way it is run later for formatting. To reduce any inconsistencies

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        choices=["black", "ruff", "other", "don't use a formatter"],

in here
we allow for other as a choice, won't this break that behavior?

@misrasaurabh1 misrasaurabh1 merged commit 474d385 into main Feb 20, 2025
14 checks passed
@aseembits93 aseembits93 deleted the cf-495-2 branch April 23, 2025 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants