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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.