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

refactor: Finalize message handling refactoring #299

Merged
merged 2 commits into from
Sep 13, 2024
Merged

Conversation

matz3
Copy link
Member

@matz3 matz3 commented Sep 12, 2024

  • Use new addMessage signature in all reporters
  • Reduce duplicate code for addMessage by moving logic into LinterContext
  • Only produce actual messages at the end of linting (Might slightly reduce peak memory usage)

@matz3 matz3 requested a review from a team September 12, 2024 13:48
- Use new addMessage signature in all reporters
- Reduce duplicate code for addMessage by moving logic into
  LinterContext
- Only produce actual messages at the end of linting
  (Might slightly reduce peak memory usage)
@matz3 matz3 force-pushed the refactor-add-message branch from ebadeb5 to e5d3f32 Compare September 12, 2024 13:50
Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

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

Looks like some solid improvements 👍
Maybe @d3xter666 wants to have a look too, otherwise fine with me.

d3xter666
d3xter666 previously approved these changes Sep 13, 2024
Copy link
Contributor

@d3xter666 d3xter666 left a comment

Choose a reason for hiding this comment

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

Overall LGTM
I have some questions as I might be missing some of the details

src/linter/LinterContext.ts Show resolved Hide resolved
addMessage<M extends MESSAGE>(
id: M, argsOrNode?: MessageArgs[M] | SaxTag, node?: SaxTag
) {
if (!argsOrNode) {
Copy link
Contributor

@d3xter666 d3xter666 Sep 13, 2024

Choose a reason for hiding this comment

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

This validation seems redundant and a bit conunterintuitive- the argument is optional, but we do a manual check for it. It also seems to break the definitions above as the second argument there is mandatory.

Why don't we rely entirely on TS validation here?

Copy link
Member Author

Choose a reason for hiding this comment

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

To me this all seems required to distinguish between the signatures at runtime. Feel free to improve this part. I couldn't manage to make it better. The only alternative would be to not have optional arguments at all, but then it was hard for me to come up with a type for the messages without args.

line: 78,
message: 'Use of deprecated property \'sap.ui5/models/odata-v4-via-dataSource/settings/synchronizationMode\' of sap.ui.model.odata.v4.ODataModel',
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that the path to the dataSource got lost and only the property is left.
Was this intentional?
I'm fine with it as the positiinalInfo (line/column) is correct

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. The message was better before.

Copy link
Contributor

@d3xter666 d3xter666 left a comment

Choose a reason for hiding this comment

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

LGTM

@matz3 matz3 merged commit d1ab9bc into main Sep 13, 2024
13 checks passed
@matz3 matz3 deleted the refactor-add-message branch September 13, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants