Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
electrocucaracha committed Dec 26, 2024
1 parent 87f4f88 commit da83e20
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 30 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[*.sh]
indent_style = space
indent_size = 4

[spec/**]
ignore = true

[.tox/**]
ignore = true
1 change: 1 addition & 0 deletions .github/actions/vagrant-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
name: Vagrant setup
description: Configures the Vagrant requirements
inputs:
distro:
description: Linux distribution
Expand Down
1 change: 1 addition & 0 deletions .github/actions/vagrant-up/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
name: Vagrant up
description: Creates a Vagrant Virtual Machine
inputs:
memory:
description: "Memory"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/diagram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- codebase-structure.svg
- .github/
workflow_dispatch:
permissions: read-all
jobs:
check-diagram:
name: Update the codebase structure diagram
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/distros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
permissions: read-all
jobs:
check-versions:
runs-on: vm-self-hosted
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ name: Lint Code Base
on:
push:
pull_request:
permissions: read-all
jobs:
get-sloc:
name: Count Lines of Code
Expand Down Expand Up @@ -43,6 +44,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
VALIDATE_SHELL_SHFMT: false
EDITORCONFIG_FILE_NAME: .editorconfig
check-tox:
name: Check syntax (tox)
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on-demand_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
types:
- submitted
workflow_dispatch:
permissions: read-all
jobs:
changes:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ name: Automatic Rebase
on:
issue_comment:
types: [created]
permissions: read-all
jobs:
rebase:
name: Rebase
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scheduled_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
schedule:
- cron: "0 0 * * 5"
workflow_dispatch:
permissions: read-all
jobs:
check-ubuntu-jammy-baremetal:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/spell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
pull_request_review:
types:
- submitted
permissions: read-all
jobs:
check-reviewdog:
name: Check spelling (reviewdog)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
schedule:
- cron: "0 0 * * 5"
workflow_dispatch:
permissions: read-all
jobs:
check-versions:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ lint:
sudo -E $(DOCKER_CMD) run --rm -v $$(pwd):/tmp/lint \
-e RUN_LOCAL=true \
-e LINTER_RULES_PATH=/ \
github/super-linter
-e VALIDATE_SHELL_SHFMT=false \
-e EDITORCONFIG_FILE_NAME=.editorconfig \
ghcr.io/super-linter/super-linter
tox -e lint

.PHONY: fmt
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ coding, documenting, testing, spreading the word at events within others.
Thanks to all the people who already contributed!

<a href="https://github.com/electrocucaracha/bootstrap-vagrant/graphs/contributors">
<img src="https://contrib.rocks/image?repo=electrocucaracha/bootstrap-vagrant" />
<img src="https://contrib.rocks/image?repo=electrocucaracha/bootstrap-vagrant" alt="Contributors" />
</a>

![Visualization of the codebase](./codebase-structure.svg)
Expand Down
2 changes: 2 additions & 0 deletions ci/update_distros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ function _vagrant_pull {
msg+="$name($version, $PROVIDER) box doesn't exist\n"
return
fi
# editorconfig-checker-disable
cat <<EOT >>.distros_supported.yml
- alias: $alias
name: $name
version: "$version"
EOT
# editorconfig-checker-enable
}

if ! command -v vagrant >/dev/null; then
Expand Down
56 changes: 28 additions & 28 deletions spec/setup_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@
##############################################################################

Describe 'setup.sh'
Include setup.sh
Include setup.sh

Describe '_vercmp()'
Parameters
'1.1.1' '==' '1.1.1' success
'1.1.1' '==' '1.1.0' failure
'1.1.0' '<' '1.1.1' success
'1.1.1' '<' '1.1.0' failure
'1.1.1' '<' '1.1.1' failure
'1.1.1' '<=' '1.1.1' success
'1.1.0' '<=' '1.1.1' success
'1.1.1' '<=' '1.1.0' failure
'1.1.1' '>' '1.1.0' success
'1.1.0' '>' '1.1.1' failure
'1.1.1' '>' '1.1.1' failure
'1.1.1' '>=' '1.1.0' success
'1.1.1' '>=' '1.1.1' success
'1.1.0' '>=' '1.1.1' failure
End
It 'performs comparation'
When call _vercmp "$1" "$2" "$3"
The status should be "$4"
End
It 'raises error when specified an invalid operator'
When run _vercmp '1.0.0' '!=' '2.0.0'
The stdout should equal "unrecognised op: !="
The status should be failure
End
End
Describe '_vercmp()'
Parameters
'1.1.1' '==' '1.1.1' success
'1.1.1' '==' '1.1.0' failure
'1.1.0' '<' '1.1.1' success
'1.1.1' '<' '1.1.0' failure
'1.1.1' '<' '1.1.1' failure
'1.1.1' '<=' '1.1.1' success
'1.1.0' '<=' '1.1.1' success
'1.1.1' '<=' '1.1.0' failure
'1.1.1' '>' '1.1.0' success
'1.1.0' '>' '1.1.1' failure
'1.1.1' '>' '1.1.1' failure
'1.1.1' '>=' '1.1.0' success
'1.1.1' '>=' '1.1.1' success
'1.1.0' '>=' '1.1.1' failure
End
It 'performs comparation'
When call _vercmp "$1" "$2" "$3"
The status should be "$4"
End
It 'raises error when specified an invalid operator'
When run _vercmp '1.0.0' '!=' '2.0.0'
The stdout should equal "unrecognised op: !="
The status should be failure
End
End
End
2 changes: 2 additions & 0 deletions validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export VAGRANT_DEFAULT_PROVIDER

info "Validating Vagrant operation"
pushd "$(mktemp -d)"
# editorconfig-checker-disable
cat <<EOT >vagrant_file.erb
Vagrant.configure("2") do |config|
config.vm.box = "<%= box_name %>"
Expand All @@ -95,6 +96,7 @@ Vagrant.configure("2") do |config|
end
end
EOT
# editorconfig-checker-enable
vagrant init generic/alpine316 --box-version 3.5.0 --template vagrant_file.erb
vagrant up || :
vagrant halt
Expand Down

0 comments on commit da83e20

Please sign in to comment.