Skip to content

Add support for multiple error codes#44

Open
patrick91 wants to merge 3 commits intowhtsky:masterfrom
patrick91:feature/multiple-errors
Open

Add support for multiple error codes#44
patrick91 wants to merge 3 commits intowhtsky:masterfrom
patrick91:feature/multiple-errors

Conversation

@patrick91
Copy link
Copy Markdown
Contributor

Another one 😊

This PR improves the code that adds type ignores by adding support for multiple error codes, for example this line:

a: str = len(1)

returns the following errors:

mypy-silent ❯ poetry run mypy hello.py
hello.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
hello.py:1: error: Argument 1 to "len" has incompatible type "int"; expected "Sized"
Found 2 errors in 1 file (checked 1 source file)

With this PR the result of mypy silent becomes this:

a: str = len(1)   # type: ignore[assignment, arg-type]

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2022

Codecov Report

Merging #44 (ad89e56) into master (cdec344) will increase coverage by 7.61%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   47.94%   55.55%   +7.61%     
==========================================
  Files           4        4              
  Lines          73       81       +8     
==========================================
+ Hits           35       45      +10     
+ Misses         38       36       -2     
Impacted Files Coverage Δ
mypy_silent/cli.py 0.00% <ø> (ø)
mypy_silent/maho.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdec344...ad89e56. Read the comment docs.

@patrick91 patrick91 force-pushed the feature/multiple-errors branch from c2c9f65 to ad89e56 Compare April 7, 2022 23:46
@chadrik
Copy link
Copy Markdown

chadrik commented Oct 13, 2025

Any chance we can get this merged, or do we need to fork this project?

@patrick91
Copy link
Copy Markdown
Contributor Author

@chadrik it could be cool to make one that works for mypy, ty, pyright and so on 👀

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.

2 participants