Skip to content

Commit

Permalink
cEP-0005: Naming of aspects and tastes
Browse files Browse the repository at this point in the history
Description of how aspects and tastes should be named in the future.

Closes coala/documentation#223
  • Loading branch information
Techievena committed Apr 29, 2017
1 parent 57cfe06 commit 8dfdf80
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions cEP-0005.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ paragraph:
not a program and must remain flow insensitive.
- To specify, what analysis should be run the user will not have to care about
bears. Instead, an `aspects` setting will be provided allowing the user to
specify what aspects of their code should be analyzed. Aspects could be
specify what aspects of their code should be analyzed. aspects could be
`spelling` or `smells` and are namespaced such that `redundancy.clones` will
be possible as well. Aspects can be defined inclusive (analyze those aspects,
be possible as well. aspects can be defined inclusive (analyze those aspects,
with the `aspects` settings) or exclusive (analyze all but those aspects,
with the `ignore_aspects` setting).
- Specifying `bears` manually will still be possible as it eases use especially
Expand Down Expand Up @@ -104,7 +104,7 @@ class RedundancyBear(LocalBear):
# ... and detect code clones.
DETECT_ASPECTS = {Root.Redundancy.Clone}

# Aspects are passed as parameter
# aspects are passed as parameter
def run(self, filename, file, aspects):
# No documentation required anymore for the bears.

Expand All @@ -124,6 +124,32 @@ class RedundancyBear(LocalBear):
yield Result.from_values(aspect=aspect, ...)
```

## Naming of aspects and tastes

## aspects

An aspect should just talk about a property of something, without qualifying
it. It should be named something like `Length` rather than `TooLong`. Then it
should be given the tastes.
For e.g. an aspect can be named as `Metadata.CommitMessage.Shortlog.Length` to
represent the length property of the shortlog (first line) of a commit message.

## tastes

tastes are the values that are used to initialize the aspect settings. It
should not be something like `allow` or `check` which enables or disables an
aspect, rather it should be something more like a value which describes an
aspect in a specific, measurable way. It can be given as much context as
needed but not more.
For e.g. for the aspect `Metadata.CommitMessage.Shortlog.`
`FirstCharacter`, set the taste `shortlog_starts_upper_case` as true if the
shortlog must begin with a upper case letter consistently, and false if the
opposite is true.

__Note:__ aspects and tastes are orthogonal concepts and should never overlap.
Therefore extreme caution must be taken while naming aspects and tastes to
avoid any discrepancy and inconsistency in the future.

The concept of aspects allows us to implement a consistency check and reduce
documentation redundancy. Instead of documenting settings and results in every
bear, we can create a new aspects class. A working implementation of the
Expand Down Expand Up @@ -225,7 +251,7 @@ This allows to show more information in results. Bears can give a custom result
message; however, by default the message can be generated from the settings of
the aspects with the ``result_message`` function.

Aspects can also define a ``style_paragraph`` function that returns a small
aspects can also define a ``style_paragraph`` function that returns a small
paragraph describing how the user should write their source code according to
the given settings. This will be used to generate a full style definition from
a coala configuration.
Expand Down

0 comments on commit 8dfdf80

Please sign in to comment.