Skip to content

Commit

Permalink
Merge pull request #181 from jbampton/check-for-trailing-whitespace
Browse files Browse the repository at this point in the history
feat: add a GitHub Action to check for trailing whitespace in all files
  • Loading branch information
matz authored Feb 13, 2021
2 parents 14c9943 + 323ca5c commit e04a24f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 30 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ jobs:
- uses: actions/checkout@v2
- name: 🧹 ShellCheck
uses: ludeeus/action-shellcheck@master
trailing-whitespace:
name: 🧋 Trailing whitespace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🧹 Check for trailing whitespace
run: |
cd utils || exit
sh ./check-for-trailing-whitespace.sh || exit 1
yamllint:
name: 🍺 YAML
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion doc/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Library

[math](https://github.com/matz/streem/doc/library/math.md)
[math](https://github.com/matz/streem/doc/library/math.md)
58 changes: 29 additions & 29 deletions doc/library/math.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Math

Streem has a lot Mathematical functions defined by the C standard.
Streem has a lot Mathematical functions defined by the C standard.

## Constants

Expand All @@ -15,7 +15,7 @@ print(PI)

### E

The mathematical constant e = 2.718281…, to available precision.
The mathematical constant e = 2.718281…, to available precision.

```
# Output: 2.718281828459
Expand All @@ -26,7 +26,7 @@ print(E)

### ceil(x)

Return the ceiling of x.
Return the ceiling of x.

```
# Output: 46
Expand All @@ -35,7 +35,7 @@ print(ceil(45.54))

### fabs(x)

Return the absolute value of x.
Return the absolute value of x.

```
# Output: 2
Expand All @@ -53,20 +53,20 @@ print(gcd(4,10))

### trunc(x)

Return the Real value x truncated to an Integral.
Return the Real value x truncated to an Integral.

```
Output: 9
print(trunc(9.13))
```
```

### int(x)

Same as trunc(x).
Same as trunc(x).

### floor(x)

Return the floor of x.
Return the floor of x.

```
# Output: 2
Expand All @@ -75,7 +75,7 @@ print(floor(2.7))

### round(x)

Return the rounding of x.
Return the rounding of x.

```
# Output: 10
Expand Down Expand Up @@ -104,80 +104,80 @@ print(ldexp(6,3))

### sin(x)

Return the sine of x.
Return the sine of x.

### cos(x)

Return the cosine of x.
Return the cosine of x.

### tan(x)

Return the tangent of x.
Return the tangent of x.

### asin(x)

Return the arc sine of x.
Return the arc sine of x.

### acos(x)

Return the arc cosine of x.
Return the arc cosine of x.

### atan(x)

Return the arc tangent of x.
Return the arc tangent of x.

### hypot(x, y)

Return the `sqrt(x * x + y * y)`(Euclidean norm).
Return the `sqrt(x * x + y * y)`(Euclidean norm).

```
# Output: 5
print(hypot(3,4))
```
```

## Hyperbolic functions

### asinh(x)

Return the inverse hyperbolic sine of x.
Return the inverse hyperbolic sine of x.

### acosh(x)

Return the inverse hyperbolic cosine of x.
Return the inverse hyperbolic cosine of x.

### atanh(x)

Return the inverse hyperbolic tangent of x.
Return the inverse hyperbolic tangent of x.

### cosh(x)

Return the hyperbolic cosine of x.
Return the hyperbolic cosine of x.

### sinh(x)

Return the hyperbolic sine of x.
Return the hyperbolic sine of x.

### tanh(x)

Return the hyperbolic tangent of x.
Return the hyperbolic tangent of x.

## logarithmic functions

### exp(x)

Return e raised to the power x.
Return e raised to the power x.

### log(x)

Return the natural logarithm of x.
Return the natural logarithm of x.

### log2(x)

Return the base-2 logarithm of x.
Return the base-2 logarithm of x.

### log10(x)

Return the base-10 logarithm of x.
Return the base-10 logarithm of x.

## Power functions

Expand All @@ -188,7 +188,7 @@ Return x raised to the power y.
```
# Output: 25
print(pow(5,2))
```
```

### sqrt(x)

Expand All @@ -197,4 +197,4 @@ Return the square root of x.
```
# Output: 5
print(sqrt(25))
```
```
13 changes: 13 additions & 0 deletions utils/check-for-trailing-whitespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

cd .. || exit
# print first
grep -EHInr '( +)$' ./*

var=$(grep -EHInr '( +)$' ./*)
# then exit with fail if found
if test -z "$var"; then
exit 0
else
exit 1
fi

0 comments on commit e04a24f

Please sign in to comment.