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

chore(CI): add super-linter to help lint workspace #137

Merged
merged 33 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0f37262
add super-linter to help lint workspace
miraclx Feb 16, 2022
b2af804
add shebang to ci-prep bash script
miraclx Feb 16, 2022
9d97267
separate printf format str from variables
miraclx Feb 16, 2022
1aaa562
use double quote for variable injection
miraclx Feb 16, 2022
86bcdaa
hadolint: ignore two rules
miraclx Feb 16, 2022
4ebfbed
disable editorconfig-checker for README.md
miraclx Feb 16, 2022
e94c964
drop code space
miraclx Feb 16, 2022
a571af4
selectively disable editorconfig-checker in README.md
miraclx Feb 16, 2022
1316690
remove trailing whitespace
miraclx Feb 16, 2022
3354bb8
use the eslintrc config when CI linting
miraclx Feb 16, 2022
3b12ffa
disable linting js with standard linter
miraclx Feb 16, 2022
19006e6
ignore code duplication in CI tests.yml
miraclx Feb 16, 2022
82fdb83
ignore code duplication
miraclx Feb 16, 2022
2b9f9e3
Merge branch 'master' into workspace-linting
miraclx Feb 16, 2022
d4c9bdc
remove code duplication
miraclx Feb 16, 2022
956e907
textlint: disable report of false positive
miraclx Feb 16, 2022
06e4aac
apply shfmt hints
miraclx Feb 16, 2022
a4420a3
apply yamllint suggestions
miraclx Feb 16, 2022
2942e5e
Merge branch 'master' into workspace-linting
miraclx Feb 16, 2022
274f589
chown +x ci-prep.sh
miraclx Feb 16, 2022
9f3dae4
touch hadolint ignores
miraclx Feb 16, 2022
db20afb
fix editorconfig spacing
miraclx Feb 16, 2022
0349b4b
jscpd: properly ignore tests.yml
miraclx Feb 16, 2022
cf4560e
test installing dependencies before lint check
miraclx Feb 16, 2022
575b7c7
textlint: apply hints
miraclx Feb 16, 2022
1f7d553
link eslint config into linters folder
miraclx Feb 16, 2022
03363cd
symlink to eslintrc
miraclx Feb 16, 2022
6a400b2
eslint: ignore json files
miraclx Feb 16, 2022
310a4d1
move eslint-parser to dev-dependencies
miraclx Feb 16, 2022
0716cbc
fix eslint ignorePatterns
miraclx Feb 16, 2022
90be47b
drop symlink to appease jscpd
miraclx Feb 16, 2022
b559e99
skip glob none-or-one
miraclx Feb 16, 2022
10f358a
lint changes introduced in each PR only
miraclx Feb 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"plugins": [
"prettier"
],
"ignorePatterns": [
"**/*.json",
"**/*.json5"
],
"rules": {
"prettier/prettier": [
1,
Expand Down
5 changes: 4 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
custom: ['https://commerce.coinbase.com/checkout/466d703a-fbd7-41c9-8366-9bdd3e240755']
---

custom:
- https://commerce.coinbase.com/checkout/466d703a-fbd7-41c9-8366-9bdd3e240755
ko_fi: miraclx
liberapay: miraclx
patreon: miraclx
10 changes: 10 additions & 0 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"threshold": 0,
"reporters": [
"consoleFull"
],
"ignore": [
"**/.github/workflows/tests.yml"
],
"absolute": true
}
18 changes: 10 additions & 8 deletions .github/workflows/ci-prep.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env bash

RG_SRC="$(which rg)"
rg() {
printf "rg: pattern: /$*/" > /dev/stderr
printf 'rg: pattern: %s' "/$*/" >/dev/stderr
if $RG_SRC --fixed-strings --passthru "$@"; then
echo " (matched)" > /dev/stderr
echo " (matched)" >/dev/stderr
else
echo " (failed to match)" > /dev/stderr
echo " (failed to match)" >/dev/stderr
return 1
fi
}
Expand All @@ -16,7 +18,7 @@ freyr() {
i=$($RG_SRC -n '.' .freyr_log | $RG_SRC --fixed-strings '[•] Embedding Metadata' | cut -d':' -f1)
if [[ $i ]]; then
echo "::group::[$attempts/3] View Download Status"
tail +$i .freyr_log
tail +"$i" .freyr_log
echo "::endgroup::"
fi
}
Expand All @@ -25,9 +27,9 @@ exec_retry() {
cmd="$(cat)" && attempts=1
until eval "$cmd"; do
echo "::endgroup::"
if (( attempts < 3 )); then
if ((attempts < 3)); then
echo "::warning::[$attempts/3] Download failed, retrying.."
: $(( attempts += 1 ))
: $((attempts += 1))
else
echo "::error::[$attempts/3] Download failed."
return 1
Expand All @@ -36,7 +38,7 @@ exec_retry() {
echo "::endgroup::"
echo "::group::View Files"
STAGE=$(realpath --relative-to=../.. .) && cd ../..
tree -sh $STAGE
tree -sh "$STAGE"
echo "::endgroup::"
}

Expand All @@ -45,5 +47,5 @@ validate() {
res=$(<.freyr_log)
for arg in "[•] Collation Complete" "$@"; do
res=$(echo "$res" | rg "$arg") || return 1
done > /dev/null
done >/dev/null
}
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: publish

on:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: tests

on:
Expand Down Expand Up @@ -238,3 +239,28 @@ jobs:

- name: Test Docker Build
run: docker build -t freyrcli/freyrjs .

linter:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

- name: Install Dependencies
run: npm ci

- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

LINTER_RULES_PATH: /
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc
JSCPD_CONFIG_FILE: .github/linters/.jscpd.json
VALIDATE_JAVASCRIPT_STANDARD: false
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ LABEL maintainer="Miraculous Owonubi <omiraculous@gmail.com>" \
tag="alpine"

# Install dependencies and clean cache
# hadolint ignore=DL3018
RUN apk add \
--no-cache \
git \
Expand All @@ -26,6 +27,7 @@ RUN mkdir /bins \
ENV PATH "/bins:$PATH"

# Create freyr user and group
# hadolint ignore=DL4006
RUN addgroup -g 1000 freyr \
&& adduser -DG freyr freyr \
&& echo freyr:freyr | chpasswd
Expand Down
Loading