Skip to content

Pgm/feature/custom json formatter - #1501

Open
mgovers wants to merge 1 commit into
pgm/feature/dependabot-on-specific-dayfrom
pgm/feature/custom-json-formatter
Open

Pgm/feature/custom json formatter#1501
mgovers wants to merge 1 commit into
pgm/feature/dependabot-on-specific-dayfrom
pgm/feature/custom-json-formatter

Conversation

@mgovers

@mgovers mgovers commented Jul 28, 2026

Copy link
Copy Markdown
Member

In light of recent events, we are aiming to reduce our amount of dependencies - in particular the npm ones. Unfortunately, that means we need to revert some of the changes in #1256 in favor of small custom scripts.

Relates to #1499

@mgovers mgovers self-assigned this Jul 28, 2026
@mgovers mgovers added dependencies Pull requests that update a dependency file improvement Improvement on internal implementation do-not-merge This should not be merged github_actions Pull requests that update GitHub Actions code labels Jul 28, 2026
Comment thread scripts/format_json.py
Comment on lines +20 to +30
REPO_PATH = Path(__file__).parent.parent.resolve()
EXCLUDE = [
re.compile(rf"{REPO_PATH}/docs/.*"),
re.compile(rf"{REPO_PATH}/package-lock\.json"),
re.compile(rf"{REPO_PATH}/\.vscode/.*"),
re.compile(rf"{REPO_PATH}/\.devcontainer/.*"),
re.compile(rf"{REPO_PATH}/tests/data/.*/input\.json"),
re.compile(rf"{REPO_PATH}/tests/data/.*/.*_output.*\.json"),
re.compile(rf"{REPO_PATH}/tests/data/.*/update_batch\.json"),
re.compile(rf"{REPO_PATH}/tests/unit/deprecated/data/."),
]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need this, or there will be some ugly error-prone repeated code between the code quality workflow and this repo

Comment thread .pre-commit-config.yaml
Comment thread .pre-commit-config.yaml.jinja
Comment thread package-lock.json
Comment thread package-lock.json.license
Comment thread package.json
Comment thread package.json.license
@kornerc

kornerc commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@mgovers I like to idea to get rid of npm.

One alternative came into my mind to a custom JSON formatter: Biome has standalone binaries (it’s written in Rust).
However, I think it’s unfortunately rather difficult to integrate this nicely into pre-commit and to manage the versions properly.

Unfortunately, this PR to publish Biome as Python package is currently not progressing biomejs/biome#8818

In summary I guess a custom JSON formatter - like your drafted one - might be the best solution (until there is a Python package for Biome).

@mgovers

mgovers commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

@mgovers I like to idea to get rid of npm.

One alternative came into my mind to a custom JSON formatter: Biome has standalone binaries (it’s written in Rust). However, I think it’s unfortunately rather difficult to integrate this nicely into pre-commit and to manage the versions properly.

Unfortunately, this PR to publish Biome as Python package is currently not progressing biomejs/biome#8818

In summary I guess a custom JSON formatter - like your drafted one - might be the best solution (until there is a Python package for Biome).

Hi @kornerc,

Thank you for the input. We really appreciate it, especially after the great in-depth investigation you have done so far. 🤞 fingers crossed that that PR for biome will be published soon...

@mgovers
mgovers force-pushed the pgm/feature/custom-json-formatter branch from ea9de81 to 881e110 Compare July 28, 2026 14:05
Comment thread scripts/format_json.py Outdated
Comment thread scripts/format_json.py Outdated
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

actually format json

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

update script to exclude some

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

cleanup

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

minor

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

exclude uv.lock, en/decode with utf-8-sig

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

fix ruff

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

re-add markdownlint-cli

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

Refresh lock and linter dependencies

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Apply suggestions from code review

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

Co-authored-by: Martijn Govers <martygovers@hotmail.com>
Signed-off-by: Martijn Govers <martygovers@hotmail.com>

minor

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers
mgovers force-pushed the pgm/feature/custom-json-formatter branch from 680e9f0 to 2489dd7 Compare July 28, 2026 14:12
@mgovers
mgovers marked this pull request as ready for review July 28, 2026 14:22
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file do-not-merge This should not be merged github_actions Pull requests that update GitHub Actions code improvement Improvement on internal implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants