manjaro / manjaro/mdd

Refactor json_beau() with flexible indentation

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
16
Forks
2
PR merge metrics
No merged PRs in 30d

Description

A hardcoded 4 space can look awkward - so adding an indentation property defaulting to 4 makes it possible to use another value in the call.

diff --git a/mdd.py b/mdd.py
index cb9f3c1..cfb1de8 100644
--- a/mdd.py
+++ b/mdd.py
@@ -24,8 +24,8 @@ from dateutil import parser as date_parser
 inxi = None
 
 
-def json_beaut(input, sort_keys=False):
-    return json.dumps(input, indent=4, sort_keys=sort_keys)
+def json_beaut(input, sort_keys=False, indent=4):
+    return json.dumps(input, indent=indent, sort_keys=sort_keys)
 
 
 def prepare_inxi():

refactor-to-flexible-json-indent.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open mdd.py and inspect json_beaut(), which currently passes a fixed indentation value to json.dumps(). Confirm the default output remains four spaces while calls can provide another indentation value, then check the function's callers for compatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.