[Chore]: Added url-checker, updated circular-deps, documented new static analysis .txt pattern (#7442)
* fix: ignoring url checker files * fix: url checker * fix: auto fmt and cleanup * fix: moving the bash scripts and known files into the scripts repo * fix: removed all url_results and made it be all in memory * fix: fixed the newline issue * fix: url checking as a step to the static analysis * fix: removed old code * chore: writing documentation on our static checker pattern * fix: updating the docs more to be clearer * fix: copy and paste without understanding requirements of ci cd dependencies? do i need all of these? * fix: updating * fix: I thought this got in? * Update CONTRIBUTING.md Co-authored-by: Jace Browning <jacebrowning@gmail.com> --------- Co-authored-by: Jace Browning <jacebrowning@gmail.com>
This commit is contained in:
@ -2,4 +2,4 @@
|
||||
set -euo pipefail
|
||||
|
||||
npm run circular-deps | sed '$d' > /tmp/circular-deps.txt
|
||||
diff --ignore-blank-lines -w /tmp/circular-deps.txt ./known-circular.txt
|
||||
diff --ignore-blank-lines -w /tmp/circular-deps.txt ./scripts/known/circular.txt
|
||||
|
||||
5
scripts/diff-url-checker.sh
Executable file
5
scripts/diff-url-checker.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
npm run url-checker > /tmp/urls.txt
|
||||
diff --ignore-blank-lines -w /tmp/urls.txt ./scripts/known/urls.txt
|
||||
13
scripts/known/circular.txt
Normal file
13
scripts/known/circular.txt
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
> zoo-modeling-app@0.0.0 circular-deps
|
||||
> dpdm --no-warning --no-tree -T --skip-dynamic-imports=circular src/index.tsx
|
||||
|
||||
• Circular Dependencies
|
||||
1) src/lib/singletons.ts -> src/editor/manager.ts -> src/lib/selections.ts
|
||||
2) src/lib/singletons.ts -> src/editor/manager.ts -> src/lib/selections.ts
|
||||
3) src/lib/singletons.ts -> src/lang/codeManager.ts
|
||||
4) src/lang/std/sketch.ts -> src/lang/modifyAst.ts
|
||||
5) src/lang/std/sketch.ts -> src/lang/modifyAst.ts -> src/lang/std/sketchcombos.ts
|
||||
6) src/lib/singletons.ts -> src/clientSideScene/sceneEntities.ts -> src/clientSideScene/segments.ts -> src/components/Toolbar/angleLengthInfo.ts
|
||||
7) src/lib/singletons.ts -> src/clientSideScene/sceneEntities.ts -> src/clientSideScene/segments.ts
|
||||
8) src/hooks/useModelingContext.ts -> src/components/ModelingMachineProvider.tsx -> src/components/Toolbar/setAngleLength.tsx -> src/components/SetAngleLengthModal.tsx -> src/lib/useCalculateKclExpression.ts
|
||||
21
scripts/known/urls.txt
Normal file
21
scripts/known/urls.txt
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
> zoo-modeling-app@0.0.0 url-checker
|
||||
> ./scripts/url-checker.sh
|
||||
|
||||
URL STATUS
|
||||
000 https://${BASE_URL}
|
||||
301 https://discord.gg/JQEpHR7Nt2
|
||||
404 https://github.com/KittyCAD/engine/issues/3528
|
||||
404 https://github.com/KittyCAD/modeling-app/commit/${ref}
|
||||
302 https://github.com/KittyCAD/modeling-app/issues/new/choose
|
||||
302 https://github.com/KittyCAD/modeling-app/issues/new?template=bug_report.yml
|
||||
302 https://github.com/KittyCAD/modeling-app/issues/new?title=${title}&body=${body}
|
||||
404 https://github.com/KittyCAD/modeling-app/releases/tag/v${version}
|
||||
521 https://placekitten.com/200/200
|
||||
302 https://reactrouter.com/en/6.16.0/routers/picking-a-router#using-v64-data-apis
|
||||
302 https://stackoverflow.com/a/57390160/22753272
|
||||
302 https://stackoverflow.com/a/58436959/22753272
|
||||
303 https://text-to-cad.zoo.dev/dashboard
|
||||
307 https://zoo.dev/
|
||||
308 https://zoo.dev/docs/api/ml/generate-a-cad-model-from-text
|
||||
308 https://zoo.dev/docs/kcl
|
||||
56
scripts/url-checker.sh
Executable file
56
scripts/url-checker.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
trap 'echo "$BASH_COMMAND"' ERR
|
||||
|
||||
remove_after_space () {
|
||||
sed 's/ .*//'
|
||||
}
|
||||
|
||||
remove_after_backtick () {
|
||||
sed 's/`.*//'
|
||||
}
|
||||
|
||||
remove_after_end_paren () {
|
||||
sed 's/).*//'
|
||||
}
|
||||
|
||||
remove_after_double_quote () {
|
||||
sed 's/".*//'
|
||||
}
|
||||
|
||||
remove_after_gt () {
|
||||
sed 's/>.*//'
|
||||
}
|
||||
|
||||
remove_after_comma () {
|
||||
sed 's/,.*//'
|
||||
}
|
||||
|
||||
# Search all src/**/*.ts files
|
||||
val1=$(grep -Eoh "(https)://[^']+" src/**/*.ts | remove_after_space | remove_after_backtick | remove_after_end_paren | remove_after_double_quote | remove_after_gt | remove_after_comma)
|
||||
|
||||
# Search all src/**/*.tsx files
|
||||
val2=$(grep -Eoh "(https)://[^']+" src/**/*.tsx | remove_after_space | remove_after_backtick | remove_after_end_paren | remove_after_double_quote | remove_after_gt | remove_after_comma)
|
||||
|
||||
# Required a newline between them when combining since there is not one at the end of val1
|
||||
combined="$val1"$'\n'"$val2"
|
||||
|
||||
# Merge both ts and tsx results and unique them
|
||||
uniqued=$(echo "$combined" | sort | uniq)
|
||||
|
||||
# All urls and status codes
|
||||
all="URL\tSTATUS\n"
|
||||
|
||||
# All non 200 urls and status codes
|
||||
problematic="URL\tSTATUS\n"
|
||||
while read line; do
|
||||
# || true this curl request to bypass any failures and not have the scrip panic.
|
||||
# the set -euo pipefail will cause a panic if a curl fails
|
||||
status=$(curl -o /dev/null -s -w "%{http_code}\n" $line || true)
|
||||
all+="$status\t$line\n"
|
||||
if [[ "$status" -ne 200 ]]; then
|
||||
# list status first over line because of white space formatting, less annoying for diffing
|
||||
problematic+="$status\t$line\n"
|
||||
fi
|
||||
done < <(echo "$uniqued")
|
||||
echo -e $problematic | column -t
|
||||
Reference in New Issue
Block a user