GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactoring: Simplify adding new configuration properties by henrymercer · Pull Request #2107 · github/codeql-action

Conversation

@henrymercer

@henrymercer henrymercer commented Jan 30, 2024

Copy link
Copy Markdown
Contributor

This PR refactors the way we initialize and test configurations to make it easier to add new configuration properties. It shouldn't have any user visible effects. Specifically, adding a new configuration property should not require updating irrelevant tests.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
henrymercer added 2 commits January 30, 2024 18:59
@henrymercer
Refactoring: Create interface for config initialization
ec42edc
This eliminates argument order mistakes, and also lets us add new inputs
without having to update every test.
@henrymercer
Refactoring: Introduce common method to stub a config
d2e867f
This means that we don't need to update irrelevant test cases when we
add a new configuration property.
@henrymercer
henrymercer requested a review from a team as a code owner January 30, 2024 19:02
github-advanced-security[bot]
github-advanced-security AI found potential problems Jan 30, 2024
View reviewed changes
Comment thread src/testing-utils.ts
languages: [],
originalUserInput: {},
tempDir: "",
codeQLCmd: "",

Check failure

Code scanning / CodeQL

Exec call vulnerable to binary planting

This exec call might be vulnerable to Windows binary planting vulnerabilities. This exec call might be vulnerable to Windows binary planting vulnerabilities. This exec call might be vulnerable to Windows binary planting vulnerabilities. This exec call might be vulnerable to Windows binary planting vulnerabilities. This exec call might be vulnerable to Windows binary planting vulnerabilities.
@henrymercer henrymercer mentioned this pull request Jan 31, 2024
Add experimental build-mode input #2108
Merged
3 tasks done
angelapwen
angelapwen approved these changes Jan 31, 2024
View reviewed changes

@angelapwen angelapwen left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just a quick question 😄

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/config-utils.ts
logger: Logger;
}

type GetDefaultConfigInputs = Omit<

@angelapwen angelapwen Jan 31, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

TIL about the Omit type 🤯

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@angelapwen angelapwen Jan 31, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We could use Omit/Pick to refactor the StatusReportBase and all those other interfaces later, perhaps...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

henrymercer reacted with heart emoji
All reactions
  • ❤️ 1 reaction

@henrymercer henrymercer Jan 31, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

There are quite a few of these nice types :) https://www.typescriptlang.org/docs/handbook/utility-types.html

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/config-utils.ts
"configFile" | "configInput"
>;

type LoadConfigInputs = Omit<InitConfigInputs, "configInput"> & {

@angelapwen angelapwen Jan 31, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What does this & operator do here? Thought it represented bitwise AND but I can't really make sense of it in this context.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aeisenberg aeisenberg Jan 31, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

These are intersections. Though I wonder if this should be a union type (using |).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@henrymercer henrymercer Jan 31, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I believe we want intersections, i.e. we want the type to include the properties from both the left hand side and the right hand side. For instance if we have (1) { a: 1 } and (2) { a: 1, b: "abc" }, then (1) and (2) would satisfy { a: int } | { b: string } but only (2) would satisfy { a: int } & { b: string }.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

angelapwen reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@henrymercer
henrymercer merged commit e345133 into main Jan 31, 2024
@henrymercer
henrymercer deleted the henrymercer/refactor-config branch January 31, 2024 18:41
This was referenced Feb 2, 2024
Merge main into releases/v3 #2113
Merged
Merge releases/v3 into releases/v2 #2115
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aeisenberg aeisenberg aeisenberg left review comments
+1 more reviewer
@angelapwen angelapwen angelapwen approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@henrymercer @aeisenberg @angelapwen @github-advanced-security
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.