-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b85c3cf
Showing
7 changed files
with
841 additions
and
0 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,13 @@ | ||
FROM ubuntu:latest | ||
|
||
LABEL maintainer="underwoo" | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y shellcheck \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY lint.sh lint.sh | ||
COPY whitespace_check.sh whitespace_check.sh | ||
COPY ftn_tab_check.sh ftn_tab_check.sh | ||
|
||
ENTRYPOINT ["/lint.sh"] |
Large diffs are not rendered by default.
Oops, something went wrong.
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,32 @@ | ||
# Simple Lint GitHub Action | ||
|
||
[](https://www.gnu.org/licenses/gpl-3.0) | ||
|
||
This project runs simple lint-like actions on files in a git repository. The | ||
current list of lint actions are: | ||
|
||
* check for trailing whitespace | ||
* check Fortran files for use of tab characters | ||
|
||
## Example | ||
|
||
```yaml | ||
# This workflow will check files in the repository for trailing whitespace and | ||
# Fortran files that use tabs | ||
|
||
name: Simple Lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Whitespace Lint | ||
id: wslint | ||
uses: underwoo/simple-lint@v1 | ||
with: | ||
failure: false | ||
- if: ! ${{ steps.wslint.outputs.lintSuccess }} | ||
run: exit 1 | ||
``` |
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,21 @@ | ||
name: "Fortran Lint" | ||
description: "Simple Fortran Lint, currently checks for trailing whitespace and Tab characters" | ||
inputs: | ||
failure: | ||
description: "Cause action to fail if lint errors found" | ||
required: false | ||
default: true | ||
outputs: | ||
lintSuccess: | ||
description: "indicates if the the lint processes passed (true) or failed (false)" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: ["${{ inputs.failure }}"] | ||
branding: | ||
icon: "shield" | ||
color: "blue" | ||
|
||
|
||
|
||
# find . -type f -exec file {} \; | grep '\(Bourne-Again\|POSIX\|Korn\) shell' | awk -F : '{print $1}' |
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,30 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (C) 2020 Seth Underwood | ||
# | ||
# This file is part of Simple Lint. | ||
# | ||
# Simple Lint is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Simple Lint is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Foobar. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
# Find all Fortran files (using the file extensions listed below) and check | ||
# if they files use a tab character. Print the files that do contain a | ||
# tab character to standard out. | ||
# File extensions use: | ||
# * .f .F | ||
# * .f90 .F90 | ||
# * .inc .INC | ||
# * .fh .FH | ||
# * .for .FOR | ||
find -O3 . -iregex ".*\.\(f\(90\)?\|inc\|fh\|for\)$" \ | ||
-exec grep -l $'\t' {} \; |
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,48 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (C) 2020 Seth Underwood | ||
# | ||
# This file is part of Simple Lint. | ||
# | ||
# Simple Lint is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Simple Lint is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Foobar. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
# Check for files that have trailing whitespace | ||
/whitespace_check.sh | tee /tmp/ws.out | ||
ws_nfiles=$(wc -l /tmp/ws.out | awk '{print $1}') | ||
if test $ws_nfiles -gt 0 | ||
then | ||
echo "::error::${ws_nfiles} file(s) contain(s) trailing whitespace" | ||
cat /tmp/ws.out | ||
fi | ||
|
||
# Check for Fortran files with tabs | ||
/ftn_tab_check.sh | tee /tmp/ftab.out | ||
ftab_nfiles=$(wc -l /tmp/ftab.out | awk '{print $1}') | ||
if test $ftab_nfiles -gt 0 | ||
then | ||
echo "::error::${ftab_nfiles} Fortran file(s) contain(s) tab characters" | ||
cat /tmp/ftab.out | ||
fi | ||
|
||
# Prepare action output, and exit non-zero if requested to fail | ||
if test $ws_nfiles -gt 0 || test $ftab_nfiles -gt 0 | ||
then | ||
echo "::set-output name=lintSuccess::false" | ||
if test "$0" = "true" | ||
then | ||
exit 1 | ||
fi | ||
else | ||
echo "::set-output name=lintSuccess::true" | ||
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (C) 2020 Seth Underwood | ||
# | ||
# This file is part of Simple Lint. | ||
# | ||
# Simple Lint is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Simple Lint is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Foobar. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
# Find all files in the working directory, ignoring the `.git` directory that | ||
# have trailing whitespace, and prints them to standard out. | ||
find . -type f -not -path "./.git/*" -exec egrep -l " +$" {} \; |