Skip to content

Commit e1503d8

Browse files
nityeshagagitmate-bot
authored andcommitted
Tutorial.rst: Rewrite all mentions of Default
This updates the documentation by removing all mentions of the, now deprecated `Default` section and rewriting them using `cli` section. Closes coala/coala#5172
1 parent 384e8ce commit e1503d8

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

Users/Tutorial.rst

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@ Thats all nice and well but we also have a Makefile for our project we
170170
want to check. So let us introduce another feature of our configuration
171171
syntax: *sections*.
172172

173-
The line ``[Default]`` specifies that everything below will belong to
174-
the Default section. If nothing is specified, a setting will implicitly
175-
belong to this section.
173+
The line ``[cli]`` in the ``.coafile`` implies that everything below
174+
belongs to the special ``cli`` section. You may specify sections when
175+
you enter the settings via the Command Line Interface (CLI). You will
176+
soon learn all about them. When you don't specify any sections, the
177+
settings will implicitly belong to the ``[cli]`` section.
176178

177-
Let's check the line lengths of our Makefile:
179+
Next you will see how to specify sections using the command line when
180+
you are running coala. Let's check the line lengths of our Makefile:
178181

179182
::
180183

@@ -270,24 +273,34 @@ That looks horrible, doesn't it? Let's fix it!
270273
$ coala -S python.bears=PEP8Bear python.files=\*\*/\*.py \
271274
--apply-patches --save
272275
# other output ...
276+
Executing section cli...
273277
Executing section python...
274278
[INFO][11:03:37] Applied 'ApplyPatchAction' for 'PEP8Bear'.
275279
[INFO][11:03:37] Applied 'ApplyPatchAction' for 'PEP8Bear'.
276280

277281
coala would now fix all spacing issues and without bothering you again.
278282

283+
.. note::
284+
285+
When you try the above example, you may get a warning, saying that all
286+
settings in the ``cli`` section are implicitly inherited to all
287+
other sections (if they do not override their values). It also advises
288+
us to change the name of that section to avoid unexpected behavior.
289+
The next section explains what it means and how you can avoid
290+
it.
291+
279292
Setting Inheritance
280293
-------------------
294+
Let's first see what inheritance means.
281295

282-
All settings in the default section are implicitly inherited to all
283-
other sections (if they do not override their values). We can use that
284-
to save a few lines!
296+
Before proceeding, rename the ``cli`` section in the ``.coafile`` to
297+
``all`` (we will soon explain the reason behind this change).
285298

286299
Lets add the following section to our ``.coafile``:
287300

288301
::
289302

290-
[TODOS]
303+
[all.TODOS]
291304
bears = KeywordBear
292305

293306
And execute ``coala`` with the ``-s`` argument which is the same as
@@ -298,10 +311,26 @@ After the results we've already seen, we'll see a new informational one
298311
which informs us that we have a TODO in our code.
299312

300313
Did you note that we didn't specify which files to check this time? This
301-
is because all settings, including ``files = src/*.c``, from the Default
302-
section are already available in every other section implicitly. Thus
303-
the default section is a good point to set things like logging and
304-
output settings or specifying a default set of files to check.
314+
is because all settings, including ``files = src/*.c``, from the ``all``
315+
section (previously called ``cli``) have been inherited in the new
316+
``TODOS`` section that we just added.
317+
318+
You can make a section inherit from any previously defined section using
319+
this syntax:
320+
321+
::
322+
323+
[parentSection.childSection]
324+
325+
.. note::
326+
327+
``cli`` is an internally reserved section name. All of its settings
328+
are implicitly inherited to every other section by default. It is
329+
because of this implicit inheritance feature that we are adviced to
330+
rename the ``cli`` section to something else. Doing so will save us
331+
from having unexpected values of ``cli`` being implicitly inherited
332+
into our sections. We strongly suggest renaming it.
333+
305334

306335
Ignoring Issues
307336
---------------

0 commit comments

Comments
 (0)