CircleCI syntax errors？

# はじめに
CircleCIで自動ビルド・テスト化をしようとした時に遭遇したエラーついて紹介します。

# エラー文
早速ですがエラー文を紹介します。
```
An error occurred in .circleci/config.yml
To see the YAML syntax errors, click the button below:

#!/bin/sh -eo pipefail
# ERROR IN CONFIG FILE:
# [#/jobs/build] 0 subschemas matched instead of one
# 1. [#/jobs/build] only 1 subschema matches out of 2
# |   1. [#/jobs/build/steps] 10 schema violations found
# |   |   1. [#/jobs/build/steps/7] 0 subschemas matched instead of one
# |   |   |   1. [#/jobs/build/steps/7] 3 schema violations found
# |   |   |   |   `when`/`unless` step
# |   |   |   |   1. [#/jobs/build/steps/7] extraneous key [command] is not permitted
# |   |   |   |   |   `when`/`unless` step
# |   |   |   |   |   Permitted keys:
# |   |   |   |   |     - when
# |   |   |   |   |     - unless
# |   |   |   |   |   Passed keys:
# |   |   |   |   |     - run
# |   |   |   |   |     - name
# |   |   |   |   |     - command
# |   |   |   |   2. [#/jobs/build/steps/7] extraneous key [name] is not permitted
# |   |   |   |   |   `when`/`unless` step
# |   |   |   |   |   Permitted keys:
# |   |   |   |   |     - when
# |   |   |   |   |     - unless
# |   |   |   |   |   Passed keys:
# |   |   |   |   |     - run
# |   |   |   |   |     - name
# |   |   |   |   |     - command
# |   |   |   |   3. [#/jobs/build/steps/7] maximum size: [1], found: [2]
# |   |   |   |   |   `when`/`unless` step
# |   |   |   |   |   SCHEMA:
# |   |   |   |   |     maxProperties: 1
# |   |   |   |   |   INPUT:
# |   |   |   |   |     run: null
# |   |   |   |   |     name: Rubocop
# |   |   |   |   |     command: bundle exec rubocop
# |   |   |   2. [#/jobs/build/steps/7] expected type: String, found: Mapping
# |   |   |   |   Shorthand commands, like `checkout`
# |   |   |   |   SCHEMA:
# |   |   |   |     type: string
# |   |   |   |   INPUT:
# |   |   |   |     run: null
# |   |   |   |     name: Rubocop
# |   |   |   |     command: bundle exec rubocop
# |   |   |   3. [#/jobs/build/steps/7] maximum size: [1], found: [2]
# |   |   |   |   long form commands like `run:`
# |   |   |   |   SCHEMA:
# |   |   |   |     maxProperties: 1
# |   |   |   |   INPUT:
# |   |   |   |     run: null
# |   |   |   |     name: Rubocop
# |   |   |   |     command: bundle exec rubocop
# |   |   2. [#/jobs/build/steps/8] 0 subschemas matched instead of one
# |   |   |   1. [#/jobs/build/steps/8] 3 schema violations found
# |   |   |   |   `when`/`unless` step
# |   |   |   |   1. [#/jobs/build/steps/8] extraneous key [command] is not permitted
# |   |   |   |   |   `when`/`unless` step
# |   |   |   |   |   Permitted keys:
# |   |   |   |   |     - when
# |   |   |   |   |     - unless
# |   |   |   |   |   Passed keys:
# |   |   |   |   |     - run
# |   |   |   |   |     - name
# |   |   |   |   |     - command
# |   |   |   |   2. [#/jobs/build/steps/8] extraneous key [name] is not permitted
# |   |   |   |   |   `when`/`unless` step
# |   |   |   |   |   Permitted keys:
# |   |   |   |   |     - when
# |   |   |   |   |     - unless
# |   |   |   |   |   Passed keys:
# |   |   |   |   |     - run
# |   |   |   |   |     - name
# |   |   |   |   |     - command
# |   |   |   |   3. [#/jobs/build/steps/8] maximum size: [1], found: [2]
# |   |   |   |   |   `when`/`unless` step
# |   |   |   |   |   SCHEMA:
# |   |   |   |   |     maxProperties: 1
# |   |   |   |   |   INPUT:
# |   |   |   |   |     run: null
# |   |   |   |   |     name: Rspec
# |   |   |   |   |     command: |
# |   |   |   |   |       mkdir /tmp/test-results
# |   |   |   |   |       TEST_FILES=\"$(circleci tests glob \"spec/**/*_spec.rb\" | \\
# |   |   |   |   |         circleci tests split --split-by=timings)\"
# |   |   |   |   |       bundle exec rspec \\
# |   |   |   |   |         --format progress \\
# |   |   |   |   |         --format RspecJunitFormatter \\
# |   |   |   |   |         --out /tmp/test-results/rspec.xml \\
# |   |   |   |   |         --format progress \\
# |   |   |   |   |         $TEST_FILES
# |   |   |   2. [#/jobs/build/steps/8] expected type: String, found: Mapping
# |   |   |   |   Shorthand commands, like `checkout`
# |   |   |   |   SCHEMA:
# |   |   |   |     type: string
# |   |   |   |   INPUT:
# |   |   |   |     run: null
# |   |   |   |     name: Rspec
# |   |   |   |     command: |
# |   |   |   |       mkdir /tmp/test-results
# |   |   |   |       TEST_FILES=\"$(circleci tests glob \"spec/**/*_spec.rb\" | \\
# |   |   |   |         circleci tests split --split-by=timings)\"
# |   |   |   |       bundle exec rspec \\
# |   |   |   |         --format progress \\
# |   |   |   |         --format RspecJunitFormatter \\
# |   |   |   |         --out /tmp/test-results/rspec.xml \\
# |   |   |   |         --format progress \\
# |   |   |   |         $TEST_FILES
# |   |   |   3. [#/jobs/build/steps/8] maximum size: [1], found: [2]
# |   |   |   |   long form commands like `run:`
# |   |   |   |   SCHEMA:
# |   |   |   |     maxProperties: 1
# |   |   |   |   INPUT:
# |   |   |   |     run: null
# |   |   |   |     name: Rspec
# |   |   |   |     command: |
# |   |   |   |       mkdir /tmp/test-results
# |   |   |   |       TEST_FILES=\"$(circleci tests glob \"spec/**/*_spec.rb\" | \\
# |   |   |   |         circleci tests split --split-by=timings)\"
# |   |   |   |       bundle exec rspec \\
# |   |   |   |         --format progress \\
# |   |   |   |         --format RspecJunitFormatter \\
# |   |   |   |         --out /tmp/test-results/rspec.xml \\
# |   |   |   |         --format progress \\
# |   |   |   |         $TEST_FILES
# 2. [#/jobs/build] expected type: String, found: Mapping
# |   Job may be a string reference to another job
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code exit status 1
CircleCI received exit code 1
```
私はこれを見て、syntax errors？って思いました。笑

# 対象コード
グダグダ言っていても始まらないので、とりあえずエラー文の中から、どこがエラーしているのか探しました。
対象コードがこちらになります。
```
run: null
name: Rubocop
command: bundle exec rubocop

- run:
name: Rspec
command: |
mkdir /tmp/test-results
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
circleci tests split --split-by=timings)"
bundle exec rspec \
--format progress \
--format RspecJunitFormatter \
--out /tmp/test-results/rspec.xml \
--format progress \
$TEST_FILES
```
# 対処法
スペルミス、endの数の違い、,や:が抜けているなど確認して見ましたが、間違えがありませんでした。
途方に暮れてコードをスクロールして眺めていたら、...!
インデントがおかしなと気づき、インデント増やして見たところエラーが解消されました。

# まとめ
CircleCIのエラーメッセージは分かりづらい為、解読するのに苦労しました。