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

build: Apply strict null checks #14499

Merged
merged 4 commits into from
Mar 27, 2025
Merged

build: Apply strict null checks #14499

merged 4 commits into from
Mar 27, 2025

Conversation

TomasEng
Copy link
Contributor

@TomasEng TomasEng commented Jan 24, 2025

Description

Created a Typescript configuration file for strict null checks and added it to the relevant Github workflow. We can use this to do strict null checks in individual folders until we have covered the whole project and can set strictNullChecks to true in the main tsconfig file.

Related Issue

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)

Summary by CodeRabbit

This release improves our development quality assurance and code reliability with enhanced type checks that help catch potential issues early.

  • Tests

    • Added an extra verification step to the automated testing workflow to enforce stricter type safety.
  • Chores

    • Updated internal configurations to apply more rigorous type validations during development.

Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

📝 Walkthrough

Walkthrough

The changes add a new step to the GitHub Actions workflow for frontend tests that executes a strict null check command. Additionally, a new TypeScript configuration file is introduced to enable strict null checking and include an extra library directory. A corresponding script is added to the package configuration to run the TypeScript compiler with the newly provided configuration. These updates integrate stricter type safety into the build and test process without altering existing functionality.

Changes

File(s) Change Summary
.github/workflows/frontend-unit-tests.yml Added a new step named "Strict null checks" in the "typecheck" job that runs yarn strict-null-checks after the existing typecheck step and before Eslint.
frontend/tsconfig-strict.json, package.json Introduced a new TypeScript configuration file enabling strictNullChecks (with an additional include path) and added a new script to run it via tsc.

Suggested labels

quality/testing, team/studio-core, skip-manual-testing, skip-documentation

Suggested reviewers

  • github-actions
  • framitdavid

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4fa851f and b6d19cb.

📒 Files selected for processing (3)
  • .github/workflows/frontend-unit-tests.yml (1 hunks)
  • frontend/tsconfig-strict.json (1 hunks)
  • package.json (1 hunks)
🔇 Additional comments (3)
.github/workflows/frontend-unit-tests.yml (1)

66-68: New Strict Null Checks Step Added

The addition of the "Strict null checks" step using the command yarn strict-null-checks is correctly integrated into the typecheck job. This new step will execute the extra TypeScript check defined by the new script in package.json, ensuring that strict null checks are enforced.

package.json (1)

97-97: New Script for Strict Null Checks

The script "strict-null-checks": "tsc --noEmit -p frontend/tsconfig-strict.json" is properly added under the scripts section. It correctly points to the new TypeScript configuration file to enforce strict null checking without emitting output.

frontend/tsconfig-strict.json (1)

1-7: New TypeScript Configuration with Strict Null Checks

The new tsconfig-strict.json file extends the existing tsconfig.json while enabling strictNullChecks for stricter type enforcement. Including "libs/studio-icons" in the "include" array effectively scopes these checks to that directory as part of the progressive rollout.

Consider verifying if additional directories should be included in the future to extend strict null checking to other parts of the project.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. skip-releasenotes Issues that do not make sense to list in our release notes frontend labels Jan 24, 2025
@TomasEng TomasEng added ops/ci-cd Continous integration, continous deploy and automatic testing. quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. labels Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.93%. Comparing base (bfe4a20) to head (9276640).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14499   +/-   ##
=======================================
  Coverage   95.93%   95.93%           
=======================================
  Files        1991     1991           
  Lines       25832    25832           
  Branches     2917     2917           
=======================================
  Hits        24781    24781           
  Misses        788      788           
  Partials      263      263           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TomasEng TomasEng marked this pull request as ready for review March 27, 2025 08:49
@TomasEng TomasEng added team/studio-domain1 team/studio-domain2 team/studio-core skip-manual-testing PRs that do not need to be tested manually skip-documentation Issues where updating documentation is not relevant labels Mar 27, 2025
Copy link
Contributor

@wrt95 wrt95 left a comment

Choose a reason for hiding this comment

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

Great job!

@TomasEng TomasEng merged commit c6f8c90 into main Mar 27, 2025
10 checks passed
@TomasEng TomasEng deleted the strict-null-checks branch March 27, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added-to-sprint frontend ops/ci-cd Continous integration, continous deploy and automatic testing. quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. skip-documentation Issues where updating documentation is not relevant skip-manual-testing PRs that do not need to be tested manually skip-releasenotes Issues that do not make sense to list in our release notes solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-core team/studio-domain1 team/studio-domain2
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants