atom-community / atom-community/ide-python

Can't suppress Mccabe.

Open
#164 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
238
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Hi everyone,

below I have build an example for a McCabe-violation from the anti-pattern on Flake8's website.

`def post_comment(self): # noqa
if self.success: # noqa
comment = 'Build succeeded'
elif self.warning:
comment = 'Build had issues'
elif self.failed:
comment = 'Build failed'

if self.success:
self.post(comment, type='success')
else:
self.post(comment, type='error')
if self.success:
comment = 'Build succeeded'
elif self.warning:
comment = 'Build had issues'
elif self.failed:
comment = 'Build failed'

if self.success:
self.post(comment, type='success')
else:
self.post(comment, type='error')
if self.success:
comment = 'Build succeeded'
elif self.warning:
comment = 'Build had issues'
elif self.failed:
comment = 'Build failed'

if self.success:
self.post(comment, type='success')
else:
self.post(comment, type='error')
if self.success:
comment = 'Build succeeded'
elif self.warning:
comment = 'Build had issues'
elif self.failed:
comment = 'Build failed'

if self.success:
self.post(comment, type='success')
else:
self.post(comment, type='error')
`

Predictably, this results in a warning. However, adding `noqa` does not manage to suppress these.

![ide-py-linter-fail](https://user-images.githubusercontent.com/17391760/54986477-000b6d80-4fb3-11e9-8646-19548bbf5020.png)

Kind regards.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the posted Python McCabe-violation example in Atom and checking how the Python linting output handles noqa comments. Done means the McCabe warning is suppressed when the example uses the shown noqa annotations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.