atom-community / atom-community/ide-python

Can't suppress Mccabe.

Aperta
#164 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
238
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo in Atom l’esempio pubblicato di violazione McCabe in Python e verificando come l’output del linting Python gestisce i commenti noqa. Il lavoro è completato quando l’avviso McCabe viene soppresso quando l’esempio usa le annotazioni noqa mostrate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.