-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
MacOS linting & testing support + docs #2001
MacOS linting & testing support + docs #2001
Conversation
87740dc
to
b3e5d20
Compare
b3e5d20
to
6ebd22a
Compare
Since this builds on #2000, it does not need to incorporate the same changes again. When #2000 is merged, this PR will possibly have unnecessary merge conflicts. Please remove the changes that are already present in #2000. Not sure about #1980, but it seems to have these very changes too if I‘m not mistaken. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review is mostly regarding the docs, but I have a few concerns with other changes that I'd appreciate some clarity on.
032869c
to
1f574d3
Compare
bc73591
to
dd660e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we just have the switch from the current docker image approach for linting to docker-compose using official lint images directly and we're good! 🎉
For the other maintainers, note that the improvement to image name collection was reverted. It did reveal that our current filter likewise isn't identifying all test images by name assigned, mostly because there is no established/documented convention enforced which should be addressed at some point.
3612aa8
to
cb132f2
Compare
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Documentation preview for this PR is ready! 🎉 Built with commit: 7707464 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @NorseGaud ! Thanks for taking the time to contribute 😀
TL;DR for reviewers of PR thread thus far
Summary of anything possibly worth pointing out:
#2001 (comment) notes that this should have been reverted, but has resulted in: "${@:+$@}"
, apparently due to "unbound variable problems".
#2001 (comment) notes that the change from find
option -executable
for compatibility reasons in lint.sh
may result in potential false positives, but it's probably unlikely for this project:
[[ "$(uname)" == "Darwin" ]] && PERM="+111" || PERM="/111"
F_BIN="$(find 'target/bin' -perm "${PERM}" -type f -or -type l)"
#2001 (comment) notes another minor find
change with test
instead of test/
for matching the target directory to scan (this only covers a limited depth mind you, not sure if that's intentional to skip some of the contents further down?). Should otherwise be harmless?
#2001 (comment) notes that logging the linter version has been dropped. If maintainers still desire that, now that we use docker images for linting, the versions in the variables should be sufficient to log with?
#2001 (comment) notes ERR
has been dropped in lint.sh
, but is still referenced by this line:
trap '__log_err "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" ${LINENO:-?} ${?:-?}' ERR
#2001 (review) notes unrelated to changes in this PR, our cleanup logic in Makefile needs to be addressed, tests aren't conforming to conventions preventing them from being matched.
#2001 (comment) notes unrelated to this PR, the issues and pull requests docs page still has a rendering issue of nested lists.
@aendeavor is the trap line with |
Yes :) In case of an unexpected error, it will print information via the |
@@ -225,7 +231,7 @@ function _docker_image | |||
if ${USE_CONTAINER} | |||
then | |||
# reuse existing container specified on command line | |||
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" "${@}" | |||
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" "${@:+$@}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the purpose of all these "${@:+$@}"
.
If $@ is not empty; then use $@
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you encounter a problem or was this added in good faith?
BASH 4.0.0 was released more than 10 years ago. And the bug got fixed in later 4.x releases (just verified it with debian9 which included BASH 4.4).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with the latest bash in macOS it was throwing the error for me. It's a macOS specific fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't Mac using Bash 3 by default? Or did you install bash 4 via brew
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this all presumes the user has /usr/local/bin in their PATH before /bin... I personally think ${@:+$@}
is worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my mac i needed to hash -r
after brew install bash
and this only works bc /usr/local/bin
ist listed first on default environments. So if it is environment safe as long as bash4+ is installed anywhere on the system we should go with ${@:+$@}
i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure TBH. This construct just looks weird to me 😆
But I guess we could make an effort to support macOS users:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't Mac using Bash 3 by default?
Holy shit. YMMD 😄 Couldn't believe that's true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth leaving a comment with description or link about it for future maintainer reference? Or is the link to this PR with lengthy discussion thread to wade through sufficient?
@@ -6,6 +6,13 @@ | |||
|
|||
SCRIPT="lint.sh" | |||
|
|||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix in #1980
@aendeavor I meant the |
I understand. Then this may not be needed anymore and can be removed entirely I guess. |
Description
macOS users cannot easily contribute as linting and testing doesn't work locally. Some code is linux/GNU only and breaks when running on mac for various reasons.
A key change: Linting no longer requires you to run things on your host.
Type of change
Checklist:
docs/
)