atom-community / atom-community/ide-python

Can't suppress Mccabe.

Offen
#164 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
238
Forks
40
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, das veröffentlichte Python-McCabe-Verstoßbeispiel in Atom zu reproduzieren und zu prüfen, wie die Python-Linting-Ausgabe mit noqa-Kommentaren umgeht. Erledigt ist dies, wenn die McCabe-Warnung unterdrückt wird, sobald das Beispiel die gezeigten noqa-Annotationen verwendet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.