-
Notifications
You must be signed in to change notification settings - Fork 208
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 editorconfig and update bash files accordingly #5446
Add editorconfig and update bash files accordingly #5446
Conversation
subrepo: subdir: "external/os-autoinst-common" merged: "fbd66e7f6" upstream: origin: "git@github.com:os-autoinst/os-autoinst-common.git" branch: "master" commit: "fbd66e7f6" git-subrepo: version: "0.4.6" origin: "???" commit: "???"
@Martchus why are javascript issues still showing up like that? says |
d06d152
to
db66633
Compare
shfmt-3.5.1 | ||
setxkbmap-1.3.1 | ||
ShellCheck-0.8.0 | ||
shfmt-3.5.1 |
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.
shfmt-3.5.1 | |
setxkbmap-1.3.1 | |
ShellCheck-0.8.0 | |
shfmt-3.5.1 | |
setxkbmap-1.3.1 | |
ShellCheck-0.8.0 | |
shfmt-3.5.1 |
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.
have been fixed
eslint starts failing once the .editorconfig is created. |
Ok, so as we don't have plans to merge PRs with failing checks what are your intentions about it? |
@@ -0,0 +1,12 @@ | |||
[*] |
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 just stumbled upon this issue: mvdan/sh#664
And it mentions [[shell]]
. I can't find that in the shfmt documentation nor in the EditorConfig documentation but it seems to work :)
The problem seems to be that eslint is using the editorconfig as well, and as we are using *
we can't blame 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.
Oh, nevermind, I misread the diff.
It was apparently touching the right files when i used [[shell]], but then it was using the default formatting rules, using tabs etc.
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 tried [script/**]
instead, but it still touched files elsewhere (and did not touch anything under script). Weird. Have to work on other tasks now though...
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.
Apparently this works, but we can't use the config file then:
shfmt -w -i 4 -bn -ci -sr $(shfmt -f .)
e.g.
shfmt -w $(shfmt -f .)
does not use .editorconfig
So -f is able to find the right files.
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.
What about the other way around?
[*.js]
ignore = true
Makefile
Outdated
.PHONY: test-shfmt | ||
test-shfmt: | ||
@which shfmt >/dev/null 2>&1 || (echo "Command 'shfmt' not found, can not execute bash script syntax checks" && false) | ||
shfmt -d . |
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 suggest to do the following right now:
shfmt -d . | |
shfmt -d -i 4 -bn -ci -sr $(shfmt -f .) |
and remove the .editorconfig symlink.
We can think of any improvements later and get this big PR merged.
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.
Considering we were not able to make eslint/prettier ignore the editor config (after reading https://github.com/prettier/eslint-plugin-prettier, https://prettier.io/docs/en/configuration.html, https://prettier.io/docs/en/options.html and https://eslint.org/docs/latest/use/configure/configuration-files#using-configuration-files and trying several variants) that might be the best way to move this forward for now, indeed.
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.
And apparently
shfmt -d -i 4 -bn -ci -sr .
also works. Not sure why we ruled that out when we experimented with it in the scripts repo.
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.
oh right, because of the .bpan
directory which we wanted to ignore.
So we might need something like this, depending on the repo:
shfmt -d -i 4 -bn -ci -sr $(shfmt -f . | grep -v '^.bpan' )
dbea6d6
to
f5f2021
Compare
Makefile
Outdated
.PHONY: test-shfmt | ||
test-shfmt: | ||
@which shfmt >/dev/null 2>&1 || (echo "Command 'shfmt' not found, can not execute bash script syntax checks" && false) | ||
shfmt -d -d -i 4 -bn -ci -sr $(shfmt -f . | grep -v '^.bpan' ) |
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 think this doesn't work as it is a Makefile, where shell syntax doesn't work.
Also we don't have .bpan here in this repo, so maybe don't use it.
Also the -d
option is duplicate.
Try this:
shfmt -d -d -i 4 -bn -ci -sr $(shfmt -f . | grep -v '^.bpan' ) | |
shfmt -d -i 4 -bn -ci -sr $$(shfmt -f .) |
With the double dollar it should work.
e9f6c76
to
b261327
Compare
https://progress.opensuse.org/issues/153793 Pull latest changes of .editorconfig from os-autoinst-common, shfmt to the dependencies and enable CI checks. Signed-off-by: ybonatakis <ybonatakis@suse.com>
b261327
to
b17990c
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 it ran successfully:
lib/OpenQA/Worker/Isotovideo/Client.pm source OK
lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm source OK
shfmt -d -i 4 -bn -ci -sr $(shfmt -f .)
make test-unit-and-integration TIMEOUT_M=20 PROVE_ARGS="$HARNESS t/*{tidy,compile}*.t" GLOBIGNORE="t/25-cache-service.t:t/43-scheduling-and-worker-scalability.t:t/ui/01-list.t:t/ui/26-jobs_restart.t:t/ui/13-admin.t:"
make[1]: Entering directory '/home/squamata/project'
And the JavaScript check didn't complain anymore as well.
https://progress.opensuse.org/issues/153793
Pull latest changes of .editorconfig from os-autoinst-common, shfmt to the
dependencies and enable CI checks.
recreate #5440