system-tests icon indicating copy to clipboard operation
system-tests copied to clipboard

Basic nix fmt configuration

Open pawelchcki opened this issue 1 year ago • 4 comments

Motivation

Introduces treefmt-nix and related machinery to enable custom, fast and multi language formatting.

In addition this PR leverages automated creation of Nix actions in GHa to run fast formatting scans.

Changes

Improves the nix config and adds treefmt-nix configuration Separate PRs exist which run the improved formatter on existing codebase:

Using latest python-black: https://github.com/DataDog/system-tests/pull/2599

Using shfmt and markdown formatter: https://github.com/DataDog/system-tests/pull/2602

pawelchcki avatar Jun 25 '24 09:06 pawelchcki

Could you add this to the unique entry point for formatting : ./format.sh ?

  • ./format.sh --check must not modify any file, and exit with status 1 if any file must be modified
  • ./format.sh should correct files if possible, and exit with status 1 if some file must be modified, and it can't be done automatically

cbeauchesne avatar Jun 25 '24 12:06 cbeauchesne

Done - I've modified format.sh to use this stuff.

  • backported the whitespace checks *and fixes
  • implemented shellcheck the same way it was done in lint/action.yaml
#cold start which included downloading the dependencies
pawel@pawelthink:~/work/system-tests$ time nix fmt
[INFO ] #alejandra: 3 files processed in 30.67ms
[INFO ] #whitespace: 607 files processed in 74.07ms
[INFO ] #shellcheck: 48 files processed in 874.86ms
[INFO ] #black: 299 files processed in 1.98s
633 files changed in 2s (found 1988, matched 957, cache misses 957)

real	0m16.965s
user	0m29.831s
sys	0m2.962s
pawel@pawelthink:~/work/system-tests$ time nix fmt
warning: Git tree '/home/pawel/work/system-tests' is dirty
0 files changed in 138ms (found 1988, matched 957, cache misses 0)

real	0m1.762s
user	0m1.393s
sys	0m0.371s

pawel@pawelthink:~/work/system-tests$ time nix fmt
warning: Git tree '/home/pawel/work/system-tests' is dirty
0 files changed in 131ms (found 1988, matched 957, cache misses 0)

real	0m0.679s
user	0m0.364s
sys	0m0.217s

pawelchcki avatar Jun 26 '24 11:06 pawelchcki

@codex rebase resolve conflicts and fix this pull request so it passes

pawelchcki avatar Sep 18 '25 13:09 pawelchcki

Summary

  • Corrected the scenario impact helper to add scenario groups through Result.add_scenario_group, avoiding the undefined scenarios_groups variable and ensuring util file changes register their expected group coverage. utils/scripts/compute_impacted_scenario.pyL120-L142

Testing

  • python -m compileall utils/scripts/compute_impacted_scenario.py

View task →