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

add shellcheck and fix complaints #412

Merged
merged 1 commit into from
May 8, 2023

Conversation

tuminoid
Copy link
Member

@tuminoid tuminoid commented Apr 5, 2023

Add shellcheck. Fix all the shellcheck complaints, and make shell code consistent Bash.

Another PR in project-infra will activate the check for PRs.

Markdownlint is separated to its own PR #413

@metal3-io-bot metal3-io-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 5, 2023
@tuminoid
Copy link
Member Author

tuminoid commented Apr 5, 2023

/test-ubuntu-integration-main

kashifest
kashifest previously approved these changes Apr 5, 2023
prepare-efi.sh Outdated Show resolved Hide resolved
prepare-image.sh Outdated Show resolved Hide resolved
prepare-image.sh Outdated Show resolved Hide resolved
prepare-image.sh Outdated Show resolved Hide resolved
@tuminoid
Copy link
Member Author

tuminoid commented Apr 5, 2023

/test-ubuntu-integration-main

@tuminoid
Copy link
Member Author

tuminoid commented Apr 5, 2023

/test-centos-integration-main-ironic-source

@elfosardo
Copy link
Member

/approve

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 5, 2023
Copy link
Member

@dtantsur dtantsur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely like the markdown verification, but the diff in the scripts seems mostly useless. There is no point to enforce ${variables} over $variables except that in a few cases.

Landing this will also turn our life downstream into a nightmare, because no backports will apply cleanly (if you do backporting, you'll have the same problem too).

patch-image.sh Outdated Show resolved Hide resolved
scripts/configure-httpd-ipa.sh Outdated Show resolved Hide resolved
@tuminoid
Copy link
Member Author

tuminoid commented Apr 5, 2023

I absolutely like the markdown verification, but the diff in the scripts seems mostly useless. There is no point to enforce ${variables} over $variables except that in a few cases.

I'm just trying to be consistent here. Currently the scripts are completely mixed use. It makes it much more readable as well, making it immediately clear that you're dealing with a variable. Quoting: https://google.github.io/styleguide/shellguide.html for example on variable expansion: In order of precedence: Stay consistent with what you find; quote your variables; prefer "${var}" over "$var".

Landing this will also turn our life downstream into a nightmare, because no backports will apply cleanly (if you do backporting, you'll have the same problem too).

I have no visibiility into your internal development practices, and in this repo there are no branches. I'm trying to have all repositories under metal3-io to have consistent coding style, basic quality checks in place etc so they are in the long run easier to maintain, developers have safety nets in place and faster feedback cycle.

If you feel this change is not worth of merging or causes too much trouble for you, then it is your right to decline it, but I'd hope the opposite, that you possibly take this into your backports, and after that there is no more conflicts. But like I said, I got no idea what your setup looks like and if that is feasible.

@dtantsur
Copy link
Member

dtantsur commented Apr 5, 2023

The Google style guide is pretty opinionated and may not reflect how most people write scripts. Nor does it reflect the intention of $ vs ${}, which is: ${} is used when the variable name is followed by characters that are valid in a variable name, e.g. ${foo}_bar (cannot be $foo_bar).

UPD: note that you're violating their first rule:

Stay consistent with what you find

@tuminoid
Copy link
Member Author

tuminoid commented Apr 5, 2023

Stay consistent with what you find

There is no consistency like I said already, so nothing to stick by.

@tuminoid
Copy link
Member Author

tuminoid commented Apr 5, 2023

/hold

Holding this so it doesn't get merged by drive-by lgtm. @elfosardo and @dtantsur please settle if you are willing to take this in. I'm happy to make adjustments if required, but as stated before, I'm going for consistency, maintainability and readability, preferably organization wide. If this does not work for you, I can drop this, and you can implement it in a way that works for you.

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 5, 2023
@tuminoid
Copy link
Member Author

tuminoid commented Apr 6, 2023

/test-ubuntu-integration-main
/test-centos-integration-main-ironic-source

@tuminoid
Copy link
Member Author

tuminoid commented Apr 6, 2023

/test-ubuntu-integration-main
/test-centos-integration-main-ironic-source

@tuminoid
Copy link
Member Author

@dtantsur @elfosardo Its been a week. Have you guys discussed this?

@tuminoid
Copy link
Member Author

@dtantsur @elfosardo Its been a week. Have you guys discussed this?

It's now been two weeks. Can you guys discuss your mutual stance on this?

The question in the end is rather simple: Do you want to take the PR in or not? We have bunch of shell code that is a bit messy, not linted, not consistent. We have here PR cleaning it up for you, maybe a bit opinionated PR but guess what, most of the languages/ecossytems have rather opinionated best practices/style guides these days (gofmt, prettier, k8s and so on), because its effective. They're easy for anyone to work in, you can automate your editors and your CI.

I have no visibiility into your internal development practices, and in this repo there are no branches. I'm trying to have all repositories under metal3-io to have consistent coding style, basic quality checks in place etc so they are in the long run easier to maintain, developers have safety nets in place and faster feedback cycle.

If you feel this change is not worth of merging or causes too much trouble for you, then it is your right to decline it, but I'd hope the opposite, that you possibly take this into your backports, and after that there is no more conflicts. But like I said, I got no idea what your setup looks like and if that is feasible.

This still stands as well.

@tuminoid tuminoid changed the title add basic linters add shellcheck and fix complaints Apr 25, 2023
@tuminoid
Copy link
Member Author

Separated markdownlint to #413 and not held back by shellcheck discussion.

@tuminoid
Copy link
Member Author

/test-ubuntu-integration-main

@elfosardo
Copy link
Member

/test-centos-integration-main-ironic-source

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 27, 2023
@tuminoid
Copy link
Member Author

Took away all curly brace changes etc. @dtantsur PTAL.

/test-ubuntu-integration-main

@tuminoid
Copy link
Member Author

/test-centos-integration-main-ironic-source

@tuminoid
Copy link
Member Author

/test-centos-integration-main-ironic-source
/test-ubuntu-integration-main

@tuminoid
Copy link
Member Author

/test-centos-integration-main-ironic-source
/test-ubuntu-integration-main

@dtantsur
Copy link
Member

dtantsur commented May 2, 2023

Much better, thanks! I'm not a fan of some changes, but I understand the consistency argument here. Just one question inline.

Add shellcheck. Fix all the shellcheck complaints.

Another PR in project-infra will activate the check for PRs.
@tuminoid
Copy link
Member Author

tuminoid commented May 4, 2023

I took some more unnecessary changes off, and I think I addressed all comments.

/test-centos-integration-main-ironic-source
/test-ubuntu-integration-main

@tuminoid
Copy link
Member Author

tuminoid commented May 4, 2023

/unhold

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2023
@tuminoid
Copy link
Member Author

tuminoid commented May 4, 2023

Cleura is busted but one more try for today.

/test-centos-integration-main-ironic-source
/test-ubuntu-integration-main

@tuminoid
Copy link
Member Author

tuminoid commented May 5, 2023

/cc @dtantsur

Good for LGTM now?

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label May 8, 2023
@tuminoid
Copy link
Member Author

tuminoid commented May 8, 2023

@dtantsur can you PTAL and remove changes requested so we can merge this? All comments should be addressed now.

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtantsur, elfosardo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot merged commit 9186441 into metal3-io:main May 8, 2023
@tuminoid tuminoid deleted the tuomo/add-basic-linters branch May 8, 2023 09:43
elfosardo pushed a commit to elfosardo/ironic-image that referenced this pull request Nov 16, 2023
METAL-726: Update packages for OCP 4.15 and pin ironic versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants