フロントエンド、バックエンド、フルスタック開発者の質問の設定

Last updated: September 29, 2026

有効なプロジェクトには、ルートディレクトリに有効なhackerrank.yml設定ファイルが必要です。以下の例や設定リファレンスを参照して、プロジェクトに合わせて書き方を学んでください。 

設定リファレンス

version: (番号)
  - [必須] 設定スキーマのバージョン番号。
  - 現在のバージョンは1.0ですconfiguration: (ハッシュ)
  - [必須] 設定の親属性。
  - すべてのプロジェクト設定はここに提供されます
  has_webserver: (ブール値)
    - [必須] プロジェクトに公開されたWebサーバーがあるかどうかを定義します
      (サーバー外からアクセス可能)。
    - ポートを開放します (3000, 3030, 5000, 6000, 6001, 8000, 8080) 
      サーバーの公開に使用します。その他のポートは外部通信からブロックされます。
  readonly_paths: (配列)
    - [任意] 読み取り専用にすべきファイルパスおよび/または正規表現パターンのリスト
      candidates
  scoring: [任意] (ハッシュ)
    - [必須] スコアリングに関する設定の親属性
    command: (文字列)
      - [必須] スコアリングコマンドはここで定義されます。
      - この属性はスコアリングを機能させるために必要です
    files: (配列)
      - [任意] スコアリング出力ファイルのリストをここに提供できます。
      - スコアリングコマンドが実行された後、これらのファイルを検索し
        パースして最終スコアを計算します。
      - これらのファイルが提供されていない場合、スコアリングコマンドの出力がスコアリングに使用されます。
    testcase_weights: (ハッシュ [<テストケース名>:<重み>])
      - [任意] この属性はテストケースの重み付けスコアリングに使用できます。
      - すべての重みの合計は 
        1 でなければなりません。検証は合計が1でない場合に失敗します。
      - テストケースの重みはテストケース名で一致します、
        すべてのテストケース名は一意である必要があります(ファイル間で)。
  ide_config: (ハッシュ)
    - [必須] すべてのIDE関連設定はここに提供されます
    default_open_files: (配列)
      - [必須] ここにデフォルトで開くファイルのリストを提供します。
        パスはプロジェクトルートフォルダからの相対パスである必要があります。
    project_menu: (文字列)
      - [必須] ここにプロジェクトメニューコマンドを定義します。すべての子属性は必須です。
      run:
        - [必須] プロジェクト > 実行メニュー項目のコマンドを提供します
      install:
        - [必須] プロジェクト > インストールメニュー項目のコマンドを提供します
      test:
        - [必須] プロジェクト > テストメニュー項目のコマンドを提供します

例1:スコアなしのノードプロジェクトのサンプル設定

version: 1.0configuration:
  has_webserver: false
  ide_config:
    default_open_files:
      - app.js
    project_menu: 
      run: npm start
      install: npm install
      test: npm test

例2:ウェブサーバーとスコアリングを備えたノードプロジェクトのサンプル設定

version: 1.0configuration:
  has_webserver: true
  scoring:
    # npm testはresults/unit.xmlファイルにテスト出力を生成することが期待されています。
    command: "npm test"
    files:
      - results/unit.xml
  ide_config:
    default_open_files:
      - app.js
    project_menu: 
      run: npm start
      install: npm install
      test: npm test

例3:重み付けされたテストケースを持つJava Spring Boot APIプロジェクトのサンプル設定

version: 1.0configuration:
  has_webserver: false
  scoring:
    command: "mvn clean test"
    files:
      - target/customReports/result.xml
    testcase_weights:
      # 重みは合計で1になる必要があります
      Create a model: 0.2
      Delete a model: 0.2
      Edit a model: 0.2
      Filter model by attribute: 0.4
  ide_config:
    default_open_files:
      - src/main/java/com/hackerrank/sample/controller/ModelController.java
      - src/main/java/com/hackerrank/sample/model/Model.java
    project_menu: 
      run: mvn clean spring-boot:run
      install: mvn clean install
      test: mvn clean test; cat target/customReports/result.txt

例4:Webサーバーと複数の出力ファイルを持つNodeプロジェクトのサンプル設定

version: 1.0configuration:
  has_webserver: true
  scoring:
    # npm test は results/unit.xml ファイルにテスト出力を生成することが期待されています。
    command: "npm test"
    files:
      - results/user.xml
      - results/project.xml
      - results/api.xml
  ide_config:
    default_open_files:
      - app.js
    project_menu: 
      run: npm start
      install: npm install
      test: npm test

例5:読み取り専用ファイルを持つNodeプロジェクトのサンプル設定

テストケースなどの特定のファイルを読み取り専用としてマークするために、読み取り専用ファイルを使用できます。候補者はこれらのファイルを変更できません。

version: 1.0configuration:
  has_webserver: true
  readonly_paths:
    - app/test.js
    - app/tests/*
  scoring:
    command: "npm test"
    files:
      - results/unit.xml
  ide_config:
    default_open_files:
      - app.js
    project_menu:
      run: npm start
      install: npm install
      test: npm test