ceedee666 / opensap_python_intro

This repository contains several Jupyter notebooks. These notebooks are the course material for an upcoming openSAP course on Python 🐍.
Creative Commons Zero v1.0 Universal
5 stars 1 forks source link

PyLint macht bei Variablen/Konstanten Faxen #95

Closed Hiltiprant closed 2 years ago

Hiltiprant commented 2 years ago

PyLint macht Blödsinn. Variablen, die z. B. nicht durch User Input gesetzt werden, werden offenbar als Konstante erkannt und dementsprechend wird die Benennung angemakelt: Beispiel

Auch, wenn die Variable nach erstmaligem Setzen nochmals geändert wird, wird es weiterhin als Konstante angesehen: Beispiel 2

Tritt/trat erstmals bei Ex_3-BO auf, ist aber ein generelles Problem des Linters (vorher nur nie aufgetreten).

Möglicher Quick(-and-dirty)-Fix: Regel für die Naming-Convention zu Konstanten rausnehmen, da sie im Kurs eh nicht vorkommen?

Hier ist noch erklärt, warum PyLint die als Konstanten ansieht.

ceedee666 commented 2 years ago

@Hiltiprant I don’t think we should disable the whole rule. Instead we can change the reflex for constants to be the same as for variables. This is suggested here: https://stackoverflow.com/questions/41204932/error-message-python-pylint-c0103invalid-constant-name#41217309

this way we still keep some checking of pythons naming conventions.

Christian

Hiltiprant commented 2 years ago

Das hatte ich gestern mit einem Kollegen im Grunde auch schon so überlegt. Das doofe daran ist halt, dass er dann sagt, dass die Konstanten nicht richtig benannt sind. Finde ich eigentlich etwas doof und eventuell verwirrend, wenn einmal an Variablen und einmal an Konstanten gemeckert wird...

Schöner wäre vielleicht, wenn man dieses Feedback invalid-name: Constant name[...] ändern könnte. Da habe ich bisher nichts zu gefunden. Weißt Du, @ceedee666 ob das irgendwie möglich ist? Sonst würde ich die RegEx einfach von den Variablen kopieren.

OT: Sollen wir hier eigentlich auf Englisch kommunizieren oder Deutsch? Mir egal, würde es aber einheitlich halten.

ceedee666 commented 2 years ago

We should use English to communicate here. i would suggest to copy the RegEx for Variables and additionally allow for upper case letters. This should be fine for constants in our context.

ceedee666 commented 2 years ago

@Hiltiprant I updated the const-regex: https://github.com/ceedee666/opensap_python_intro/blob/3c475141b8004e19b146a9495ac3fe5657f7f740/exercises/test_files/default.pylintrc#L167

Could you please check if it works now? If yes we need to replace all the default.pylintrc files in CodeOcean.

Hiltiprant commented 2 years ago

@Hiltiprant I updated the const-regex:

https://github.com/ceedee666/opensap_python_intro/blob/3c475141b8004e19b146a9495ac3fe5657f7f740/exercises/test_files/default.pylintrc#L167

Could you please check if it works now? If yes we need to replace all the default.pylintrc files in CodeOcean.

Both variants that I mentioned in my initial post are now working with the new linting file. I already updated the exercises from week 0 and week 1 on CO. @ghoolio Could you please update the remaining exercises on CO?

ghoolio commented 2 years ago

@ghoolio Could you please update the remaining exercises on CO?

Sure. Just updated the remaining exercises on CO.