Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cEP5: Define bear picking strategy and ambiguity on configuration #78

Merged
merged 2 commits into from
May 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions cEP-0005.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# coala Configuration

| Metadata | |
| ------------ |-----------------------------------------------|
| cEP | 5 |
| Version | 2.0 |
| Title | coala Configuration |
| Authors | Lasse Schuirmann <[email protected]> |
| Status | Implementation Due |
| Type | Feature |
| Metadata | |
| ------------ |--------------------------------------------------|
| cEP | 5 |
| Version | 2.1 |
| Title | coala Configuration |
| Authors | Lasse Schuirmann <[email protected]>, |
| | Adhika Setya Pramudita <[email protected]> |
| Status | Implementation Due |
| Type | Feature |

## Problem

Expand Down Expand Up @@ -85,6 +86,18 @@ files = **.(c|h)
ignore_aspects = redundancy # Exclusive
```

An aspect could be writen by its fully qualified name
(`Root.Redundancy.Clone`) or partially qualified name (`Redundancy.Clone`
or even `Clone`) and is case insensitive. Note that writing by partial name
could result in ambiguity. This could be resolved by writing the expanded
partially qualified name in such way to remove the ambiguity or just write
its fully qualified name.

In case of multiple aspects have the same taste name, ambiguity must be
resolved by prefixing the taste name with its aspect name. For example,
`max_length` is a taste of `Shortlog` and `LineLength`. Thus the `Shortlog`
would be defined like `Shortlog.max_length = 50`.

### Bear API

Bears will receive the aspects that should be checked as a parameter and
Expand Down Expand Up @@ -244,6 +257,17 @@ To get all bears for a set of aspects, all bears will have to be collected. It
can then be filtered against its metadata to get only bears that analyze the
given aspects. This information should be cached to improve the performance.

If multiple bears provide the same aspects a debug message should be emitted
so developers consider removing the aspects from one of the bears and the bear
to run will be chosen depending on alphabetical order.
### Bear Picking Strategy

If multiple bears provide the same aspects, then coala will pick one of them
with the following prioritization:

1. Could **fix** the problem, not only detect it.
2. Minimizing number of bears. For performance reason, it's faster to run
1 bear that can handle 10 aspect rather than 10 bears for 10 aspect.
3. Run under the most common runtime. Rather than have 2 external bear
run with NodeJS and 2 with Ruby, try to get 4 that run under NodeJS.
4. Alphabetical order.

coala will emit a log message that state the name and reason for each picked
bear.