Completed
Push — pyup-update-plumbum-1.6.5-to-1... ( 484603 )
by Michael
61:06 queued 60:19
created

status()   B

Complexity

Conditions 4

Size

Total Lines 42

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 4

Importance

Changes 7
Bugs 0 Features 0
Metric Value
cc 4
c 7
b 0
f 0
dl 0
loc 42
ccs 15
cts 15
cp 1
crap 4
rs 8.5806
1 3
import changes
0 ignored issues
show
Bug introduced by
There seems to be a cyclic import (changes -> changes.cli -> changes.commands.stage).

Cyclic imports may cause partly loaded modules to be returned. This might lead to unexpected runtime behavior which is hard to debug.

Loading history...
Bug introduced by
There seems to be a cyclic import (changes -> changes.cli -> changes.commands.publish).

Cyclic imports may cause partly loaded modules to be returned. This might lead to unexpected runtime behavior which is hard to debug.

Loading history...
Bug introduced by
There seems to be a cyclic import (changes -> changes.cli -> changes.commands.status).

Cyclic imports may cause partly loaded modules to be returned. This might lead to unexpected runtime behavior which is hard to debug.

Loading history...
2
3 3
from . import info, note, highlight
4
5
6 3
def status():
7 3
    repository = changes.project_settings.repository
8
9 3
    release = changes.release_from_pull_requests()
10
11 3
    info('Status [{}/{}]'.format(
12
        repository.owner,
13
        repository.repo,
14
    ))
15
16 3
    info(
17
        'Repository: ' +
18
        highlight(
19
            '{}/{}'.format(repository.owner, repository.repo),
20
        )
21
    )
22
23 3
    info('Latest Version')
24 3
    note(repository.latest_version)
25
26 3
    info('Changes')
27 3
    unreleased_changes = repository.pull_requests_since_latest_version
28 3
    note('{} changes found since {}'.format(
29
        len(unreleased_changes),
30
        repository.latest_version,
31
    ))
32
33 3
    for pull_request in unreleased_changes:
34 3
        note('#{} {} by @{}{}'.format(
35
            pull_request.number,
36
            pull_request.title,
37
            pull_request.author,
38
            ' [{}]'.format(
39
                ','.join(pull_request.label_names)
40
            ) if pull_request.label_names else '',
41
        ))
42
43 3
    if unreleased_changes:
44 3
        info('Computed release type {} from changes issue tags'.format(
45
            release.release_type))
46 3
        info('Proposed version bump {} => {}'.format(
47
            repository.latest_version, release.version
48
        ))
49