Skip to content

Conversation

guillaume-dequenne
Copy link
Contributor

No description provided.

@guillaume-dequenne guillaume-dequenne force-pushed the support_symbol_highlighting branch 5 times, most recently from 47dd708 to e914fe8 Compare October 8, 2019 15:02
Copy link
Contributor

@benzonico benzonico left a comment

Choose a reason for hiding this comment

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

Quite some things in there : most interestingly, simpler code and stronger testing would have prevented to have a bug ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Name is dodgy : Those are global variables, neither module variables or global fields. I think we should name this globalVariables.

Copy link
Contributor

Choose a reason for hiding this comment

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

assertThat(moduleSymbols).extracting(name).containsExactly("global_x", "global_var");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't this assert on the order as well? which can't be guaranteed for a Set?

Copy link
Contributor

Choose a reason for hiding this comment

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

not related to your PR : I am just wondering if we could just avoid 3 iterations over values and have only one with a plain old for loop. If you're up to it, I think it is worth a commit of refactoring at the end of your PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to collect to assert on a stream. And moreover, the containsOnly assertion will check it is not Empty, so no need for the isNotEmpty call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that you only tested START of references and you most probably have a bug of end of references.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why the dir variable ? I think you can inline it and concatenate it to the file name.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could remove componentKey as parameter of this method and use the field directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can store firstUsage.tree() in a dedicated var instead of calling it 4 times ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can store usage.tree() in a dedicated var instead of calling it 4 times ? which makes me realize that we might have a copy/paste bug here : there is a firstUsage.tree() call !!! Why is this not caught by unit test ? (seems that ending of reference is not tested)

@guillaume-dequenne guillaume-dequenne force-pushed the support_symbol_highlighting branch 2 times, most recently from 623eaa7 to 8fc6a37 Compare October 9, 2019 11:46
Copy link
Contributor

Choose a reason for hiding this comment

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

This ought to be rename to addGlobalVariable (and the param name as well)

Copy link
Contributor

Choose a reason for hiding this comment

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

we probably don't need the condition.

Copy link
Contributor

Choose a reason for hiding this comment

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

we probably don't need the condition

@guillaume-dequenne guillaume-dequenne force-pushed the support_symbol_highlighting branch from 8fc6a37 to 53a4425 Compare October 9, 2019 12:34
Copy link
Contributor

@benzonico benzonico left a comment

Choose a reason for hiding this comment

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

see last minor details. Otherwise LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

indentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

tiny detail but I personally think it would be more readable with :

new SymbolVisitor(context.newSymbolTable().onFile(inputFile)).visitFileInput(visitorContext.rootTree());

feel free to discard the suggestion.

@guillaume-dequenne guillaume-dequenne force-pushed the support_symbol_highlighting branch from 89f2c1a to 6e1d2c1 Compare October 9, 2019 13:17
@guillaume-dequenne guillaume-dequenne merged commit b1d4bd5 into master Oct 9, 2019
@guillaume-dequenne guillaume-dequenne deleted the support_symbol_highlighting branch October 9, 2019 13:28
hashicorp-vault-sonar-prod bot pushed a commit that referenced this pull request Jul 24, 2025
…gument (#393)

GitOrigin-RevId: 329a636f233c46a099cfa1b70c5c24c08ac2a37e
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.

2 participants