hpc / charliecloud

Now hosted on GitLab.
https://gitlab.com/charliecloud/main
Apache License 2.0
313 stars 61 forks source link

tidy global variables #1865

Open reidpr opened 6 months ago

reidpr commented 6 months ago

Split from #1860. Pylint:

https://github.com/hpc/charliecloud/blob/d67937332094a7d8de8e9bd2e112d30d117c50c0/lib/build_cache.py#L140-L144

Python does not have constants, and the convention Pylint wants is that module globals are treated as constants and use UPPER_CASE naming style. I believe what we’re doing is:

  1. Module globals set during import are treated as constants and use UPPER_CASE.

  2. Module globals set once, then treated as constant; we use snake_case for these.

  3. True global variables, snake_case.

Groups 1 and 2 should be set once only and constant after that. I don't know how many 3 we have.

Pylint also just doesn’t want us to use global at all which honestly makes sense.