H201: Mark 'except' not ':'

Bug #1648585 reported by LandonAbney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hacking
New
Undecided
Unassigned

Bug Description

When a `H201 no 'except:' at least use 'except Exception:'` message is currently being reported the column number corresponds to the `:` mark at the end, would it make sense to have this changed to the start of the `except` itself?

For example in this code:
```
try:
    print('H501 %(self)s' % locals())
except: # <- H201
    pass
```

We are given the result of:
```
hacking.py:2:33: H501 Do not use locals() for string formatting
hacking.py:3:7: H201 no 'except:' at least use 'except Exception:'
```

Tested with the following:
`2.5.5 (pep8: 1.5.7, mccabe: 0.2.1, hacking.core: 0.0.1, ProxyChecker: 0.0.1, pyflakes: 0.8.1) CPython 3.5.2 on Windows`

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.