Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(null): Add CI task to check for new files to add to tsconfig.strictNullChecks.json #5918

Merged
merged 7 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### Pull request checklist
<!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox -->
- [ ] Addresses an existing issue: #0000
- [ ] Ran `yarn null:autoadd`
- [ ] Ran `yarn fastpass`
- [ ] Added/updated relevant unit test(s) (and ran `yarn test`)
- [ ] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage`
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ jobs:
- run: yarn null:check
timeout-minutes: 5

- name: verify null:autoadd finds no changes
run: yarn null:autoadd && node .github/workflows/verify-unchanged-strict-null-checks.js
timeout-minutes: 6

codeql:
runs-on: ubuntu-20.04
steps:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/verify-unchanged-strict-null-checks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// // Copyright (c) Microsoft Corporation. All rights reserved.
// // Licensed under the MIT License.
//
// USAGE:
//
// node verify-unchanged-strict-null-checks.js
//
// Verifies that "git status" does not report any pending changes to tsconfig.strictNullChecks.json
//
// This serves as a reminder for humans to update strict null checks when they add files.

const path = require('path');
const process = require('process');
const child_process = require('child_process');

const lockfilePath = path.join(__dirname, '..', '..', 'tsconfig.strictNullChecks.json');

const gitStatusResult = child_process.execFileSync('git', ['status', '--porcelain=1', '--', lockfilePath]);
const isLockfileChanged = gitStatusResult.toString() !== '';

if (isLockfileChanged) {
const gitDiffResult = child_process.execFileSync('git', ['diff', '--', lockfilePath]);
console.error(`
Error: Running "yarn null:autoadd" identified new files to be included in null checks.

To ensure these files are included:
1) Pull this branch
2) Run "yarn null:autoadd"
3) Commit and push the resulting change to tsconfig.strictNullChecks.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this logic- the comment at the top of the file says that we're verifying that there are NO changes to tsconfig.strictNullChecks.json, but this error message suggests that we DO want to update that file. What is the actual expected outcome?

Copy link
Contributor Author

@madalynrose madalynrose Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected outcome is that CI will pass if this finds no changes and will fail if it does, prompting the author to run it and add those changes manually. This workflow is based on the behavior we use in accessibility-insights-for-android-service to ensure that gradle.lock is kept up-to-date

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, makes sense to me!


Diff of the necessary change:

${gitDiffResult.toString()}
`);
process.exit(1);
} else {
console.log('Success! git status reports no outstanding tsconfig.strictNullChecks.json changes.');
process.exit(0);
}


44 changes: 26 additions & 18 deletions tsconfig.strictNullChecks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"./src/DetailsView/components/auto-detected-failures-dialog.tsx",
"./src/DetailsView/components/base-left-nav.tsx",
"./src/DetailsView/components/change-assessment-dialog.tsx",
"./src/DetailsView/components/choice-group-pass-fail.tsx",
"./src/DetailsView/components/details-view-overlay/scoping-panel/scoping-container.tsx",
"./src/DetailsView/components/details-view-overlay/scoping-panel/scoping-panel.tsx",
"./src/DetailsView/components/failure-instance-panel-details.tsx",
Expand Down Expand Up @@ -57,6 +58,7 @@
"./src/DetailsView/components/target-page-hidden-bar.tsx",
"./src/DetailsView/components/test-status-choice-group.tsx",
"./src/DetailsView/components/warning-configuration.tsx",
"./src/DetailsView/details-view-init-with-react-devtools.ts",
"./src/DetailsView/handlers/allurls-permission-handler.ts",
"./src/DetailsView/handlers/details-view-toggle-click-handler-factory.ts",
"./src/DetailsView/handlers/master-checkbox-config-provider.ts",
Expand All @@ -70,12 +72,6 @@
"./src/assessments/audio-video-only/test-steps/test-steps.ts",
"./src/assessments/auto-pass-if-no-results.ts",
"./src/assessments/color/test-steps/test-steps.tsx",
"./src/assessments/common/assisted-test-record-your-results.tsx",
"./src/assessments/common/element-column-renderers.tsx",
"./src/assessments/common/instructions-and-labels-note.tsx",
"./src/assessments/common/manual-test-record-your-results.tsx",
"./src/assessments/common/property-bag-column-renderer-factory.tsx",
"./src/assessments/common/property-bag-column-renderer.tsx",
"./src/assessments/contrast/test-steps/test-steps.ts",
"./src/assessments/custom-widgets/custom-widgets-column-renderer-factory.tsx",
"./src/assessments/custom-widgets/custom-widgets-column-renderer.tsx",
Expand All @@ -85,6 +81,7 @@
"./src/assessments/headings/test-steps/test-steps.ts",
"./src/assessments/images/test-steps/test-steps.ts",
"./src/assessments/keyboard-interaction/test-steps/test-steps.ts",
"./src/assessments/landmarks/does-result-have-main-role.ts",
"./src/assessments/landmarks/test-steps/test-steps.ts",
"./src/assessments/language/test-steps/test-steps.ts",
"./src/assessments/links/test-steps/test-steps.ts",
Expand All @@ -104,7 +101,9 @@
"./src/assessments/types/report-instance-field.ts",
"./src/assessments/visible-focus-order/test-steps/test-steps.ts",
"./src/background/IndexedDBDataKeys.ts",
"./src/background/actions/action-hub.ts",
"./src/background/actions/action-payloads.ts",
"./src/background/actions/assessment-actions.ts",
"./src/background/actions/card-selection-action-creator.ts",
"./src/background/actions/card-selection-actions.ts",
"./src/background/actions/command-actions.ts",
Expand All @@ -115,6 +114,7 @@
"./src/background/actions/dev-tools-action-creator.ts",
"./src/background/actions/dev-tools-actions.ts",
"./src/background/actions/feature-flag-actions.ts",
"./src/background/actions/global-action-hub.ts",
"./src/background/actions/injection-action-creator.ts",
"./src/background/actions/injection-actions.ts",
"./src/background/actions/inspect-action-creator.ts",
Expand All @@ -137,15 +137,18 @@
"./src/background/actions/unified-scan-result-actions.ts",
"./src/background/actions/user-configuration-actions.ts",
"./src/background/actions/visualization-actions.ts",
"./src/background/actions/visualization-scan-result-actions.ts",
"./src/background/application-build-generator.ts",
"./src/background/assessment-data-remover.ts",
"./src/background/browser-message-broadcaster-factory.ts",
"./src/background/browser-permissions-tracker.ts",
"./src/background/details-view-controller.ts",
"./src/background/dev-tools-monitor.ts",
"./src/background/extension-details-view-controller.ts",
"./src/background/feature-flag-checker.ts",
"./src/background/get-persisted-data.ts",
"./src/background/global-action-creators/feature-flags-action-creator.ts",
"./src/background/global-action-creators/global-action-creator.ts",
"./src/background/global-action-creators/permissions-state-action-creator.ts",
"./src/background/global-action-creators/scoping-action-creator.ts",
"./src/background/global-action-creators/user-configuration-action-creator.ts",
Expand Down Expand Up @@ -181,6 +184,7 @@
"./src/background/telemetry/application-telemetry-data-factory.ts",
"./src/background/telemetry/debug-tools-telemetry-client.ts",
"./src/background/telemetry/multiplexing-telemetry-client.ts",
"./src/background/telemetry/sending-exception-telemetry-listener.ts",
"./src/background/telemetry/telemetry-base-data.ts",
"./src/background/telemetry/telemetry-client-provider.ts",
"./src/background/telemetry/telemetry-client.ts",
Expand Down Expand Up @@ -249,12 +253,14 @@
"./src/common/fabric-icons.ts",
"./src/common/file-url-provider.ts",
"./src/common/filename-builder.ts",
"./src/common/get-card-selection-view-data.ts",
"./src/common/get-guidance-tags-from-guidance-links.ts",
"./src/common/get-inner-text-from-jsx-element.ts",
"./src/common/globalization.ts",
"./src/common/html-element-utils.ts",
"./src/common/is-result-highlight-unavailable.ts",
"./src/common/is-supported-browser.ts",
"./src/common/merge-promise-responses.ts",
"./src/common/message.ts",
"./src/common/messages.ts",
"./src/common/narrow-mode-thresholds.ts",
Expand All @@ -264,6 +270,7 @@
"./src/common/store-proxy.ts",
"./src/common/store-update-message-hub.ts",
"./src/common/tabbable-elements-helper.ts",
"./src/common/target-helper.ts",
"./src/common/telemetry-data-factory.ts",
"./src/common/types/store-data/adhoc-test-keys.ts",
"./src/common/types/store-data/details-view-right-content-panel-type.ts",
Expand Down Expand Up @@ -377,9 +384,12 @@
"./src/injected/adapters/resolution-creator.ts",
"./src/injected/adapters/scan-results-to-unified-results.ts",
"./src/injected/all-frame-runner.ts",
"./src/injected/analyzers/analyzer.ts",
"./src/injected/analyzers/filter-results.ts",
"./src/injected/analyzers/focus-traps-handler.ts",
"./src/injected/analyzers/notification-text-creator.ts",
"./src/injected/analyzers/tab-stops-done-analyzing-tracker.ts",
"./src/injected/analyzers/tab-stops-handler.ts",
"./src/injected/analyzers/tab-stops-orchestrator.ts",
"./src/injected/analyzers/tab-stops-requirement-result-processor.ts",
"./src/injected/bounding-rect.ts",
Expand All @@ -392,27 +402,23 @@
"./src/injected/focus-change-handler.ts",
"./src/injected/frame-url-controller.ts",
"./src/injected/frame-url-finder.ts",
"./src/injected/frameCommunicators/axe-frame-messenger.ts",
"./src/injected/frameCommunicators/backchannel-window-message-translator.ts",
"./src/injected/frameCommunicators/browser-backchannel-window-message-poster.ts",
"./src/injected/frameCommunicators/error-message-content.ts",
"./src/injected/frameCommunicators/frame-messenger.ts",
"./src/injected/frameCommunicators/respondable-command-message-communicator.ts",
"./src/injected/frameCommunicators/scrolling-controller.ts",
"./src/injected/frameCommunicators/window-message.ts",
"./src/injected/iframe-detector.ts",
"./src/injected/inspect-controller.ts",
"./src/injected/path-snippet-controller.ts",
"./src/injected/scan-incomplete-warning-detector.ts",
"./src/injected/scanner-utils.ts",
"./src/injected/scanner.d.ts",
"./src/injected/scoping-listener.ts",
"./src/injected/selector-to-visualization-map.ts",
"./src/injected/shadow-initializer.ts",
"./src/injected/shadow-utils.ts",
"./src/injected/single-frame-tab-stop-listener.ts",
"./src/injected/tab-stop-requirement-result.ts",
"./src/injected/tab-stops-requirement-evaluator.ts",
"./src/injected/tabbable-element-getter.ts",
"./src/injected/target-page-action-message-creator.ts",
"./src/injected/visualization-instance-processor.ts",
"./src/injected/visualization-needs-update.ts",
"./src/injected/visualization/center-position-calculator.ts",
"./src/injected/visualization/drawer-utils.ts",
"./src/injected/visualization/drawer.ts",
Expand Down Expand Up @@ -440,6 +446,7 @@
"./src/popup/components/launch-pad-item-row.tsx",
"./src/popup/components/launch-pad.tsx",
"./src/popup/incompatible-browser-renderer.tsx",
"./src/popup/popup-init-with-react-devtools.ts",
"./src/popup/target-tab-finder.ts",
"./src/reports/assessment-report.styles.ts",
"./src/reports/automated-checks-report.styles.ts",
Expand Down Expand Up @@ -543,12 +550,9 @@
"./src/tests/unit/common/visualization-toggle-props-builder.ts",
"./src/tests/unit/common/webextension-polyfill-setup.ts",
"./src/tests/unit/jest-setup.ts",
"./src/tests/unit/mock-helpers/chrome-event-mock.ts",
"./src/tests/unit/mock-helpers/port-on-disconnect-mock.ts",
"./src/tests/unit/mock-helpers/port-on-message-mock.ts",
"./src/tests/unit/mock-helpers/store-mock.ts",
"./src/tests/unit/tests/assessments/common/renderer-wrapper.tsx",
"./src/tests/unit/tests/background/global-action-creators/action-creator-test-helpers.ts",
"./src/tests/unit/tests/background/global-action-creators/mock-interpreter.ts",
"./src/tests/unit/tests/common/components/cards/sample-view-model-data.ts",
"./src/tests/unit/tests/electron/platform/android/scan-results-helpers.ts",
"./src/tests/unit/tests/electron/platform/android/setup/steps/actions-tester.ts",
Expand All @@ -572,6 +576,7 @@
"src/DetailsView/actions/**/*",
"src/Devtools/**/*",
"src/ad-hoc-visualizations/calculated-tab-stops/**/*",
"src/assessments/common/**/*",
"src/assessments/language/common/**/*",
"src/background/global-action-creators/registrar/**/*",
"src/background/injector/**/*",
Expand All @@ -588,6 +593,7 @@
"src/common/react/**/*",
"src/common/stores/**/*",
"src/common/styles/**/*",
"src/common/telemetry/**/*",
"src/common/types/**/*",
"src/content/**/*",
"src/debug-tools/controllers/**/*",
Expand All @@ -603,6 +609,7 @@
"src/electron/window-management/**/*",
"src/fast-pass/**/*",
"src/icons/**/*",
"src/injected/frameCommunicators/**/*",
"src/issue-filing/common/markup/**/*",
"src/popup/actions/**/*",
"src/report-export/**/*",
Expand All @@ -613,6 +620,7 @@
"src/tests/end-to-end/setup/**/*",
"src/tests/end-to-end/test-resources/**/*",
"src/tests/miscellaneous/**/*",
"src/tests/unit/mock-helpers/**/*",
"src/tests/unit/stubs/**/*",
"src/tests/unit/tests/reports/package/scans/**/*",
"src/tests/unit/tests/test-resources/**/*",
Expand Down