Skip to content

Commit

Permalink
Boilerplate fix (#1313)
Browse files Browse the repository at this point in the history
* verbose failure message in boilerplate

* remove quotes from yaml string

* show diff

* block chomping strip, see https://yaml-multiline.info/

* fix boilerplate in lattice.py

* remove carriage returns before comparing

* changelog update
  • Loading branch information
Scott Wyman Neagle authored Oct 3, 2022
1 parent 45da189 commit 724d099
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/boilerplate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
**/*.py
- name: Boilerplate
env:
boilerplate: |
'# Copyright 2021 Agnostiq Inc.
boilerplate: |-
# Copyright 2021 Agnostiq Inc.
#
# This file is part of Covalent.
#
Expand All @@ -57,10 +57,17 @@ jobs:
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
#
# Relief from the License may be granted by purchasing a commercial license.'
# Relief from the License may be granted by purchasing a commercial license.
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ ! $( cat $file ) =~ $boilerplate ]] ; then
if [[ ! $( cat $file | tr -d '\r' ) =~ "$boilerplate" ]] ; then
printf "Boilerplate is missing from $file.\n"
printf "The first 20 lines of $file are\n\n"
cat $file | tr -d '\r' | cat -ET | head -n 20
printf "\nThe boilerplate should be\n\n"
echo "$boilerplate" | cat -ET
printf "\nThe diff is\n\n"
diff <(cat $file | tr -d '\r' | head -n 20) <(echo "$boilerplate") | cat -ET
exit 1
fi
done
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed Ubuntu images to Debian for accuracy
- Adding boilerplate workflow
- Syntax fixes in release.yml
- Verbose failure messages in boilerplate workflow

## [0.199.0] - 2022-09-29

Expand Down
2 changes: 1 addition & 1 deletion covalent/_workflow/lattice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# copyright 2021 Agnostiq Inc.
# Copyright 2021 Agnostiq Inc.
#
# This file is part of Covalent.
#
Expand Down

0 comments on commit 724d099

Please sign in to comment.