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

Bad indentation when run-tests-coverage.sh #23

Closed
KEINOS opened this issue Mar 3, 2021 · 1 comment
Closed

Bad indentation when run-tests-coverage.sh #23

KEINOS opened this issue Mar 3, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@KEINOS
Copy link
Owner

KEINOS commented Mar 3, 2021

$ ./.github/run-tests-coverage.sh
* Running in regular mode. Use "-v" or "--verbose" option for verbose output.
* Moving current path to: /workspaces/QiiTask
* Current path is: /workspaces/QiiTask

- Static analysys: Scanning all the packages

  Success! All Go vet static analysis passed.

- Unit test: Testing all the packages
        ok      github.com/Qithub-BOT/QiiTask   0.004s  coverage: 100.0% of statements
        ok      github.com/Qithub-BOT/QiiTask/cmdlist   0.009s  coverage: 100.0% of statements
        ok      github.com/Qithub-BOT/QiiTask/cmdsort   0.004s  coverage: 100.0% of statements
        ok      github.com/Qithub-BOT/QiiTask/config    0.093s  coverage: 100.0% of statements
        --- FAIL: ExampleFmtAsAbout (0.00s)
        got:
        About:
        A longer description that spans multiple
        lines and likely
        contains examples and usage of using your command.
        want:
        About:
        A longer description that spans multiple
        lines and likely
        contains examples and usage of using your command.
        FAIL
        coverage: 100.0% of statements
        FAIL    github.com/Qithub-BOT/QiiTask/utils     0.004s
        FAIL

The above got: contents and want: contents contain spaces before each line. But it seems to be trimmed.

@KEINOS
Copy link
Owner Author

KEINOS commented Mar 3, 2021

It is missing the IFS= to clear the white spaces list.

 function indentStdIn() { 
     indent="\t" 
-    while read -r line; do 
+    while IFS= read -r line; do 
         echo -e "${indent}${line}" 
     done 
     echo 
 } 
  • Wrong indent

# indentStdIn indents the STDIN given to the function
function indentStdIn() {
indent="\t"
while read -r line; do
echo -e "${indent}${line}"
done
echo
}

  • Right indent

function indentStdIn() {
indent="\t"
while IFS= read -r line; do
echo -e "${indent}${line}"
done
echo
}

@KEINOS KEINOS added the enhancement New feature or request label Mar 3, 2021
KEINOS added a commit that referenced this issue Nov 23, 2021
@KEINOS KEINOS closed this as completed in 3407f11 Nov 26, 2021
KEINOS added a commit that referenced this issue Nov 26, 2021
## Feat

Totally refactored (simpler source structure)

* feat: new Docker image (more secure and light weight. Debian -> Alpine)
* feat: codeQL-analysis.yml
* feat: auto mod updater (auto PR on go.mod update)
* feat: auto merge on go.mod update only (via mergify)
* feat: include go.sum

## Fix

* fix: #23 bad indentation
* fix: golangci-lint warnings
* fix: use latest goclangci-lint for lint check
* fix: mergify.yml (deprecated "strict" config)
* fix: redundant checks (only on push to main)
* fix: remove bin directory

## Chore

* Update platform-test.yaml
* Update golangci-lint.yaml
* Update version-tests.yaml

---

Closing #23
Closing #24
KEINOS added a commit that referenced this issue Nov 26, 2021
## Feat

Totally refactored (simpler source structure)

* feat: new Docker image (more secure and light weight. Debian -> Alpine)
* feat: codeQL-analysis.yml
* feat: auto mod updater (auto PR on go.mod update)
* feat: auto merge on go.mod update only (via mergify)
* feat: include go.sum

## Fix

* fix: #23 bad indentation
* fix: golangci-lint warnings
* fix: use latest goclangci-lint for lint check
* fix: mergify.yml (deprecated "strict" config)
* fix: redundant checks (only on push to main)
* fix: remove bin directory

## Chore

* Update platform-test.yaml
* Update golangci-lint.yaml
* Update version-tests.yaml

---

Closing #23
Closing #24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant