Skip to content

fix: handle faulty imports - #12793

Merged
joheriks merged 3 commits into
masterfrom
issues/12765_fail-with-clear-reason
Jan 27, 2022
Merged

joheriks merged 3 commits into
masterfrom
issues/12765_fail-with-clear-reason

Conversation

@caalador

Copy link
Copy Markdown
Contributor

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

fixes #12765

@github-actions

github-actions Bot commented Jan 21, 2022 •

Copy link
Copy Markdown
Contributor

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

joheriks commented Jan 26, 2022 •

Copy link
Copy Markdown
Contributor

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 <joheriks@vaadin.com>
@caalador

Copy link
Copy Markdown
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

joheriks commented Jan 27, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

joheriks commented Jan 27, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

Done.

@sonarqubecloud

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 <mikael.grankvist@vaadin.com>
@vaadin-bot

Copy link
Copy Markdown
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