Closed Bug 1432627 Opened 7 years ago Closed 7 years ago

Add shellcheck to CI

Categories

(Release Engineering :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox60 fixed)

RESOLVED FIXED
Tracking Status
firefox60 --- fixed

People

(Reporter: sfraser, Assigned: sfraser)

References

Details

Attachments

(1 file)

Add an entry to taskcluster/ci/source-test/mozlint.yml for shellcheck. shellcheck: description: shellcheck run over gecko codebasecodebase platform: lint/opt treeherder: symbol: #! run: mach: lint -l shellcheck -f treeherder when: files-changed: - '**/*.sh'
Assignee: nobody → sfraser
Comment on attachment 8946262 [details] Bug 1432627 Add shellcheck linter to CI https://reviewboard.mozilla.org/r/216212/#review222026 Thanks, this patch is good, I had basically created the exact same one. But when I pushed it to try, I noticed that we were hitting that "no JSON to decode" message a bunch. After improving the logging to also print the line, it seems that `-x` is not a valid option, for example: https://treeherder.mozilla.org/logviewer.html#?job_id=159078722&repo=try&lineNumber=249 Maybe the `shellcheck` binary that is being installed via `apt-get` is an old version that doesn't have `-x` yet? We might need to use `pip` to install it instead.
Attachment #8946262 - Flags: review?(ahalberstadt) → review-
shellcheck isn't a python module, sadly. It does look like '-x' is relatively new, so we can take that option out and add an exclusion for the errors that it now produces. I'll update the commit and re-submit for review.
Comment on attachment 8946262 [details] Bug 1432627 Add shellcheck linter to CI https://reviewboard.mozilla.org/r/216212/#review222040 Static analysis found 1 defect in this patch. - 1 defect found by mozlint You can run this analysis locally with: - `./mach lint check path/to/file` (Python/Javascript/wpt) If you see a problem in this automated review, please report it here: http://bit.ly/2y9N9Vx ::: tools/lint/shell/__init__.py:158 (Diff revision 2) > > config['root'] = lintargs['root'] > > files = find_shell_scripts(config, paths) > > - base_command = [binary, '-x', '-f', 'json'] > + base_command = [binary,'-f', 'json'] Error: missing whitespace after ',' [flake8: E231]
hooray for the reviewbot!
Comment on attachment 8946262 [details] Bug 1432627 Add shellcheck linter to CI https://reviewboard.mozilla.org/r/216212/#review222044 Thanks, looks good!
Attachment #8946262 - Flags: review?(ahalberstadt) → review+
It seems the earlier version of shellcheck has other issues, I will fix in the morning
Apologies for the repeated review requests - I've run this one under debian stretch, and it's come back clean.
Flags: needinfo?(sfraser)
No worries, mozreview actually carries r+'s forward, so unless you reset the flag in bugzilla, I won't get a new review request. If it's a small fix (like in this case), I think it's fine for authors to re-land without re-review. Though in this case I did glance at your changes and it looks fine :). One tip I like to use for testing lint tasks is running: ./mach try empty This will schedule the relevant lint tasks (though nothing else) on try.
That's good info, thank you!
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again. hg error in cmd: hg rebase -s b45a7cffc880bb6fc0b098337d882e83d0926c0b -d 4a70ce5756cc: rebasing 444632:b45a7cffc880 "Bug 1432627 Add shellcheck linter to CI, adjust shellcheck directives for 0.4.4 r=ahal" (tip) other [source] changed taskcluster/docker/recipes/centos6-build-system-setup.sh which local [dest] deleted use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u merging taskcluster/ci/source-test/mozlint.yml merging taskcluster/docker/image_builder/build-image.sh merging tools/lint/shell/__init__.py merging tools/lint/shellcheck.yml unresolved conflicts (see hg resolve, then hg rebase --continue)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: