Skip to content

Commit

Permalink
Log TODOs and LaunchDarkly flags (#12011)
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbay-bluetiger authored Jan 22, 2025
1 parent 2805d50 commit c231462
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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 @@ -43,3 +43,15 @@ repos:
entry: .github/branch-name-validation.sh
language: script
pass_filenames: false
- id: track-flags
name: track-flags
entry: yarn track-flags
language: system
files: '\.tsx?$'
pass_filenames: false
- id: track-todos
name: track-todos
entry: yarn track-todos
language: system
exclude: 'logs/.*'
pass_filenames: false
24 changes: 24 additions & 0 deletions logs/launchdarkly-flags.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.

# LaunchDarkly flags in components
./services/ui-src/src/components/app/AppRoutes.tsx:30:useFlags()?.naaarReport;
./services/ui-src/src/components/cards/TemplateCard.tsx:33:useFlags()?.naaarReport;
./services/ui-src/src/components/forms/AdminDashSelector.tsx:40:useFlags()?.naaarReport;
./services/ui-src/src/components/modals/AddEditReportModal.tsx:43:useFlags()?.naaarReport;
./services/ui-src/src/components/pages/Dashboard/DashboardPage.tsx:213:useFlags()?.sortableDashboardTable;

# LaunchDarkly flags in tests
./services/ui-src/src/components/app/AppRoutes.test.tsx:138:mockLDFlags.set({ naaarReport: true });
./services/ui-src/src/components/app/AppRoutes.test.tsx:150:mockLDFlags.set({ naaarReport: false });
./services/ui-src/src/components/app/AppRoutes.test.tsx:25:mockLDFlags.setDefault({ naaarReport: false });
./services/ui-src/src/components/cards/TemplateCard.test.tsx:140:mockLDFlags.set({ naaarReport: true });
./services/ui-src/src/components/cards/TemplateCard.test.tsx:150:mockLDFlags.set({ naaarReport: false });
./services/ui-src/src/components/cards/TemplateCard.test.tsx:60:mockLDFlags.setDefault({ naaarReport: true });
./services/ui-src/src/components/forms/AdminDashSelector.test.tsx:32:mockLDFlags.setDefault({ naaarReport: true });
./services/ui-src/src/components/forms/AdminDashSelector.test.tsx:62:mockLDFlags.set({ naaarReport: true });
./services/ui-src/src/components/forms/AdminDashSelector.test.tsx:72:mockLDFlags.set({ naaarReport: false });
./services/ui-src/src/components/pages/Dashboard/SortableDashboardTable.test.tsx:143:mockLDFlags.set({ sortableDashboardTable: true });
./services/ui-src/src/components/pages/Dashboard/SortableDashboardTable.test.tsx:279:mockLDFlags.set({ sortableDashboardTable: true });
./services/ui-src/src/components/pages/Dashboard/SortableDashboardTable.test.tsx:297:mockLDFlags.set({ sortableDashboardTable: true });
./services/ui-src/src/components/pages/Dashboard/SortableDashboardTable.test.tsx:312:mockLDFlags.set({ sortableDashboardTable: true });
./services/ui-src/src/components/pages/Dashboard/SortableDashboardTable.test.tsx:328:mockLDFlags.set({ sortableDashboardTable: true });
10 changes: 10 additions & 0 deletions logs/todos.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.

./services/app-api/handlers/reports/fetch.ts:69: TODO: strict typing
./services/app-api/handlers/reports/fetch.ts:80: TODO: strict typing
./services/ui-src/src/components/layout/Timeout.tsx:33: TODO: When autosave is implemented, set up a callback function to listen to calls to update in authLifecycle
./services/ui-src/src/components/reports/ModalOverlayReportPage.test.tsx:148:todo Write a test to make sure admins can't click/change details?
./services/ui-src/src/components/tables/EntityRow.tsx:26: TODO: refactor to handle NAAAR analysis methods
./services/ui-src/src/components/tables/SortableTable.tsx:196: TODO: add additional styling for two-column dynamic field tables if needed
./services/ui-src/src/components/tables/Table.tsx:135: TODO: add additional styling for two-column dynamic field tables if needed
./services/ui-src/src/utils/autosave/autosave.ts:193: TODO: modify DynamicField hydrationValue lifecycle so we can implement a stricter check,
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"test": "cd tests && npm test && cd -",
"test:ci": "cd tests && yarn run test:ci",
"test:e2e": "cd tests && yarn run test:e2e",
"test:e2e-ui": "cd tests && yarn run test:e2e-ui"
"test:e2e-ui": "cd tests && yarn run test:e2e-ui",
"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=*.tsx --exclude=*.test.tsx || 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.tsx || 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 c231462

Please sign in to comment.