mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-11-01 10:26:49 +08:00
Merge pull request #146 from YukiOta/ja-trans/4.11
4.11 Refactor regularly using static analysis tools の翻訳
This commit is contained in:
@ -523,13 +523,13 @@ null == undefined; // true
|
||||
|
||||
<br/><br/>
|
||||
|
||||
## ![✔] 4.11 Refactor regularly using static analysis tools
|
||||
## ![✔] 4.11 静的解析ツールを使用して定期的にリファクタリングする
|
||||
|
||||
**TL;DR:** Using static analysis tools helps by giving objective ways to improve code quality and keeps your code maintainable. You can add static analysis tools to your CI build to fail when it finds code smells. Its main selling points over plain linting are the ability to inspect quality in the context of multiple files (e.g. detect duplications), perform advanced analysis (e.g. code complexity) and follow the history and progress of code issues. Two examples of tools you can use are [Sonarqube](https://www.sonarqube.org/) (2,600+ [stars](https://github.com/SonarSource/sonarqube)) and [Code Climate](https://codeclimate.com/) (1,500+ [stars](https://github.com/codeclimate/codeclimate)).
|
||||
**TL;DR:** 静的解析ツールを利用することは、客観的な視点をもたらし、コードの品質向上や保守性の維持に役立ちます。静的解析ツールを CI に追加することで、コードの臭いを発見した際にビルドを失敗させることができます。シンプルな linting に勝るポイントとしては、複数ファイルを含むコンテキストで品質を検査できること(例:重複の検出)、高度な分析を実施できること(例:コードの複雑さ)、そしてコードの問題の履歴や進行状況を追跡できることです。使用できるツールの例としては、[Sonarqube](https://www.sonarqube.org/) (2,600+ [stars](https://github.com/SonarSource/sonarqube)) と [Code Climate](https://codeclimate.com/) (1,500+ [stars](https://github.com/codeclimate/codeclimate)) の 2 つがあります。
|
||||
|
||||
**Otherwise:** With poor code quality, bugs and performance will always be an issue that no shiny new library or state of the art features can fix
|
||||
**さもないと:** コードの品質が低いと、ピカピカの新しいライブラリや最新の機能では修正できない類のバグやパフォーマンスが常に問題となります。
|
||||
|
||||
🔗 [**Read More: Refactoring!**](/sections/testingandquality/refactoring.md)
|
||||
🔗 [**さらに読む: リファクタリング!**](/sections/testingandquality/refactoring.japanese.md)
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
@ -1,43 +1,41 @@
|
||||
# Refactoring
|
||||
# リファクタリング
|
||||
|
||||
<br/><br/>
|
||||
|
||||
### One Paragraph Explainer
|
||||
### 一段落説明
|
||||
|
||||
Refactoring is an important process in the iterative development flow. Removing "Code Smells" (bad coding practices) such as Duplicated Code, Long Methods, Long Parameter list will improve your code and making it more maintainable. Using a static analysis tools will assist you in finding these code smells and build a process around refactoring. Adding these tools to your CI build will help automate the quality checking process. If your CI integrates with a tool like Sonar or Code Climate, the build will fail if it detects code smells and inform the author on how to address the issue. Theses static analysis tools will complement lint tools such as ESLint. Most linting tools will focus on code styles like indentation and missing semicolons (although some will find code smells like Long functions) in a single file while static analysis tools will focus on finding code smells (duplicate code, complexity analysis, etc) that are in single files and multiple files.
|
||||
リファクタリングは反復開発フローにおいて重要なプロセスです。重複したコード、長いメソッド、長いパラメータリストといった「コードの臭い」(悪いコーディングプラクティス)を取り除くことで、コードが改善し、保守性が向上します。静的解析ツールを使用することは、そういったコードの臭いを発見しリファクタリングを中心としたプロセスを構築するのに役立ちます。こういったツールを CI に導入することで、品質チェックプロセスを自動化することができます。CI が Sonar や Code Climate といったツールと統合されている場合、コードの臭いを検出した際にビルドを失敗させ、作者に問題の対処方法を知らせます。これらの静的解析ツールは、ESLint のような lint ツールを補うものです。多くの linting ツールは、単一ファイルにおけるインデントやセミコロンの付け忘れ(長い関数のようなコードの臭いを見つけるものもありますが)といったコードスタイルにフォーカスしますが、静的解析ツールは単一のファイルおよび複数のファイルにおいてコードの臭いを発見する(重複したコード、複雑性解析など)ことにフォーカスしています。
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
### Martin Fowler - Chief Scientist at ThoughtWorks
|
||||
### Martin Fowler - ThoughtWorks 社のチーフサイエンティスト
|
||||
|
||||
From the book, "Refactoring - Improving the Design of Existing Code"
|
||||
書籍 "Refactoring - Improving the Design of Existing Code" より
|
||||
|
||||
> Refactoring is a controlled technique for improving the design of an existing code base.
|
||||
> リファクタリングは、既存のコードベースの設計を改善するための、制御された技術です。
|
||||
|
||||
<br/><br/>
|
||||
|
||||
### Evan Burchard - Web Development Consultant and Author
|
||||
### Evan Burchard - Web 開発コンサルタント、作家
|
||||
|
||||
From the book, "Refactoring JavaScript: Turning Bad Code into Good Code"
|
||||
書籍 "Refactoring JavaScript: Turning Bad Code into Good Code" より
|
||||
|
||||
> No matter what framework or
|
||||
“compiles-to-JS” language or library you use, bugs and performance concerns
|
||||
will always be an issue if the underlying quality of your JavaScript is poor.
|
||||
> どのようなフレームワークや「JS にコンパイル可能な」言語、ライブラリを使用しようとも、JavaScript の根本的な質が低ければ、バグやパフォーマンスの懸念は常に問題になります。
|
||||
|
||||
<br/><br/>
|
||||
|
||||
### Example: Complex methods analysis with CodeClimate (commercial)
|
||||
### 例: CodeClimate を使用した複雑なメソッドの解析(商用)
|
||||
|
||||

|
||||

|
||||
|
||||
### Example: Code analysis trends and history with CodeClimate (commercial)
|
||||
### 例: CodeClimate を使用したコード解析結果の傾向と履歴(商用)
|
||||
|
||||

|
||||

|
||||
|
||||
### Example: Code analysis summary and trends with SonarQube (commercial)
|
||||
### 例: コード解析結果のサマリーと傾向(商用)
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Reference in New Issue
Block a user