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

[INFRA] Enable shellcheck on CI #4078

Closed
wants to merge 19 commits into from

Conversation

davidyuan1223
Copy link
Contributor

@davidyuan1223 davidyuan1223 commented Jan 4, 2023

Why are the changes needed?

Fix #2062

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before make a pull request

@github-actions github-actions bot added kind:build kind:deploy kind:infra license, community building, project builds, asf infra related, etc. module:kubernetes module:server labels Jan 4, 2023
@@ -100,3 +100,12 @@ jobs:
echo "If there is a problem that cannot be fixed by the command, "
echo "you need to manually fix it by following the information told by the command above"
echo "---------------------------------------------------------------------------------"
shellcheck:
Copy link
Member

Choose a reason for hiding this comment

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

please add a new line before it.

@@ -227,6 +227,7 @@ Examples:
EOF
}

# shellcheck disable=SC2199
Copy link
Member

Choose a reason for hiding this comment

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

this is an acceptable approach, we can disable the check first, and fix them one by one in the future. (if the fix is simple, it's fine to fix in place in this PR as well)

@@ -48,6 +49,7 @@ function kyuubi_rotate_log() {
num=${KYUUBI_MAX_LOG_FILES}
else
echo "Error: KYUUBI_MAX_LOG_FILES must be a positive number, but got ${KYUUBI_MAX_LOG_FILES}"
# shellcheck disable=SC2242
exit -1
Copy link
Member

Choose a reason for hiding this comment

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

this can be fixed in place, we just need to return a no-zero value here, 1 should be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually I try this in my fork project, the shell script has many grammar mistake, so I use #shellcheck jump that, I want fix these bug in issue #4057 before do this shellcheck

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you think about this idea

Copy link
Member

Choose a reason for hiding this comment

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

the shell script has many grammar mistake

the shell script grammar is flexible; some are style issues, and should not be treated as bug/mistake, because they have worked as expected.

... fix these bug in issue #4057 before do this shellcheck

w/o shellcheck, how to verify the fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

en, I think I can fix some grammar mistake, then other problems we can use # to ignore them

Copy link
Member

Choose a reason for hiding this comment

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

sgtm

@pan3793 pan3793 changed the title Fix #2062 [INFRA] Enable shellcheck on CI Jan 5, 2023
@pan3793 pan3793 added this to the v1.7.0 milestone Jan 5, 2023
@pan3793 pan3793 closed this in 2dac364 Jan 5, 2023
@pan3793
Copy link
Member

pan3793 commented Jan 5, 2023

Thanks, merged to master

@davidyuan1223
Copy link
Contributor Author

I'm pleasure that

@pan3793
Copy link
Member

pan3793 commented Jan 6, 2023

@xiaoyuandajian I just noticed that[1]

ludeeus/action-shellcheck@master is not allowed to be used in apache/kyuubi.

I opened the https://issues.apache.org/jira/browse/INFRA-24064 to ask the ASF INFRA team to evaluate this plugin and hope it can be added to the whitelist.

[1] https://github.com/apache/kyuubi/actions/runs/3856320011

@davidyuan1223
Copy link
Contributor Author

@xiaoyuandajian I just noticed that[1]

ludeeus/action-shellcheck@master is not allowed to be used in apache/kyuubi.

I opened the https://issues.apache.org/jira/browse/INFRA-24064 to ask the ASF INFRA team to evaluate this plugin and hope it can be added to the whitelist.

[1] https://github.com/apache/kyuubi/actions/runs/3856320011

yes, I hope so

bowenliang123 pushed a commit that referenced this pull request Mar 7, 2023
…n folder

### _Why are the changes needed?_
<!--
fix-#4057 info: modify the shellcheck errors file in ./bin
1. "$" is a array, we want use string to compare. so modify "$" => "$*"
2. `tty` mean execute the command, we can use $(tty) replace it
3. param $# is a number, compare number should use -gt/-lt,not >/<
4. not sure the /bin/kyuubi line 63 'exit -1' need modify? so the directory bin only have a shellcheck note in /bin/kyuubi
-->
- fix shellcheck violations in scripts of /bin folder
- enable shellcheck rule checks

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #4162 from davidyuan1223/master.

Closes #4078

c48ad38 [yuanfuyuan] remove the used blank lines
55a0a43 [xiaoyuandajian] Merge pull request #10 from xiaoyuandajian/fix-#4057
cb11935 [yuan] Merge remote-tracking branch 'origin/fix-#4057' into fix-#4057
86e4e1c [yuan] fix-#4057 info: modify the shellcheck errors file in ./bin 1. "$@" is a array, we want use string to compare. so update "$@" => "$*" 2. `tty` mean execute the command, we can use $(tty) replace it 3. param $# is a number, compare number should use -gt/-lt,not >/< 4. not sure the /bin/kyuubi line 63 'exit -1' need modify? so the directory bin only have a shellcheck note in /bin/kyuubi
dd39efd [袁福元] fix-#4057 info: 1. "$@" is a array, we want use string to compare. so update "$@" => "$*" 2. `tty` mean execute the command, we can use $(tty) replace it 3. param $# is a number, compare number should use -gt/-lt,not >/<

Lead-authored-by: yuan <yuanfuyuan@mafengwo.com>
Co-authored-by: 袁福元 <yuanfuyuan@mafengwo.com>
Co-authored-by: xiaoyuandajian <51512358+xiaoyuandajian@users.noreply.github.com>
Co-authored-by: yuanfuyuan <1406957364@qq.com>
Signed-off-by: liangbowen <liangbowen@gf.com.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:build kind:deploy kind:infra license, community building, project builds, asf infra related, etc. module:kubernetes module:server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Add a job or step for shell script style in Github Action
2 participants