> For the complete documentation index, see [llms.txt](https://kashiwara.gitbook.io/rubydesurufurusukuratchibe/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kashiwara.gitbook.io/rubydesurufurusukuratchibe/di-san-zhang-jing-de-jie-xi/gana.md).

# 静的解析が必要な理由

### 静的解析とは

静的解析を使えば明らかに動かない構文崩れのコードを検知したり使っていない変数を発見する事が出来ます(他にも色々)。

2章で書いたテストコードとは違う側面から検証できます。

### フォーマッターとは

ソースコードのインデントを整えてくれるツールをフォーマッターといいます。

今までいっぱいバックスペースキーを押してインデント整えるの面倒ではありませんでしたか？

rubocopには静的解析だけでなくフォーマットも出来ます。

{% hint style="warning" %}
**失敗談・静的解析導入編**

チームに参加して2\~3年が経った頃です。

人も増えて4名ほどの体制になりテストを記述する文化が根付いてきた頃です。

別の問題が出てきました。

みんな"俺が一番いけてると思うフォーマット"でコードに個性を出し始めました。

PRのレビューでインデントを指定されたり変数の命名が指定されることも増え始めました。

この消耗の中で、あるチームメンバーがrubocopを導入してくれました。

rubocopによる自動レビューは当時のメンバーには、かなり効果的でした。

インデントを手作業で修正することもなくなり、明らかに変な名前のメソッドはrubocopがブロックしてくれたので開発工数の削減に繋がりました。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kashiwara.gitbook.io/rubydesurufurusukuratchibe/di-san-zhang-jing-de-jie-xi/gana.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
