-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add tests for template file syntax errors #3962
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
Open
salmanmkc
wants to merge
10
commits into
main
Choose a base branch
from
salmanmkc/7-template-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3aef228
Add tests for making sure that template files have no syntax errors
salmanmkc f06a452
update with temp file
salmanmkc c824407
better validations
salmanmkc 63ada10
update
salmanmkc ffc2086
skip win 64
salmanmkc 2dc3c3a
Enhance shell script validation with detailed debugging and ShellChec…
salmanmkc 577c73e
don't skip on windows
salmanmkc 49b30c8
add skip back for windows
salmanmkc 1f9418d
update
salmanmkc 820bcaf
Update generic methdod to shelcheck all files that can be
salmanmkc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
skip win 64
- Loading branch information
commit ffc2086972ce759e2317324e2c9f25e99df3c218
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
Should we just replace all the placeholder strings in the script and then run
bash -n
against it?So we don't need to add any 3rd party dependency.
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.
Fr
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.
With just bash -n it wasn't able to catch all the syntax errors, I tried making various syntax errors and they would not get detected, missing brackets for example would not get detected at all
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.
For example, tests pass with missing bracket with

bash -n
and no shellcheckThere 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.
With shell check it gives an error

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.
I have it so that if the dependency isn't there, it just uses
bash -n
still thoughThere 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.
Now i am wondering whether we should just run the script for testing.
We want the test to be reliable, given the facts that
bash -n
might not catch expression error, andshellcheck
may not exist on the CI machine, actually execute the script might be our best way to always test the script's syntax errors.