doorstop.core.vcs.mockvcs   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
wmc 6
eloc 21
dl 0
loc 36
ccs 18
cts 20
cp 0.9
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A WorkingCopy.add() 0 2 1
A WorkingCopy.lock() 0 2 1
A WorkingCopy.delete() 0 3 1
A WorkingCopy.__init__() 0 3 1
A WorkingCopy.commit() 0 2 1
A WorkingCopy.edit() 0 2 1
1
# SPDX-License-Identifier: LGPL-3.0-only
2 1
3
"""Plug-in module to simulate the storage of requirements in a repository."""
4 1
import os
5 1
6
from doorstop import common
7 1
from doorstop.core.vcs.base import BaseWorkingCopy
8
9
log = common.logger(__name__)
10 1
11
12
class WorkingCopy(BaseWorkingCopy):
13 1
    """Simulated working copy."""
14
15 1
    DIRECTORY = '.mockvcs'
16 1
17 1
    def __init__(self, path):
18
        super().__init__(path)
19 1
        self._ignores_cache = ["*/env/*", "*/apidocs/*", "*/build/lib/*"]
20
21
    def lock(self, path):
22 1
        log.debug("$ simulated lock on: {}...".format(path))
23 1
24
    def edit(self, path):
25 1
        log.debug("$ simulated edit on: {}...".format(path))
26 1
27
    def add(self, path):
28 1
        log.debug("$ simulated add on: {}...".format(path))
29 1
30 1
    def delete(self, path):
31
        os.remove(path)
32 1
        log.debug("$ Deleted {}...".format(path))
33
34
    def commit(self, message=None):
35
        log.debug("$ simulated commit")
36