From 46aff2715b257b48b62bfaba952a342d8de1a21a Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 27 Oct 2023 08:57:08 +0200 Subject: [PATCH] feat(tool,ci): Add script for detecting dart:io usage Signed-off-by: jld3103 --- .github/workflows/neon.yml | 10 ++++++++++ tool/find-dart-io-usage.sh | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100755 tool/find-dart-io-usage.sh diff --git a/.github/workflows/neon.yml b/.github/workflows/neon.yml index cd5afb3d..e4f213eb 100644 --- a/.github/workflows/neon.yml +++ b/.github/workflows/neon.yml @@ -19,3 +19,13 @@ jobs: - name: Find untested Neon APIs run: ./tool/find-untested-neon-apis.sh + + dart-io-usage: + name: dart:io usage + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + - name: Find dart:io usage + run: ./tool/find-dart-io-usage.sh diff --git a/tool/find-dart-io-usage.sh b/tool/find-dart-io-usage.sh new file mode 100755 index 00000000..009d5cca --- /dev/null +++ b/tool/find-dart-io-usage.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -euxo pipefail +cd "$(dirname "$0")/.." + +dart_io_usage=("$(grep -r packages --include "*\.dart" -e "dart:io" -l | grep -v "/\.dart_tool/" | grep -v "/bin/" | grep -v "/test_driver/" || true)") + +if [[ -n "${dart_io_usage[*]}" ]]; then + printf "%s\n" "${dart_io_usage[@]}" + exit 1 +fi