Rewrite the code using objects and methods

Aperta
#38 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
ci-cd

Direzione di ricerca

Non viene indicato alcun percorso di file o di test; inizia individuando il ciclo sui file JSON e l’entry point count_bucketed_by_test. Traccia come ogni struttura di bucketing viene inizializzata e modificata, quindi rifattorizza quel flusso organizzandolo attorno a oggetti e metodi, preservando il comportamento di bucketing esistente e migliorando la testabilità.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

    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.

Lingua principale
Python
Stelle
16
Fork
0
Merge medio
6h 59m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudnative-pg/ciclops

Tutte le issue di cloudnative-pg/ciclops

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.