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

adding github actions for linting and testing #26

Closed
wants to merge 17 commits into from

Conversation

patnir
Copy link
Contributor

@patnir patnir commented Feb 29, 2024

Linting + Testing CI Github Action

@patnir patnir changed the title adding github actions for linting adding github actions for linting and testing Feb 29, 2024
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
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')
Copy link
Contributor

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 )

2
3'

for file in $files; do
Copy link
Contributor

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

Comment on lines +14 to +20
headerLineNumbers() {
grep -Fn -e "$license1" -e "$license2" -e "$license3" "$1" | cut -f1 -d:
}

expectedHeaderLineNumbers='1
2
3'
Copy link
Contributor

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" ]]

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@patnir patnir closed this Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants