-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sweep (map): Get rid of 'x-hack' such as [ “x$var” = “xval” ] from the code #2
Comments
⚡ Sweep Free Trial: I'm creating this ticket using GPT-4. You have 4 GPT-4 tickets left for the month and 2 for the day. For more GPT-4 tickets, visit our payment portal.
* Install Sweep Configs: [Pull Request](https://github.com//pull/1)
Actions (click)
Step 1: 🔎 SearchingI found the following snippets in your repository. I will now analyze these snippets and come up with a plan. Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.
the-ai-experiments/lib/functions/artifacts/artifact-armbian-bsp-desktop.sh Lines 1 to 105 in 6f5112c
the-ai-experiments/lib/functions/artifacts/artifact-firmware.sh Lines 1 to 96 in 6f5112c
the-ai-experiments/lib/functions/artifacts/artifact-full_firmware.sh Lines 1 to 106 in 6f5112c
Step 2: ⌨️ CodingI'm creating the following subissues: #Replace 'x-hack' conditionals in artifact-armbian-bsp-cli.sh and artifact-firmware.sh: * In lib/functions/artifacts/artifact-armbian-bsp-cli.sh, replace all 'x-hack' conditionals with modern conditionals. * In lib/functions/artifacts/artifact-firmware.sh, replace all 'x-hack' conditionals with modern conditionals. #Replace 'x-hack' conditionals in artifact-armbian-base-files.sh and artifact-uboot.sh: * In lib/functions/artifacts/artifact-armbian-base-files.sh, replace all 'x-hack' conditionals with modern conditionals. * In lib/functions/artifacts/artifact-uboot.sh, replace all 'x-hack' conditionals with modern conditionals. #Replace 'x-hack' conditionals in artifact-rootfs.sh and artifact-kernel.sh: * In lib/functions/artifacts/artifact-rootfs.sh, replace all 'x-hack' conditionals with modern conditionals. * In lib/functions/artifacts/artifact-kernel.sh, replace all 'x-hack' conditionals with modern conditionals. #Replace 'x-hack' conditionals in artifact-full_firmware.sh and artifact-fake-ubuntu-advantage-tools.sh: * In lib/functions/artifacts/artifact-full_firmware.sh, replace all 'x-hack' conditionals with modern conditionals. * In lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh, replace all 'x-hack' conditionals with modern conditionals. #Replace 'x-hack' conditionals in artifact-armbian-zsh.sh and artifact-armbian-plymouth-theme.sh: * In lib/functions/artifacts/artifact-armbian-zsh.sh, replace all 'x-hack' conditionals with modern conditionals. * In lib/functions/artifacts/artifact-armbian-plymouth-theme.sh, replace all 'x-hack' conditionals with modern conditionals. #Replace 'x-hack' conditionals in artifact-armbian-config.sh and artifact-armbian-bsp-desktop.sh: * In lib/functions/artifacts/artifact-armbian-config.sh, replace all 'x-hack' conditionals with modern conditionals. * In lib/functions/artifacts/artifact-armbian-bsp-desktop.sh, replace all 'x-hack' conditionals with modern conditionals. Step 3: 🔁 Code ReviewI finished creating the subissues! Track them at:
🎉 Latest improvements to Sweep:
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. |
x-hack is a shell/bash conditional using any letter (often 'x' thus the 'x-hack' name) followed by variable declaration ${var} and checking against the same letter followed by value such as:
This was done to ensure compatibility across different shells and systems many years ago, but today it's obsolete as the shells evolved enough to be more reliable.
That said the armbian codebase is still using them for some reason and it was agreed that these should be replaced so i want you to look through the codebase and fix all x-hacks.
Note that the declaration can also be written without quotes:
Or even checking for a directory:
Prefer to use e.g.
[ -z "$var" ]
over[ "$var" = "" ]
The following files alll have issues with x-hacks, try to address it
Break the following ~30 files into 6 issues editing 5 files each.
./packages/blobs/grub/09_linux_with_dtb.sh
./packages/bsp/nanopim4/nanopim4-pwm-fan.sh
./lib/tools/shellcheck.sh
./lib/functions/artifacts/artifact-armbian-bsp-cli.sh
./lib/functions/artifacts/artifact-firmware.sh
./lib/functions/rootfs/distro-specific.sh
./lib/functions/artifacts/artifacts-obtain.sh
./lib/functions/artifacts/artifacts-reversion.sh
./lib/functions/artifacts/artifact-uboot.sh
./lib/functions/artifacts/artifact-armbian-base-files.sh
./lib/functions/cli/entrypoint.sh
./lib/functions/artifacts/artifact-rootfs.sh
./lib/functions/artifacts/artifact-kernel.sh
./lib/functions/cli/commands.sh
./lib/functions/artifacts/artifact-full_firmware.sh
./lib/functions/cli/utils-cli.sh
./lib/functions/main/config-prepare.sh
./lib/functions/main/start-end.sh
./lib/functions/artifacts/artifact-fake-ubuntu-advantage-tools.sh
./lib/functions/cli/cli-patch.sh
./lib/functions/artifacts/artifact-armbian-zsh.sh
./lib/functions/rootfs/distro-agnostic.sh
./lib/functions/main/build-packages.sh
./lib/functions/artifacts/artifact-armbian-plymouth-theme.sh
./lib/functions/cli/cli-distccd.sh
./lib/functions/artifacts/artifact-armbian-desktop.sh
./lib/functions/cli/cli-configdump.sh
./lib/functions/artifacts/artifact-armbian-config.sh
./lib/functions/artifacts/artifact-armbian-bsp-desktop.sh
./lib/functions/logging/trap-logging.sh
./lib/functions/logging/traps.sh
./lib/functions/rootfs/create-cache.sh
./lib/functions/rootfs/rootfs-create.sh
./lib/functions/image/partitioning.sh
./lib/functions/image/initrd.sh
./lib/functions/image/rootfs-to-image.sh
./lib/functions/logging/runners.sh
./lib/functions/image/loop.sh
./lib/functions/logging/logging.sh
./lib/functions/logging/export-logs.sh
./lib/functions/logging/debug-dump.sh
./lib/functions/image/compress-checksum.sh
./lib/functions/logging/capture.sh
./lib/functions/host/host-utils.sh
./lib/functions/compilation/kernel-debs.sh
./extensions/grub-sbc-media.sh
./lib/functions/compilation/uboot.sh
./extensions/lsmod.sh
./extensions/nomod.sh
./extensions/nvidia.sh
./extensions/v4l2loopback-dkms.sh
./extensions/zfs.sh
./lib/functions/compilation/utils-compilation.sh
./lib/functions/compilation/kernel-make.sh
./lib/functions/compilation/kernel.sh
./extensions/grub.sh
./lib/functions/general/git-ref2info.sh
./lib/functions/general/apt-utils.sh
./extensions/gen-sample-extension-docs.sh
./lib/functions/general/shellcheck.sh
./lib/functions/general/python-tools.sh
./lib/functions/general/memoize-cached.sh
./lib/functions/general/oci-oras.sh
./lib/functions/compilation/patch/drivers-harness.sh
./lib/functions/general/hash-files.sh
./lib/functions/compilation/packages/utils-dpkgdeb.sh
./lib/functions/compilation/patch/patching.sh
./lib/functions/host/wsl2.sh
./lib/functions/compilation/distcc.sh
./lib/functions/host/prepare-host.sh
./lib/functions/compilation/crust.sh
./lib/functions/general/downloads.sh
./lib/functions/bsp/armbian-bsp-cli-deb.sh
./lib/functions/general/git.sh
./lib/functions/configuration/menu.sh
./lib/functions/host/docker.sh
./lib/functions/configuration/main-config.sh
./lib/functions/host/tmpfs-utils.sh
./lib/functions/host/mktemp-utils.sh
./lib/functions/compilation/atf.sh
./lib/functions/configuration/interactive.sh
./lib/functions/configuration/config-desktop.sh
./lib/functions/compilation/armbian-kernel.sh
./lib/functions/general/chroot-helpers.sh
./lib/functions/general/extensions.sh
./lib/functions/configuration/package-lists.sh
Checklist:
The text was updated successfully, but these errors were encountered: