doorstop.core.vcs.veracity   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 68.57 %

Importance

Changes 0
Metric Value
wmc 5
eloc 21
dl 24
loc 35
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A WorkingCopy.commit() 4 4 1
A WorkingCopy.add() 2 2 1
A WorkingCopy.delete() 2 2 1
A WorkingCopy.lock() 4 4 1
A WorkingCopy.edit() 2 2 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
# SPDX-License-Identifier: LGPL-3.0-only
2
3
"""Plug-in module to store requirements in a Veracity repository."""
4
5
from doorstop import common
6
from doorstop.core.vcs.base import BaseWorkingCopy
7
8
log = common.logger(__name__)
9
10
11 View Code Duplication
class WorkingCopy(BaseWorkingCopy):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
12
    """Veracity working copy."""
13
14
    DIRECTORY = ".sgdrawer"
15
    IGNORES = (".sgignores", ".vvignores")
16
17
    def lock(self, path):
18
        log.debug("`vv` does not support scripted locking: %s", path)
19
        self.call("vv", "pull")
20
        self.call("vv", "update")
21
22
    def edit(self, path):
23
        log.info("`vv` adds all changes")
24
25
    def add(self, path):
26
        self.call("vv", "add", path)
27
28
    def delete(self, path):
29
        self.call("vv", "remove", path)
30
31
    def commit(self, message=None):
32
        message = message or input("Commit message: ")
33
        self.call("vv", "commit", "--message", message)
34
        self.call("vv", "push")
35