cloudnative-pg / cloudnative-pg/ciclops

Rewrite the code using objects and methods

Open
#38 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16
Forks
0
Avg merge
11d 4h
Merged PRs (30d)
1

Description

The Ciclops code is conceptually simple, but syntactically muddled.
There is a `for` loop over all the JSON files produced by running a test suite.
Each of these files is bucketed by different criteria. E.g. by kubernetes version, or by test name.

Because it was not written in an object-based way, the code requires to pass and modify data structures by reference.
Those structures need to be initialized outside the code that uses them, like so.

``` python
by_test = {}
...
for file in dir_listing:
...
with open(path, encoding="utf-8") as json_file:
...
# bucketing by test name
count_bucketed_by_test(test_results, by_test)
```

By rewriting the code in an object-based way, the data structures can be created and added to by methods, with more compact code. This will also improve the testability of the code.

Contributor guide

Open the contributing guide

Research direction

No file or test path is named; start by locating the loop over the JSON files and the count_bucketed_by_test entry point. Trace how each bucketing structure is initialized and modified, then refactor that flow around objects and methods while preserving the existing bucketing behavior and improving testability.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.