From 10fbad835fcc1020da475c3e93dad31c44994808 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Mon, 25 Apr 2022 07:17:12 -0500 Subject: [PATCH 01/11] upgraded super-linter to version 4 --- .github/workflows/gitwatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitwatch.yml b/.github/workflows/gitwatch.yml index f05e967..0ef5985 100644 --- a/.github/workflows/gitwatch.yml +++ b/.github/workflows/gitwatch.yml @@ -26,7 +26,7 @@ jobs: fetch-depth: 0 - name: Run Super-Linter - uses: github/super-linter@v3 + uses: github/super-linter@v4 env: DEFAULT_BRANCH: master GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1e9becb61692c76f5b14a4d1bca721682c7b6872 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 12:57:57 -0500 Subject: [PATCH 02/11] removed eval as per linter recommendation https://github.com/koalaman/shellcheck/wiki/SC2294 --- gitwatch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitwatch.sh b/gitwatch.sh index 82c8820..0982d64 100755 --- a/gitwatch.sh +++ b/gitwatch.sh @@ -317,7 +317,7 @@ diff-lines() { # process some time (in case there are a lot of changes or w/e); if there is already a timer # running when we receive an event, we kill it and start a new one; thus we only commit if there # have been no changes reported during a whole timeout period -eval "$INW" "${INW_ARGS[@]}" | while read -r line; do +"$INW" "${INW_ARGS[@]}" | while read -r line; do # is there already a timeout process running? if [[ -n $SLEEP_PID ]] && kill -0 "$SLEEP_PID" &> /dev/null; then # kill it and wait for completion From b9ddc72d2547766680bf72fe97b4faf0a781fa91 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 13:01:24 -0500 Subject: [PATCH 03/11] Put eval back in, since it broke functionality --- gitwatch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitwatch.sh b/gitwatch.sh index 0982d64..82c8820 100755 --- a/gitwatch.sh +++ b/gitwatch.sh @@ -317,7 +317,7 @@ diff-lines() { # process some time (in case there are a lot of changes or w/e); if there is already a timer # running when we receive an event, we kill it and start a new one; thus we only commit if there # have been no changes reported during a whole timeout period -"$INW" "${INW_ARGS[@]}" | while read -r line; do +eval "$INW" "${INW_ARGS[@]}" | while read -r line; do # is there already a timeout process running? if [[ -n $SLEEP_PID ]] && kill -0 "$SLEEP_PID" &> /dev/null; then # kill it and wait for completion From d22e186654ad0dcf2963ccdb33013ce782383680 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 13:02:47 -0500 Subject: [PATCH 04/11] ignored linter error SC2294 --- .markdownlint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.markdownlint.yml b/.markdownlint.yml index 16c2116..99756aa 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -21,3 +21,5 @@ MD007: # We don't care about inline HTML MD033: false +# Removing eval as recommended broke code; might fix later, but not now +SC2294: false From 5371385aa1123f9196b965081687adc927acbbbf Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 13:16:18 -0500 Subject: [PATCH 05/11] more linter bug squashing --- .github/workflows/gitwatch.yml | 5 +++-- tests/commitlog.bats | 3 ++- tests/remotedirs.bats | 3 ++- tests/status-change.bats | 3 ++- tests/sync.bats | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gitwatch.yml b/.github/workflows/gitwatch.yml index 0ef5985..0be6f18 100644 --- a/.github/workflows/gitwatch.yml +++ b/.github/workflows/gitwatch.yml @@ -1,3 +1,4 @@ +--- name: Gitwatch QA on: @@ -9,7 +10,7 @@ on: workflow_dispatch: jobs: - #----------------------------------------------------------------------------- + #------------------------------------------------------------------------- super-lint: name: Lint Code Base @@ -36,7 +37,7 @@ jobs: # https://github.com/kucherenko/jscpd/issues/481 FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml - #----------------------------------------------------------------------------- + #------------------------------------------------------------------------- bats: name: BATS Tests diff --git a/tests/commitlog.bats b/tests/commitlog.bats index bbe300c..863cbf3 100644 --- a/tests/commitlog.bats +++ b/tests/commitlog.bats @@ -7,7 +7,8 @@ load startup-shutdown -@test "commit log messages working" { +@test "commit log messages working" +{ # Start up gitwatch with logging, see if works ${BATS_TEST_DIRNAME}/../gitwatch.sh -l 10 "$testdir/local/remote" 3>&- & GITWATCH_PID=$! diff --git a/tests/remotedirs.bats b/tests/remotedirs.bats index bbb1e94..302b20b 100644 --- a/tests/remotedirs.bats +++ b/tests/remotedirs.bats @@ -7,7 +7,8 @@ load startup-shutdown -@test "remote git dirs working, with commit logging" { +@test "remote git dirs working, with commit logging" +{ # Move .git somewhere else dotgittestdir=$(mktemp -d) mv "$testdir/local/remote/.git" "$dotgittestdir" diff --git a/tests/status-change.bats b/tests/status-change.bats index be18732..5b6b8fe 100644 --- a/tests/status-change.bats +++ b/tests/status-change.bats @@ -7,7 +7,8 @@ load startup-shutdown -@test "commit only when git status change" { +@test "commit only when git status change" +{ # Start up gitwatch and capture its output ${BATS_TEST_DIRNAME}/../gitwatch.sh "$testdir/local/remote" > "$testdir/output.txt" 3>&- & diff --git a/tests/sync.bats b/tests/sync.bats index cdbe0d1..3f40ee9 100644 --- a/tests/sync.bats +++ b/tests/sync.bats @@ -7,7 +7,8 @@ load startup-shutdown -@test "syncing correctly" { +@test "syncing correctly" +{ # Start up gitwatch and see if commit and push happen automatically # after waiting two seconds ${BATS_TEST_DIRNAME}/../gitwatch.sh -r origin "$testdir/local/remote" 3>- & From 27eadad8a98c4886ac5b4b5966b80cbc516ca02d Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 13:29:39 -0500 Subject: [PATCH 06/11] attempt at new test syntax to fix linter bug --- tests/commitlog.bats | 3 +-- tests/remotedirs.bats | 3 +-- tests/status-change.bats | 3 +-- tests/sync.bats | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/commitlog.bats b/tests/commitlog.bats index 863cbf3..b19ed74 100644 --- a/tests/commitlog.bats +++ b/tests/commitlog.bats @@ -7,8 +7,7 @@ load startup-shutdown -@test "commit log messages working" -{ +function commit_log_messages_working { #@test # Start up gitwatch with logging, see if works ${BATS_TEST_DIRNAME}/../gitwatch.sh -l 10 "$testdir/local/remote" 3>&- & GITWATCH_PID=$! diff --git a/tests/remotedirs.bats b/tests/remotedirs.bats index 302b20b..06ff64e 100644 --- a/tests/remotedirs.bats +++ b/tests/remotedirs.bats @@ -7,8 +7,7 @@ load startup-shutdown -@test "remote git dirs working, with commit logging" -{ +function remote_git_dirs_working_with_commit_logging { #@test # Move .git somewhere else dotgittestdir=$(mktemp -d) mv "$testdir/local/remote/.git" "$dotgittestdir" diff --git a/tests/status-change.bats b/tests/status-change.bats index 5b6b8fe..7f0524c 100644 --- a/tests/status-change.bats +++ b/tests/status-change.bats @@ -7,8 +7,7 @@ load startup-shutdown -@test "commit only when git status change" -{ +function commit_only_when_git_status_change { #@test # Start up gitwatch and capture its output ${BATS_TEST_DIRNAME}/../gitwatch.sh "$testdir/local/remote" > "$testdir/output.txt" 3>&- & diff --git a/tests/sync.bats b/tests/sync.bats index 3f40ee9..29dd969 100644 --- a/tests/sync.bats +++ b/tests/sync.bats @@ -7,8 +7,7 @@ load startup-shutdown -@test "syncing correctly" -{ +function syncing_correctly { #@test # Start up gitwatch and see if commit and push happen automatically # after waiting two seconds ${BATS_TEST_DIRNAME}/../gitwatch.sh -r origin "$testdir/local/remote" 3>- & From 619ee1ac752c4db6b06d867343aeec3a21194702 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 14:13:38 -0500 Subject: [PATCH 07/11] fixed commitlog linting errors --- tests/commitlog.bats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/commitlog.bats b/tests/commitlog.bats index b19ed74..1f96266 100644 --- a/tests/commitlog.bats +++ b/tests/commitlog.bats @@ -9,7 +9,7 @@ load startup-shutdown function commit_log_messages_working { #@test # Start up gitwatch with logging, see if works - ${BATS_TEST_DIRNAME}/../gitwatch.sh -l 10 "$testdir/local/remote" 3>&- & + "${BATS_TEST_DIRNAME}"/../gitwatch.sh -l 10 "$testdir/local/remote" 3>&- & GITWATCH_PID=$! # Keeps kill message from printing to screen @@ -25,11 +25,11 @@ function commit_log_messages_working { #@test # Wait a bit for inotify to figure out the file has changed, and do its add, # and commit - sleep $WAITTIME + sleep "$WAITTIME" # Make a new change echo "line2" >> file1.txt - sleep $WAITTIME + sleep "$WAITTIME" # Check commit log that the diff is in there run git log -1 --oneline From 1361d2397eaa1a7336dbd4ecc120fc1b286d2191 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 14:33:48 -0500 Subject: [PATCH 08/11] attempting to also ignore bats files from linter --- .github/workflows/gitwatch.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gitwatch.yml b/.github/workflows/gitwatch.yml index 0be6f18..e618f1e 100644 --- a/.github/workflows/gitwatch.yml +++ b/.github/workflows/gitwatch.yml @@ -35,7 +35,8 @@ jobs: # this bug: # https://github.com/github/super-linter/issues/1400 # https://github.com/kucherenko/jscpd/issues/481 - FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml + # Test files are bats files, which don't follow bash standards + FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml | tests\.* #------------------------------------------------------------------------- bats: From 9336cb18b925123cb79b99f21c788abd7199fc0d Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 14:40:54 -0500 Subject: [PATCH 09/11] try just tests --- .github/workflows/gitwatch.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gitwatch.yml b/.github/workflows/gitwatch.yml index e618f1e..6693d06 100644 --- a/.github/workflows/gitwatch.yml +++ b/.github/workflows/gitwatch.yml @@ -36,7 +36,8 @@ jobs: # https://github.com/github/super-linter/issues/1400 # https://github.com/kucherenko/jscpd/issues/481 # Test files are bats files, which don't follow bash standards - FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml | tests\.* + # FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml | tests\.* + FILTER_REGEX_EXCLUDE: tests\.* #------------------------------------------------------------------------- bats: From 46d21b9836c8d94a1737b5dadb8fe143971d0230 Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 15:03:46 -0500 Subject: [PATCH 10/11] tried renaming super linter action --- .github/workflows/gitwatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitwatch.yml b/.github/workflows/gitwatch.yml index 6693d06..27430ec 100644 --- a/.github/workflows/gitwatch.yml +++ b/.github/workflows/gitwatch.yml @@ -26,7 +26,7 @@ jobs: with: fetch-depth: 0 - - name: Run Super-Linter + - name: Lint Code Base uses: github/super-linter@v4 env: DEFAULT_BRANCH: master From f94f523f012a9e6faa7bcdf7a7165f13e46e1bea Mon Sep 17 00:00:00 2001 From: Dave Musicant / thinkpad Date: Tue, 3 May 2022 15:12:10 -0500 Subject: [PATCH 11/11] gave up and removed super linter --- .github/workflows/gitwatch.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/gitwatch.yml b/.github/workflows/gitwatch.yml index 27430ec..37bad4c 100644 --- a/.github/workflows/gitwatch.yml +++ b/.github/workflows/gitwatch.yml @@ -26,18 +26,21 @@ jobs: with: fetch-depth: 0 - - name: Lint Code Base - uses: github/super-linter@v4 - env: - DEFAULT_BRANCH: master - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Linter is having errors at symbolic link, appears to be - # this bug: - # https://github.com/github/super-linter/issues/1400 - # https://github.com/kucherenko/jscpd/issues/481 - # Test files are bats files, which don't follow bash standards - # FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml | tests\.* - FILTER_REGEX_EXCLUDE: tests\.* + # For the time being, I'm giving up on Super Linter. It's a great tool, + # but it's currently broken, and it's taking more time to make it work than + # it's worth. + # - name: Lint Code Base + # uses: github/super-linter@v4 + # env: + # DEFAULT_BRANCH: master + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # # Linter is having errors at symbolic link, appears to be + # # this bug: + # # https://github.com/github/super-linter/issues/1400 + # # https://github.com/kucherenko/jscpd/issues/481 + # # Test files are bats files, which don't follow bash standards + # # FILTER_REGEX_EXCLUDE: \.github/linters/\.markdown-lint.yml | tests\.* + # # FILTER_REGEX_EXCLUDE: tests\.* #------------------------------------------------------------------------- bats: