This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
Allow ShellCheck source=
directive to be relative to project root instead of file path
#124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new config setting for
linter-shellcheck
calleduseProjectCwd
, which controls whether the paths used by ShellCheck'ssource=
directive are relative to the project root or the file.Background & Context
The ShellCheck tool supports a linter directive called
source=
that works like the following:In the current implementation of
linter-shellcheck
, theshellcheck
command executes with a "current working directory" based on the file's path. The outcome is allsource=
paths must be relative to the file's directory.While working with ShellCheck on a large project, I found it more convenient to reference absolute file paths from the
source=
directive. This is particularly helpful when running theshellcheck
command from CI scripts. Without this ability, developers see different ShellCheck errors in Atom vs. CI results or a command line linter invocation.To provide an option to homogenize the ShellCheck experience between Atom and typical CLI usage, this PR does the following:
false
to maintain the existing behavior (file-relative paths).shellcheck
to use either the project root or the file's directory.