-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add copyrights and pre-commit check. (#70)
- Loading branch information
Florian Loitsch
authored
Jun 11, 2021
1 parent
67a9dc9
commit d25e57d
Showing
19 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2021 Toitware ApS. All rights reserved. | ||
# Use of this source code is governed by an MIT-style license that can be | ||
# found in the LICENSE file. | ||
|
||
EXTENSIONS="*.ts *.toit *.js" | ||
|
||
new_files=$(git diff --name-only --diff-filter=A --cached -- $EXTENSIONS) | ||
new_files=$(find vscode/src -name "*.ts") | ||
|
||
for f in $new_files; do | ||
if ! grep -L "Copyright .* Toitware" "$f" 2>&1 1>/dev/null; then | ||
missing_copyright="$f $missing_copyright" | ||
else | ||
if ! grep -L "governed.*MIT" "$f" 2>&1 1>/dev/null; then | ||
missing_mit="$f $missing_mit" | ||
fi | ||
fi | ||
done | ||
|
||
if [ -n "$missing_copyright" ]; then | ||
echo "Missing copyright in:" | ||
for f in $missing_copyright; do | ||
echo " $f" | ||
done | ||
fi | ||
|
||
if [ -n "$missing_mit" ]; then | ||
echo "Missing MIT line:" | ||
for f in $missing_mit; do | ||
echo " $f" | ||
done | ||
fi | ||
|
||
if [ -n "$missing_copyright" ] || [ -n "$missing_mit" ]; then | ||
exit 1; | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# ide-tools | ||
Tools for working with Toit in different IDEs | ||
|
||
## Development | ||
To have automatic checks for copyright and MIT notices, run | ||
|
||
``` | ||
$ git config core.hooksPath .githooks | ||
``` | ||
|
||
If a file doesn't need a copyright/MIT notice, use the following to skip | ||
the check: | ||
``` | ||
git commit --no-verify | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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