[INTT-39] feat: dart workflow#18
Conversation
… move actions to running inside nix, this right now just generates the github workflow
tlater-famedly
left a comment
There was a problem hiding this comment.
Don't think we should merge this as-is, let's wait for the generic prek hook at least and discuss the details I commented about.
| perSystem = | ||
| { config, ... }: | ||
| let | ||
| run-pre-commit = project: '' |
There was a problem hiding this comment.
We should do the pre-commit as a different, generic workflow, and not inside the dart-specific workflow.
| }; | ||
|
|
||
| defaults.run.shell = "nu --no-config-file --no-history {0}"; | ||
| env.DART_TERM_COLOR = "always"; |
There was a problem hiding this comment.
Is this actually a thing (and necessary) or just halluci-copied from the rust workflow?
| { config, ... }: | ||
| let | ||
| run-pre-commit = project: '' | ||
| nix develop .#general --command sh -c ${lib.escapeShellArg "cd ${lib.escapeShellArg project} && prek run --all-files"} |
There was a problem hiding this comment.
Prek doesn't need project stuff, that's the entire point of using these workspaces, that should be removed. We shouldn't use a function for this at all.
| dart = lib.getExe pkgs.dart; | ||
| grep = lib.getExe pkgs.gnugrep; | ||
|
|
||
| check-conventional-commits = pkgs.writeShellScript "check-conventional-commits" '' |
There was a problem hiding this comment.
This should be a general lint, not part of the dart pre-commit hooks.
Let's use a project like https://keisukeyamashita.github.io/commitlint-rs/ instead of a hand-rolled regex, too, or if we must write a shell script, use nushell.
| dart-analyze = pkgs.writeShellScript "dart-analyze" '' | ||
| set -eu | ||
|
|
||
| if [ -f pubspec.yaml ] && ${grep} -Eq '^flutter:' pubspec.yaml; then |
There was a problem hiding this comment.
Do we actually need the complexity of testing for flutter vs dart projects? If we do, can we make this two separate lints instead, perhaps with an option defining which one should be used instead of doing this at runtime?
| ${dart} format lib/ --set-exit-if-changed | ||
| "$command" pub get | ||
| "$command" analyze | ||
|
|
||
| if command -v dart_code_metrics >/dev/null 2>&1; then | ||
| dart_code_metrics analyze lib || true | ||
| fi |
There was a problem hiding this comment.
These should probably be separate hooks, not a single one.
We should not do a check for the existence of software, and instead provide it via devshell/nix store paths.
No description provided.