@leonardocrdso/clean-code-mcp 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +10 -10
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -19855,7 +19855,7 @@ class ProductService { getProduct(id: string) {} }`
|
|
|
19855
19855
|
id: "keep-functions-small",
|
|
19856
19856
|
name: "Keep Functions Small",
|
|
19857
19857
|
category: "functions",
|
|
19858
|
-
description: "Functions should be small. The first rule of functions is that they should be small. The second rule is that they should be smaller than that. Small functions are easier to read, understand, and
|
|
19858
|
+
description: "Functions should be small. The first rule of functions is that they should be small. The second rule is that they should be smaller than that. Small functions are easier to read, understand, and maintain.",
|
|
19859
19859
|
examples: [
|
|
19860
19860
|
{
|
|
19861
19861
|
label: "Bad",
|
|
@@ -20494,7 +20494,7 @@ if (employee !== null) { /* ... */ }`
|
|
|
20494
20494
|
id: "one-assert-per-test",
|
|
20495
20495
|
name: "One Assert per Test",
|
|
20496
20496
|
category: "unit-testing",
|
|
20497
|
-
description: "
|
|
20497
|
+
description: "If your project uses tests, they are easiest to understand when each test function contains a single assertion. Multiple assertions can obscure which concept is being tested. When a test fails, you immediately know what's broken.",
|
|
20498
20498
|
examples: [
|
|
20499
20499
|
{
|
|
20500
20500
|
label: "Bad",
|
|
@@ -20527,7 +20527,7 @@ test("new user starts as active", () => {
|
|
|
20527
20527
|
id: "fast-tests",
|
|
20528
20528
|
name: "Tests Should Be Fast (F.I.R.S.T.)",
|
|
20529
20529
|
category: "unit-testing",
|
|
20530
|
-
description: "
|
|
20530
|
+
description: "If your project uses tests, fast tests are run frequently. Slow tests are run infrequently. When tests run slow, you won't want to run them frequently, and you'll lose the ability to catch problems early. Aim for tests that run in milliseconds.",
|
|
20531
20531
|
examples: [
|
|
20532
20532
|
{
|
|
20533
20533
|
label: "Bad",
|
|
@@ -20556,7 +20556,7 @@ test("new user starts as active", () => {
|
|
|
20556
20556
|
id: "independent-tests",
|
|
20557
20557
|
name: "Tests Should Be Independent",
|
|
20558
20558
|
category: "unit-testing",
|
|
20559
|
-
description: "
|
|
20559
|
+
description: "If your project uses tests, they should not depend on each other. One test should not set up the conditions for the next. You should be able to run each test independently and in any order.",
|
|
20560
20560
|
examples: [
|
|
20561
20561
|
{
|
|
20562
20562
|
label: "Bad",
|
|
@@ -20586,7 +20586,7 @@ test("updates user name", () => {
|
|
|
20586
20586
|
id: "readable-tests",
|
|
20587
20587
|
name: "Tests Should Be Readable",
|
|
20588
20588
|
category: "unit-testing",
|
|
20589
|
-
description: "
|
|
20589
|
+
description: "If your project uses tests, readability is perhaps even more important than in production code. Tests serve as documentation for how code should be used. Each test should tell a clear story: arrange, act, assert.",
|
|
20590
20590
|
examples: [
|
|
20591
20591
|
{
|
|
20592
20592
|
label: "Bad",
|
|
@@ -20616,7 +20616,7 @@ test("updates user name", () => {
|
|
|
20616
20616
|
id: "test-boundary-conditions",
|
|
20617
20617
|
name: "Test Boundary Conditions",
|
|
20618
20618
|
category: "unit-testing",
|
|
20619
|
-
description: "Bugs often cluster at boundaries — empty arrays, zero values, null inputs, max limits.
|
|
20619
|
+
description: "Bugs often cluster at boundaries — empty arrays, zero values, null inputs, max limits. If your project uses tests, exercise boundary conditions explicitly. It's where most errors hide.",
|
|
20620
20620
|
examples: [
|
|
20621
20621
|
{
|
|
20622
20622
|
label: "Good",
|
|
@@ -21138,7 +21138,7 @@ async function processItem(item: Item) {
|
|
|
21138
21138
|
id: "separate-construction-from-use",
|
|
21139
21139
|
name: "Separate Construction from Use",
|
|
21140
21140
|
category: "systems",
|
|
21141
|
-
description: "The startup process of constructing objects and wiring dependencies is a separate concern from the runtime logic. Mixing construction with use creates tight coupling and makes
|
|
21141
|
+
description: "The startup process of constructing objects and wiring dependencies is a separate concern from the runtime logic. Mixing construction with use creates tight coupling and makes the code harder to maintain and extend.",
|
|
21142
21142
|
examples: [
|
|
21143
21143
|
{
|
|
21144
21144
|
label: "Bad",
|
|
@@ -21170,7 +21170,7 @@ async function processItem(item: Item) {
|
|
|
21170
21170
|
id: "use-dependency-injection",
|
|
21171
21171
|
name: "Use Dependency Injection",
|
|
21172
21172
|
category: "systems",
|
|
21173
|
-
description: "Rather than having an object create its own dependencies, pass them in from outside. This separates construction from use,
|
|
21173
|
+
description: "Rather than having an object create its own dependencies, pass them in from outside. This separates construction from use, improves flexibility, and allows different implementations to be swapped in.",
|
|
21174
21174
|
examples: [
|
|
21175
21175
|
{
|
|
21176
21176
|
label: "Bad",
|
|
@@ -21196,7 +21196,7 @@ class NotificationService {
|
|
|
21196
21196
|
id: "simple-design-runs-all-tests",
|
|
21197
21197
|
name: "Simple Design Rule 1: Runs All the Tests",
|
|
21198
21198
|
category: "emergence",
|
|
21199
|
-
description: "A system that
|
|
21199
|
+
description: "A system that can be verified is more reliable. Designing for verifiability pushes us toward small, single-purpose classes and loose coupling — which naturally leads to better design. If your project uses tests, they are a valuable tool for verification — but verifiability matters regardless.",
|
|
21200
21200
|
examples: [
|
|
21201
21201
|
{
|
|
21202
21202
|
label: "Good",
|
|
@@ -21264,7 +21264,7 @@ function replaceImage(newImage: Image) {
|
|
|
21264
21264
|
id: "simple-design-expressive",
|
|
21265
21265
|
name: "Simple Design Rule 3: Expressive",
|
|
21266
21266
|
category: "emergence",
|
|
21267
|
-
description: "Code should clearly express the intent of its author. The clearer code is, the less time others will spend understanding it. Use good names, keep functions and classes small, use standard nomenclature (design patterns),
|
|
21267
|
+
description: "Code should clearly express the intent of its author. The clearer code is, the less time others will spend understanding it. Use good names, keep functions and classes small, and use standard nomenclature (design patterns). When the project includes tests, ensure they are well-crafted and expressive too.",
|
|
21268
21268
|
examples: [
|
|
21269
21269
|
{
|
|
21270
21270
|
label: "Bad",
|
package/package.json
CHANGED