mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
Add sgrep (sgrep.dev) to tooling and include simple rule as proof of concept. Included rule detects use of old django render function. Also added a rule that looks for if-else statements where both code paths are identical.
20 lines
666 B
Bash
Executable File
20 lines
666 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
version=0.4.9b5
|
|
tarball=sgrep-$version-ubuntu-16.04.tgz
|
|
sha256=9e57323fd0eb9133b7ff301a6be8361c073c3bfe6e6959ca1b622e5abc176e03
|
|
tarball_url=https://github.com/returntocorp/sgrep/releases/download/v$version/$tarball
|
|
|
|
if ! out="$(sgrep-lint --version 2>/dev/null)" || [[ "$out" != "$version" ]]
|
|
then
|
|
tmpdir="$(mktemp -d)"
|
|
trap 'rm -r "$tmpdir"' EXIT
|
|
cd "$tmpdir"
|
|
wget -nv "$tarball_url"
|
|
sha256sum -c <<< "$sha256 $tarball"
|
|
tar -xzf "$tarball" -C /usr/local/lib/
|
|
ln -sf /usr/local/lib/sgrep-lint-files/sgrep-lint /usr/local/bin/sgrep-lint
|
|
ln -sf /usr/local/lib/sgrep-lint-files/sgrep /usr/local/bin/sgrep
|
|
fi
|