<commit_before>Getting Started with coala
==========================

Welcome to this little tutorial. It is meant to be a gentle introduction
to the usage of coala.

Prerequisites
-------------

In order to complete this tutorial you will need coala installed.
(Installation is actually not required but it's more convenient and
recommended.)

.. note::

    Here's a list of our
    `supported languages
    <https://github.com/coala/bear-docs/blob/master/README.rst>`__.


Get Some Code
-------------

In order to perform a static code analysis on your code you will need
some code to check. If you do not have your own code you want to check, you
can retrieve our tutorial samples:

::

    git clone https://github.com/coala/coala-tutorial

Please note that the commands given in this tutorial are intended for
use with this sample code and may need minor adjustments.

Let's Start!
------------

There are two options how to let coala know what kind of analysis it
should perform on which code.

Command Line Interface
~~~~~~~~~~~~~~~~~~~~~~

In order to specify the files to analyze, you can use the ``--files``
argument of coala like demonstrated below. For all file paths, you can
specify (recursive) `globs <../Users/Glob_Patterns.html>`__.

Because analysis routines can do many various things we named them
**bears**. A bear can check your code for potential problems, calculate metrics
and even provide corrections for your code.

There are two kinds of bears:

- LocalBears, which only perform analysis on each file itself
- GlobalBears, which are project wide, like the GitCommitBear

Let's find out what bears are available for C or Python:

::

    coala --show-bears --filter-by-language C Python

coala now lists all bears that can operate on C or Python code.
Note that here you can give space separated language names as muliple
arguments.

You can specify the bears that you want coala to run using the ``--bears``
argument:

::

    cd coala-tutorial
    coala --files=src/\*.c --bears=SpaceConsistencyBear --save

.. note::

    You can use comma separated values to specify more than one item in
    arguments! Do not use spaces as that would start a new argument.
    Example: ``SpaceConsistencyBear,PEP8Bear``

coala will now ask you for missing values that are needed to perform the
analysis, which in this case is only the ``use_spaces`` setting. We
recommend setting it to ``True``.

coala will now check the code and, in case you use the tutorial code,
yield one result. SpaceConsistencyBear will detect a trailing whitespace at<commit_msg>Tutorial: Do not mention bear kinds<commit_after>Getting Started with coala
==========================

Welcome to this little tutorial. It is meant to be a gentle introduction
to the usage of coala.

Prerequisites
-------------

In order to complete this tutorial you will need coala installed.
(Installation is actually not required but it's more convenient and
recommended.)

.. note::

    Here's a list of our
    `supported languages
    <https://github.com/coala/bear-docs/blob/master/README.rst>`__.


Get Some Code
-------------

In order to perform a static code analysis on your code you will need
some code to check. If you do not have your own code you want to check, you
can retrieve our tutorial samples:

::

    git clone https://github.com/coala/coala-tutorial

Please note that the commands given in this tutorial are intended for
use with this sample code and may need minor adjustments.

Let's Start!
------------

There are two options how to let coala know what kind of analysis it
should perform on which code.

Command Line Interface
~~~~~~~~~~~~~~~~~~~~~~

In order to specify the files to analyze, you can use the ``--files``
argument of coala like demonstrated below. For all file paths, you can
specify (recursive) `globs <../Users/Glob_Patterns.html>`__.

Because analysis routines can do many various things we named them
**bears**. A bear can check your code for potential problems, calculate metrics
and even provide corrections for your code.

Let's find out what bears are available for C or Python:

::

    coala --show-bears --filter-by-language C Python

coala now lists all bears that can operate on C or Python code.
Note that here you can give space separated language names as muliple
arguments.

You can specify the bears that you want coala to run using the ``--bears``
argument:

::

    cd coala-tutorial
    coala --files=src/\*.c --bears=SpaceConsistencyBear --save

.. note::

    You can use comma separated values to specify more than one item in
    arguments! Do not use spaces as that would start a new argument.
    Example: ``SpaceConsistencyBear,PEP8Bear``

coala will now ask you for missing values that are needed to perform the
analysis, which in this case is only the ``use_spaces`` setting. We
recommend setting it to ``True``.

coala will now check the code and, in case you use the tutorial code,
yield one result. SpaceConsistencyBear will detect a trailing whitespace at
{'fraction_non_alphanumeric': 0.09005591054313099, 'fraction_numerical': 0.00039936102236421724, 'mean_word_length': 3.6251154201292706, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '7512814', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1295, 'n_words': 719}