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

fix: handle faulty imports #12793

Merged
merged 3 commits into from
Jan 27, 2022
Merged

Conversation

caalador
Copy link
Contributor

Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765

@github-actions
Copy link

github-actions bot commented Jan 21, 2022

Unit Test Results

   774 files  +  4     774 suites  +4   29m 45s ⏱️ + 4m 32s
5 769 tests +25  5 720 ✔️ +27  49 💤  - 2  0 ±0 
5 793 runs  +17  5 744 ✔️ +20  49 💤  - 3  0 ±0 

Results for commit dbb1783. ± Comparison against base commit eaad21e.

♻️ This comment has been updated with latest results.

Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
@caalador caalador force-pushed the issues/12765_fail-with-clear-reason branch from 169912a to 4e4d79a Compare January 21, 2022 11:32
@caalador caalador requested a review from joheriks January 24, 2022 07:49
@joheriks
Copy link
Contributor

joheriks commented Jan 26, 2022

The original StringUtilTest::removeComments is used only here and in Lit and Polymer template parsers. Is there a reason that removeJsComments couldn't replace the previous removeComments (which would also remove the code duplication)?

Co-authored-by: Johannes Eriksson <[email protected]>
@caalador
Copy link
Contributor Author

The main reason is that it is used to clean the return html'....' html contents and with the new js version it would see the whole html as sting and not remove comments from there making it not work as wanted.

@vaadin-bot vaadin-bot added +1.0.0 and removed +0.1.0 labels Jan 27, 2022
@joheriks
Copy link
Contributor

joheriks commented Jan 27, 2022

The main reason is that it is used to clean the return html'....' html contents and with the new js version it would see the whole html as sting and not remove comments from there making it not work as wanted.

Is html'...' actually legal JS, doesn't this notation require backticks (html`...` ) so it should not be affected? If there is a way to quote the template with apostrophes, then I would suggest to parametrize the parser instead of code duplication, as the only difference between removeComments and removeJsComments is whether to transition to the IN_STRING_APOSTROPHE state.

@caalador
Copy link
Contributor Author

The main reason is that it is used to clean the return html'....' html contents and with the new js version it would see the whole html as sting and not remove comments from there making it not work as wanted.

Is html'...' actually legal JS, doesn't this notation require backticks (html`...`) so it should not be affected? If there is a way to quote the template with apostrophes, then I would suggest to parametrize the parser instead of code duplication, as the only difference between removeComments and removeJsComments is whether to transition to the IN_STRING_APOSTROPHE state.

Well it is for polymer template and there it is actually fine to have it with `|'|". The original tests were at least testing that we can remove the comments from the template method.

@joheriks
Copy link
Contributor

joheriks commented Jan 27, 2022

The main reason is that it is used to clean the return html'....' html contents and with the new js version it would see the whole html as sting and not remove comments from there making it not work as wanted.

Is html'...' actually legal JS, doesn't this notation require backticks (html`...`) so it should not be affected? If there is a way to quote the template with apostrophes, then I would suggest to parametrize the parser instead of code duplication, as the only difference between removeComments and removeJsComments is whether to transition to the IN_STRING_APOSTROPHE state.

Well it is for polymer template and there it is actually fine to have it with `|'|". The original tests were at least testing that we can remove the comments from the template method.

Aight, my suggestion would be to refactor the method to reduce the code duplication and mention in the JavaDoc why the parameter is required (different parsing requirements for polymer templates).

@caalador
Copy link
Contributor Author

Done.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@joheriks joheriks enabled auto-merge (squash) January 27, 2022 09:13
@joheriks joheriks disabled auto-merge January 27, 2022 09:13
@joheriks joheriks enabled auto-merge (squash) January 27, 2022 09:13
@joheriks joheriks merged commit 9d4af71 into master Jan 27, 2022
@joheriks joheriks deleted the issues/12765_fail-with-clear-reason branch January 27, 2022 09:53
@vaadin-bot
Copy link
Collaborator

Hi @caalador and @joheriks, when i performed cherry-pick to this commit to 2.8, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 9d4af71
error: could not apply 9d4af71... fix: handle faulty imports (#12793)
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

@vaadin-bot
Copy link
Collaborator

Hi @caalador and @joheriks, when i performed cherry-pick to this commit to 9.0, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 9d4af71
error: could not apply 9d4af71... fix: handle faulty imports (#12793)
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

@vaadin-bot
Copy link
Collaborator

Hi @caalador and @joheriks, when i performed cherry-pick to this commit to 2.7, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 9d4af71
error: could not apply 9d4af71... fix: handle faulty imports (#12793)
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

caalador added a commit that referenced this pull request Jan 27, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
caalador added a commit that referenced this pull request Jan 27, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
joheriks pushed a commit that referenced this pull request Jan 27, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
joheriks pushed a commit that referenced this pull request Jan 27, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
joheriks pushed a commit that referenced this pull request Jan 27, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
vaadin-bot pushed a commit that referenced this pull request Jan 27, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765
caalador added a commit that referenced this pull request Jan 28, 2022
Do not throw silently for incompatible
import paths. Fix comment removal
for JS files to accept ' as string.

fixes #12765

Co-authored-by: caalador <[email protected]>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 23.0.0.beta1 and is also targeting the upcoming stable 23.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

java.net.BindException: Cannot assign requested address: connect when trying to start a V23 Spring Boot app
4 participants