Skip to content

Ensure syntax error messages are capitalized #19107

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

Closed
JukkaL opened this issue May 18, 2025 · 5 comments
Closed

Ensure syntax error messages are capitalized #19107

JukkaL opened this issue May 18, 2025 · 5 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented May 18, 2025

Feature

When there is a syntax error, the error message has often a lower-case initial letter:

$ mypy -c 'x y'
<string>:1: error: invalid syntax  [syntax]
Found 1 error in 1 file (errors prevented further checking)

Capitalize these error messages for consistency.

Pitch

Almost all other error messages are capitalized, so the current situation is inconsistent.

@makridenko
Copy link
Contributor

Hi, can I work on this?

@wyattscarpenter
Copy link
Contributor

@makridenko There is no process in the mypy repo for requiring permission to work on an issue. Therefore: you can!

@wyattscarpenter
Copy link
Contributor

For additional context to the OP, here is an error that is (I intuit) capitalized correctly:

$mypy -c "'2'+2"
<string>:1: error: Unsupported operand types for + ("str" and "int")  [operator]
Found 1 error in 1 file (checked 1 source file)

As you can see, the word after "error:" starts with a capital letter.

@charulatalodha
Copy link
Contributor

HI,
I am working on this issue as part of Pycon Sprints 2025

JukkaL pushed a commit that referenced this issue May 20, 2025
Fixes ##19107

Cause of Issue:
```ast3``` parser raises exception with error message which sometimes non-standardized.

eg :
```
error: expected an indented block after function definition on line 1
[syntax]
```

Resolution:
- standardize the exception error message before report generation for syntax exceptions specifically
 
Contributors:
- Me and [@aman
](https://github.com/amansomething)

---------

Co-authored-by: Charulata Lodha <[email protected]>
Co-authored-by: amansomething <[email protected]>
@sterliakov
Copy link
Collaborator

Fixed in #19114 (not auto-closed due to a typo in the magic).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants