-
Notifications
You must be signed in to change notification settings - Fork 1
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
adding github actions for linting and testing #26
Conversation
ci/lintHeaders.sh
Outdated
license2=" * License, v. 2.0. If a copy of the MPL was not distributed with this" | ||
license3=" * file, You can obtain one at https://mozilla.org/MPL/2.0/. */" | ||
|
||
files=$(find $1 -type f -name '*.rs') |
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.
Use an array to avoid unwanted expansion later on:
files=( src/**/*.rs )
or:
files=( **/*.rs )
ci/lintHeaders.sh
Outdated
2 | ||
3' | ||
|
||
for file in $files; do |
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.
If you make files
an array, then replace $files
with "${files[@]}"
to prevent expansion
headerLineNumbers() { | ||
grep -Fn -e "$license1" -e "$license2" -e "$license3" "$1" | cut -f1 -d: | ||
} | ||
|
||
expectedHeaderLineNumbers='1 | ||
2 | ||
3' |
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 guess this works but perhaps an easier way to achieve the same result would be:
license="/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */"
[[ "$(head -n3 "$1")" = "$license" ]]
Linting + Testing CI Github Action