diff options
author | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-02-19 11:52:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-19 11:52:07 +0100 |
commit | e7cbe87fd35963666f8007b36a5168ffd84f6107 (patch) | |
tree | 8c87c0b275b0eb8555543f985599c1547c5502bc | |
parent | 62ef1580fdb5346283c70953338b91fdddce2936 (diff) | |
parent | 5e04d306d6d543d7b040f9ccd313be176f5b211b (diff) | |
download | openshift-e7cbe87fd35963666f8007b36a5168ffd84f6107.tar.gz openshift-e7cbe87fd35963666f8007b36a5168ffd84f6107.tar.bz2 openshift-e7cbe87fd35963666f8007b36a5168ffd84f6107.tar.xz openshift-e7cbe87fd35963666f8007b36a5168ffd84f6107.zip |
Merge pull request #3412 from rhcarvalho/dead-code
Remove and document how to find dead Python code
3 files changed, 14 insertions, 34 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dafa73bad..502ef6aa5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -152,3 +152,17 @@ are run on a different Jenkins host that is not publicly accessible, however the test results are posted to S3 buckets when complete. The test output of each job is also posted to the Pull Request as comments. + +--- + +## Appendix + +### Finding unused Python code + +If you are contributing with Python code, you can use the tool +[`vulture`](https://pypi.python.org/pypi/vulture) to verify that you are not +introducing unused code by accident. + +This tool is not used in an automated form in CI nor otherwise because it may +produce both false positives and false negatives. Still, it can be helpful to +detect dead code that escapes our eyes. diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py index 68b6deb88..bcfaa55c8 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py @@ -175,23 +175,6 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): else: assert_equal(results, default_predicates) - def check_defaults_override_vars(self, release, deployment_type, - default_predicates, regions_enabled, - extra_facts=None): - facts = copy.deepcopy(self.default_facts) - facts['openshift']['common']['short_version'] = release - facts['openshift']['common']['deployment_type'] = deployment_type - if extra_facts is not None: - for fact in extra_facts: - facts[fact] = extra_facts[fact] - results = self.lookup.run(None, variables=facts, - regions_enabled=regions_enabled, - return_set_vars=False) - if regions_enabled: - assert_equal(results, default_predicates + [REGION_PREDICATE]) - else: - assert_equal(results, default_predicates) - def test_openshift_version(self): for regions_enabled in (True, False): for release, deployment_type, default_predicates in TEST_VARS: diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py index 4e44a2b3d..7ddc5dcb2 100644 --- a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py +++ b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py @@ -160,23 +160,6 @@ class TestOpenShiftMasterFactsDefaultPredicates(object): else: assert_equal(results, default_priorities) - def check_defaults_override_vars(self, release, deployment_type, - default_priorities, zones_enabled, - extra_facts=None): - facts = copy.deepcopy(self.default_facts) - facts['openshift']['common']['short_version'] = release - facts['openshift']['common']['deployment_type'] = deployment_type - if extra_facts is not None: - for fact in extra_facts: - facts[fact] = extra_facts[fact] - results = self.lookup.run(None, variables=facts, - zones_enabled=zones_enabled, - return_set_vars=False) - if zones_enabled: - assert_equal(results, default_priorities + [ZONE_PRIORITY]) - else: - assert_equal(results, default_priorities) - def test_openshift_version(self): for zones_enabled in (True, False): for release, deployment_type, default_priorities in TEST_VARS: |