<commit_before>## [CodeMetrics](https://github.com/rails/rails/pull/11148)

CodeStatistics extracted from Rails

## Getting Started

1. Install at the command prompt if you haven't yet:

    gem install code_metrics

### Usage

* Lines of code statistics for a folder

  * Command-line

    ```bash
    code_metrics
    ```

  * As rake task

    ```rake
    require 'code_metrics/statistics'
    ```

    ```bash
    rake code_metrics:stats
    # or in Rails (check `rake -W stats` to see what tasks are loading)
    rake stats
    ```

  * As a library

    ```ruby<commit_msg>Syntax highlight gem install in the README<commit_after>## [CodeMetrics](https://github.com/rails/rails/pull/11148)

CodeStatistics extracted from Rails

## Getting Started

1. Install at the command prompt if you haven't yet:

    ```bash
    gem install code_metrics
    ```

### Usage

* Lines of code statistics for a folder

  * Command-line

    ```bash
    code_metrics
    ```

  * As rake task

    ```rake
    require 'code_metrics/statistics'
    ```

    ```bash
    rake code_metrics:stats
    # or in Rails (check `rake -W stats` to see what tasks are loading)
    rake stats
    ```

  * As a library

    ```ruby
{'fraction_non_alphanumeric': 0.1060480530240265, 'fraction_numerical': 0.009942004971002486, 'mean_word_length': 2.7868338557993733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6899877', 'n_tokens_mistral': 402, 'n_tokens_neox': 354, 'n_words': 126}