Skip to content

Commit

Permalink
Log TODOs and LaunchDarkly flags (#139889)
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbay-bluetiger authored Jan 22, 2025
1 parent 7a1825a commit ae379d2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services/uploads/local_buckets
/.env
tests_output
*.log
!launchdarkly-flags.log
!todos.log
tests/cypress/videos
tests/cypress/screenshots
tests/cypress/downloads
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ repos:
entry: .github/branchNameValidation.sh
language: script
pass_filenames: false
- id: track-flags
name: track-flags
entry: yarn track-flags
language: system
files: '\.jsx?$'
pass_filenames: false
- id: track-todos
name: track-todos
entry: yarn track-todos
language: system
exclude: 'logs/.*'
pass_filenames: false
10 changes: 10 additions & 0 deletions logs/launchdarkly-flags.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.

# LaunchDarkly flags in components
./services/ui-src/src/components/layout/FormTemplates.jsx:28:useFlags().release2024;
./services/ui-src/src/components/sections/homepage/TemplateDownload.jsx:14:useFlags().release2024 ? "2024" : "2023";
./services/ui-src/src/components/sections/homepage/TemplateDownload.jsx:20:useFlags().release2024 && (
./services/ui-src/src/components/sections/homepage/TemplateDownload.jsx:44:useFlags().release2024 ? "Oct 2024" : "Sept 2023"}

# LaunchDarkly flags in tests
# N/A
12 changes: 12 additions & 0 deletions logs/todos.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.

./README.md:142:TODO: writeup the CI/CD flow for the application
./README.md:204:TODO: Get an updated diagram
./services/ui-auth/handlers/createUsers.js:1: TODO logging solution for backend services
./services/ui-src/serverless.yml:62: TODO: [MDCT-300] handle react hooks warnings then remove CI=false
./services/ui-src/src/components/fields/NoninteractiveTable.jsx:49: TODO Remove this custom logic when rewriting backend
./services/ui-src/src/components/layout/UploadComponent.jsx:132: TODO: when one file errors, the others are loaded but the error stays
./services/ui-src/src/components/layout/UploadComponent.test.jsx:11: TODO remove direct dependency on @testing-library/dom ?
./services/ui-src/src/store/formData.js:242: TODO: account for objectives/repeatables here.
./services/ui-src/src/store/lastYearFormData.js:146: TODO: account for objectives/repeatables here.
./services/ui-src/src/util/synthesize.test.js:1: TODO: Fix this testing suite, it is outdated
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
},
"scripts": {
"test": "cd tests/cypress && npm test && cd -",
"test:ci": "cd tests/cypress && yarn run test:ci"
"test:ci": "cd tests/cypress && yarn run test:ci",
"track-flags": "./scripts/track-flags.sh",
"track-todos": "./scripts/track-todos.sh"
},
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions scripts/track-flags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
LD_LOG_FILE=logs/launchdarkly-flags.log
GREP_FLAGS="-r -n -o -w"
EXCLUSIONS="--exclude-dir=.build --exclude-dir=coverage --exclude-dir=node_modules --exclude-dir=uploads"

echo "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n" > $LD_LOG_FILE

echo "# LaunchDarkly flags in components" >> $LD_LOG_FILE
(grep $GREP_FLAGS $EXCLUSIONS "useFlags().*" ./services --include=*.jsx --exclude=*.test.jsx || echo "# N/A") | sort >> $LD_LOG_FILE

echo "" >> $LD_LOG_FILE

echo "# LaunchDarkly flags in tests" >> $LD_LOG_FILE
(grep $GREP_FLAGS $EXCLUSIONS "mockLDFlags.set.*" ./services --include=*.test.jsx || echo "# N/A") | sort >> $LD_LOG_FILE
7 changes: 7 additions & 0 deletions scripts/track-todos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
LD_LOG_FILE=logs/todos.log
GREP_FLAGS="-r -i -n -o -w -E -I"
EXCLUSIONS="--exclude-dir=.build --exclude-dir=.git --exclude-dir=coverage --exclude-dir=node_modules --exclude-dir=uploads --exclude=track-todos.sh --exclude=*.log"

echo "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n" > $LD_LOG_FILE

(grep $GREP_FLAGS $EXCLUSIONS "TODO:.*|TODO .*| TODO.*" . || echo "# All clear!") | sort >> $LD_LOG_FILE

0 comments on commit ae379d2

Please sign in to comment.