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.
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
Expose E2E build errors #940
Expose E2E build errors #940
Changes from 7 commits
afc343c
15a6990
c990d37
e8e3156
f2d04f7
9f0d8b2
c4d7e6b
9c40e93
b70ddb6
b0c32ae
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 68 in node-src/tasks/build.ts
Codacy Production / Codacy Static Code Analysis
node-src/tasks/build.ts#L68
Check warning on line 68 in node-src/tasks/build.ts
Codacy Production / Codacy Static Code Analysis
node-src/tasks/build.ts#L68
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.
This is decent advice (be careful about dynamic regexps) from Codacy but the solution doesn't make sense to me -- I could be off though. cc @paulelliott I think the AI has jumped off the deep end a bit:
a) you can't do
regex.replace('${e2eBuildBinName}',...
in a previously interpolated stringregex
, it's already been replaced.b) it doesn't change anything to do it at that stage anyway (say if we changed the original string :
Then the string wouldn't automatically get interpolated with the var, but I don't understand why it would be better to later do a
.replace()
to manually interpolate.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.
The other piece of advice it had was to use the RE2 library from google to parse user-supplied regex in a safe way. That feels like an easy change to make and right way to resolve these issues. The initial comment it put on the PR yesterday said that and I'm not sure why it shifted to this. You can see that advice on the second warning on the Codacy app.
https://app.codacy.com/gh/chromaui/chromatic-cli/pullRequest?prid=13786760
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.
This is good advice, however, the
e2eBuildBinName
that it is calling out is a simple string constant, not user-controlled input, so this is all moot.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.
@tmeasday I can't make sense of that suggestion to use
.replace()
either 🤔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.
@paulelliott my feeling is the AI is getting really wordy here and I am glazing over and missing the key points:
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.
When I enabled this I just blindly turned the whole thing on. It is quite configurable in the application so if there are rules we disagree with we can easily turn them off per repo. You can also dismiss this specific warning in their interface and it keeps a log of all the specific places it was ignored.