LoginSignup
4
6

More than 5 years have passed since last update.

Hubot起動時に"INFO [scriptのパス] is using depercated documentation syntax"が出力される理由と対応

Last updated at Posted at 2014-11-17

検証環境

OS X 10.9.5
Hubot 2.9.3

状態

以下のようにbotスクリプトを作成して、Hubotを起動すると件のメッセージが出力される。

example.coffee
module.exports = (robot) ->
  robot.respond /abc/i, (msg) ->
    msg.send 'xyz'
$ bin/hubot
...
[Mon Nov 17 2014 18:50:47 GMT+0900 (JST)] INFO /Users/stupiddog/hubot/example/scripts/example.coffee is using deprecated documentation syntax
...
Hubot>

対応

ヘッダーコメントを追加して、commands セクションに使い方の説明を追加する。

example.coffee
#Commands:
#  hubot abc - Returns the message 'xyz'
#
module.exports = (robot) ->
  robot.respond /abc/i, (msg) ->
    msg.send 'xyz'

理由

Hubotはhelpコマンドで表示する情報をコメントから得ている。
このため、コメントにCommandsセクションが無い場合に「そのドキュメントの書き方は推奨しませんよ」ってメッセージが出力される。
公式ドキュメントのScripting - Documenting Scriptsに詳しい説明がある。

example.coffee
#Commands:
#  hubot abc - Return a message "xyz"
#
module.exports = (robot) ->
  robot.respond /abc/i, (msg) ->
    msg.send 'xyz'
$ bin/hubot
...
Hubot> hubot help
Hubot> Hubot abc - Return a message "xyz"
Hubot help - Displays all of the help commands that Hubot knows about.
Hubot help <query> - Displays all help commands that match <query>.
Hubot>
... 

おまけ

色々試してみたら、"hubot 〜"の行だけでもhelpコマンドに抽出される。
Commandsセクションを記述した場合は、それ以降の"hubot 〜"行が対象になる。
しかし、ひな形にヘッダーコメントも含まれているので横着しないで合わせる方がいいですな。

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6