Project

Profile

Help

Issue #2364

closed

Inconsistent usage of strings and constants

Added by mihai.ibanescu@gmail.com over 7 years ago. Updated about 5 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
2.10.1
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

While reading the comments around 2190, I came across the force_full option.

I did a grep in the 2.10 branch.

I found that there is indeed a FORCE_FULL_KEYWORD = 'force_full' defined in common/pulp_rpm/common/constants.py

However, it is used exactly once outside of that file, and that is in plugins/pulp_rpm/plugins/distributors/yum/publish.py

The 'force_full' string itself is used directly in plugins/pulp_rpm/plugins/importers/yum/sync.py and in plugins/pulp_rpm/plugins/distributors/yum/configuration.py

While not a big deal, I am trying to use pulp_rpm as an example of how to write a pulp plugin, and also to update my pulp 2.7 plugins to pulp 2.10, which pulp_rpm has already done. The trials and tribulations around the relatively unstable plugin API are somewhat understandable. Inconsistency, I would hope not.

This is recent too: https://github.com/pulp/pulp_rpm/commit/df42dea8e46a1a9649727990082f5b13fbb7c6f9

If my expectation that, by defining a constant in the code, one should use it flawed, can you please provide guidance on when to use a constant vs. a string?

Also available in: Atom PDF