{"action":"created","issue":{"url":"https://api.github.com/repos/koalaman/shellcheck/issues/500","labels_url":"https://api.github.com/repos/koalaman/shellcheck/issues/500/labels{/name}","comments_url":"https://api.github.com/repos/koalaman/shellcheck/issues/500/comments","events_url":"https://api.github.com/repos/koalaman/shellcheck/issues/500/events","html_url":"https://github.com/koalaman/shellcheck/issues/500","id":110806068,"number":500,"title":"shellcheck source: moar capabilities please","user":{"login":"aw-altiscale","id":7633626,"avatar_url":"https://avatars.githubusercontent.com/u/7633626?v=3","gravatar_id":"","url":"https://api.github.com/users/aw-altiscale","html_url":"https://github.com/aw-altiscale","followers_url":"https://api.github.com/users/aw-altiscale/followers","following_url":"https://api.github.com/users/aw-altiscale/following{/other_user}","gists_url":"https://api.github.com/users/aw-altiscale/gists{/gist_id}","starred_url":"https://api.github.com/users/aw-altiscale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aw-altiscale/subscriptions","organizations_url":"https://api.github.com/users/aw-altiscale/orgs","repos_url":"https://api.github.com/users/aw-altiscale/repos","events_url":"https://api.github.com/users/aw-altiscale/events{/privacy}","received_events_url":"https://api.github.com/users/aw-altiscale/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-10T17:03:55Z","updated_at":"2015-10-17T19:08:15Z","closed_at":null,"body":"For Apache Yetus (http://yetus.apache.org), we use bash sourcing as a plug-in mechanism.  This often means doing things that are the equivalent of:\r\n\r\nfor x in *; do\r\n  . $x\r\ndone\r\n\r\nThere are a few things that I'd like to do (or, if it already does this and I just missed it, some hand holding!):\r\n\r\na) Specify a regex or wildcard for shellcheck source.  e.g.:\r\n```bash\r\n# shellcheck source=somedir/*\r\n```\r\n\r\nb) Specify a shellcheck source directive even when there isn't one in the source.  For example, the top of a plug-in might be able to:\r\n\r\n```bash\r\n# shellcheck source=foo\r\nfunction bar {}\r\n```\r\n\r\nSo that function bar has all the definitions from foo\r\n\r\nc) shellcheck source can take a relative path to the location of the file being processed.  e.g., \r\n\r\n```bash\r\n# shellcheck source=foo.sh\r\n```\r\n\r\nif I run shellcheck -x some/long/path/bar.sh , file.sh would expect foo.sh to be in some/long/path.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/koalaman/shellcheck/issues/comments/148944713","html_url":"https://github.com/koalaman/shellcheck/issues/500#issuecomment-148944713","issue_url":"https://api.github.com/repos/koalaman/shellcheck/issues/500","id":148944713,"user":{"login":"dierobotsdie","id":730244,"avatar_url":"https://avatars.githubusercontent.com/u/730244?v=3","gravatar_id":"","url":"https://api.github.com/users/dierobotsdie","html_url":"https://github.com/dierobotsdie","followers_url":"https://api.github.com/users/dierobotsdie/followers","following_url":"https://api.github.com/users/dierobotsdie/following{/other_user}","gists_url":"https://api.github.com/users/dierobotsdie/gists{/gist_id}","starred_url":"https://api.github.com/users/dierobotsdie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dierobotsdie/subscriptions","organizations_url":"https://api.github.com/users/dierobotsdie/orgs","repos_url":"https://api.github.com/users/dierobotsdie/repos","events_url":"https://api.github.com/users/dierobotsdie/events{/privacy}","received_events_url":"https://api.github.com/users/dierobotsdie/received_events","type":"User","site_admin":false},"created_at":"2015-10-17T19:08:15Z","updated_at":"2015-10-17T19:08:15Z","body":"These are/maybe incomplete examples, but it will hopefully give you an idea.\r\n\r\nb) \r\n\r\nhttps://github.com/apache/yetus/blob/master/dev-support/personality/tajo.sh  defines a few constants that are specific to the Apache Tajo project.  Those constants are used by https://github.com/apache/yetus/blob/master/dev-support/core.d/01-common.sh and other files that are imported during runtime. My hunch is that it would be significantly preferable to have source lines rather than disable lines when shellcheck analyzes the tajo.sh file.\r\n\r\nc) \r\n\r\nApache Yetus has plug-in support for shellcheck (specifically via https://github.com/apache/yetus/blob/master/dev-support/test-patch.d/shellcheck.sh).  When we are running shellcheck, we are running it on a build tree that has been checked out/cloned from it's repository and not in an installed state.  This means that absolute paths in shellcheck source= aren't going to work because we have no idea where that location will actually be.  Additionally, we run shellcheck from the root of the repository.  So shellcheck source=./foo won't work if the file we're analyzing is actually in a subdirectory since ./ will be the root.  But if shellcheck is aware that ./ really means directory of the file that is being analyzed, then relative paths will work great since the source line will pull in the appropriate content.\r\n\r\nHopefully this makes sense without digging too deep into Yetus. :)"}}