Completed
Push — init-test ( 3e12e7 )
by Michael
07:46 queued 07:14
created

CLI.repo()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1 3
from os.path import exists, join, curdir
2 3
import io
3
4 3
import click
0 ignored issues
show
Configuration introduced by
The import click could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
5 3
import giturlparse
0 ignored issues
show
Configuration introduced by
The import giturlparse could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
6 3
from path import Path
0 ignored issues
show
Configuration introduced by
The import path could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
7
8 3
from plumbum.cmd import git
0 ignored issues
show
Configuration introduced by
The import plumbum.cmd could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
9 3
import toml
0 ignored issues
show
Configuration introduced by
The import toml could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
10 3
from invoke import run
0 ignored issues
show
Configuration introduced by
The import invoke could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
11
12 3
CONFIG_FILE = '.changes.toml'
13 3
CONFIG_FILES = [
14
    '.changes.toml',
15
    'pyproject.toml',
16
    'setup.cfg',
17
]
18 3
DOCS = [
19
    'CHANGELOG.md',
20
    'README.md',
21
]
22 3
DEFAULTS = {
23
    'changelog': 'CHANGELOG.md',
24
    'readme': 'README.md',
25
    'github_auth_token': None,
26
}
27
28
29 3
class Config:
30 3
    test_command = None
31 3
    pypi = None
32 3
    skip_changelog = None
33 3
    changelog_content = None
34 3
    repo = None
35
36 3
    def __init__(self, module_name, dry_run, debug, no_input, requirements,
37
                 new_version, current_version, repo_url, version_prefix):
38 3
        self.module_name = module_name
39
        # module_name => project_name => curdir
40 3
        self.dry_run = dry_run
41 3
        self.debug = debug
42 3
        self.no_input = no_input
43 3
        self.requirements = requirements
44 3
        self.new_version = (
45
            version_prefix + new_version
46
            if version_prefix
47
            else new_version
48
        )
49 3
        self.current_version = current_version
50
51
52 3
def project_config():
53
    """Deprecated"""
54 3
    project_name = curdir
55
56 3
    config_path = Path(join(project_name, CONFIG_FILE))
57
58 3
    if not exists(config_path):
59 3
        store_settings(DEFAULTS.copy())
60 3
        return DEFAULTS
61
62 3
    return toml.load(io.open(config_path)) or {}
63
64
65 3
def load_settings():
66 3
    return project_config()
67
68
69 3
def store_settings(settings):
70 3
    config_path = Path(join(curdir, CONFIG_FILE))
71
72 3
    with click.open_file(config_path, 'w') as f:
0 ignored issues
show
Coding Style Naming introduced by
The name f does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
73 3
        f.write(toml.dumps(settings))
74
75
76
# def bumpversion_settings():
77
#     pass
78
# def towncrier_settings():
79
#     fn = join(curdir, "pyproject.toml")
80
#     if not exists(fn):
81
#         return None
82
#     with open(fn, 'r') as conffile:
83
#         config = toml.load(conffile)
84
#
85
#     if 'tool' not in config or 'package' not in config['tool']['towncrier']:
86
#         raise NotConfigured(
87
#             'No [tool.towncrier] section or '
88
#             "the towncrier section has no required 'package' key."
89
#         )
90
#     return config['tool']['towncrier']
91