Skip to content

Commit 7e70078

Browse files
bartvenemanclaude
andauthored
Add comprehensive metrics documentation to README (#59)
## Summary Added detailed documentation of all CSS analysis metrics to the README, organized by category (Performance, Maintainability, and Complexity). This provides users with clear visibility into what each metric measures and how points are deducted. ## Changes - Added a new "Metrics" section to the README with three subsections: - **Performance**: Documents 7 metrics including imports, empty rules, duplications, file size, comments, and embedded content - **Maintainability**: Documents 7 metrics covering lines of code, selector/declaration counts, and distribution analysis - **Complexity**: Documents 6 metrics for selector complexity, specificity, and ID/important selector ratios - Each metric includes a descriptive table showing what is tested and the point deduction formula - Organized metrics in a logical flow that mirrors the package's scoring categories mentioned in the introduction ## Details The documentation provides users with a transparent reference for understanding how the CSS analysis scoring works, making it easier to interpret results and identify areas for CSS improvement. https://claude.ai/code/session_011qjCuV5Cpr4xAr5H57tGcv --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2086b73 commit 7e70078

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

readme.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,43 @@ etc. etc.
8787
*/
8888
```
8989

90+
## Metrics
91+
92+
### Performance
93+
94+
| Metric | What is tested | Points deducted |
95+
| ------------------------- | -------------------------------------------- | ------------------------------------------- |
96+
| `Imports` | Number of `@import` rules | 10 per `@import` |
97+
| `EmptyRules` | Number of empty rules | 1 per empty rule |
98+
| `SelectorDuplications` | Ratio of duplicate selectors | Up to 10 (when uniqueness ratio < 66%) |
99+
| `DeclarationDuplications` | Ratio of duplicate declarations | Up to 10 (when uniqueness ratio < 66%) |
100+
| `CssSize` | Total CSS file size | 5 if size exceeds 200,000 bytes |
101+
| `TooMuchComments` | Total size of comments | 1 per 250 bytes of comments, max 10 |
102+
| `TooMuchEmbeddedContent` | Total size of embedded content (e.g. base64) | 1 per 250 bytes of embedded content, max 20 |
103+
104+
### Maintainability
105+
106+
| Metric | What is tested | Points deducted |
107+
| --------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------- |
108+
| `SourceLinesOfCode` | Total source lines of code | 1 per 1,000 lines over 10,000, max 15 |
109+
| `AverageSelectorsPerRule` | Average number of selectors per rule | 5 per selector over 2 (average), max 15 |
110+
| `AverageDeclarationsPerRule` | Average number of declarations per rule | 5 per declaration over 5 (average), max 15 |
111+
| `MaxSelectorsPerRule` | Maximum number of selectors in a single rule | 0.5 per selector over 10, max 15 |
112+
| `MaxDeclarationsPerRule` | Maximum number of declarations in a single rule | 0.5 per declaration over 10, max 15 |
113+
| `MoreThanMostCommonSelectorsPerRule` | Rules that have more selectors than the most common count | 0.01 per rule, max 15 (when > 10% of rules exceed the mode) |
114+
| `MoreThanMostCommonDeclarationsPerRule` | Rules that have more declarations than the most common count | 0.01 per rule, max 15 (when > 10% of rules exceed the mode) |
115+
116+
### Complexity
117+
118+
| Metric | What is tested | Points deducted |
119+
| --------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------- |
120+
| `MoreThanMostCommonSelectorComplexity` | Selectors more complex than the most common complexity | 0.01 per selector, max 10 (when > 10% of selectors exceed the mode) |
121+
| `MoreThanMostCommonSelectorSpecificity` | Selectors with higher specificity than the most common specificity | 0.01 per selector, max 10 (when > 10% of selectors exceed the mode) |
122+
| `MaxSelectorComplexity` | Maximum complexity of a single selector | 0.5 per complexity unit over 5, max 5 |
123+
| `AverageSelectorComplexity` | Average selector complexity | 2 per complexity unit over 2 (average), max 10 |
124+
| `IdSelectorRatio` | Ratio of ID selectors | Up to 5 (when ID selector ratio exceeds 1%) |
125+
| `ImportantRatio` | Ratio of `!important` declarations | Up to 5 (when `!important` ratio exceeds 1%) |
126+
90127
## Related projects
91128

92129
- [CSS Analyzer](https://github.com/projectwallace/css-analyzer) -

0 commit comments

Comments
 (0)