Skip to content

Feature/build ci #43

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

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: python
python:
- "3.6"
- "3.7"
- "3.8"
dist: xenial
sudo: true
install:
Expand Down
3 changes: 2 additions & 1 deletion commitizen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging
import logging.config

from colorama import init
from commitizen.cz.base import BaseCommitizen

from commitizen.cz.base import BaseCommitizen

init()

Expand Down
1 change: 0 additions & 1 deletion commitizen/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from commitizen.cli import main


if __name__ == "__main__":
main()
6 changes: 4 additions & 2 deletions commitizen/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
from collections import defaultdict
from itertools import zip_longest
from string import Template
from packaging.version import Version
from typing import List, Optional, Union

from packaging.version import Version

from commitizen.defaults import (
MAJOR,
MINOR,
PATCH,
bump_pattern,
bump_map,
bump_message,
bump_pattern,
)


Expand Down
17 changes: 7 additions & 10 deletions commitizen/cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import io
import os
import sys
import logging
import argparse
import logging
import sys
import warnings

from decli import cli
from pathlib import Path
from configparser import RawConfigParser, NoSectionError
from commitizen import defaults, commands, out, config
from commitizen.__version__ import __version__

from commitizen import commands, config, out
from commitizen.__version__ import __version__

logger = logging.getLogger(__name__)
data = {
Expand Down Expand Up @@ -46,8 +43,8 @@
"name": ["--retry"],
"action": "store_true",
"help": "retry last commit",
},
]
}
],
},
{
"name": "example",
Expand Down
5 changes: 3 additions & 2 deletions commitizen/commands/bump.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from packaging.version import Version
from typing import Optional

import questionary
from commitizen import bump, git, config, out, factory
from packaging.version import Version

from commitizen import bump, config, factory, git, out

NO_COMMITS_FOUND = 3
NO_VERSION_SPECIFIED = 4
Expand Down
4 changes: 2 additions & 2 deletions commitizen/commands/commit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import contextlib
import os
import questionary
import tempfile

from commitizen import factory, out, git
import questionary

from commitizen import factory, git, out

NO_ANSWERS = 5
COMMIT_ERROR = 6
Expand Down
5 changes: 3 additions & 2 deletions commitizen/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import json
import os
import warnings
from typing import Optional
from pathlib import Path
from tomlkit import parse, exceptions
from typing import Optional

from tomlkit import exceptions, parse

from commitizen import defaults

Expand Down
1 change: 1 addition & 0 deletions commitizen/cz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import importlib
import pkgutil

from commitizen.cz.conventional_commits import ConventionalCommitsCz
from commitizen.cz.jira import JiraSmartCz

Expand Down
4 changes: 2 additions & 2 deletions commitizen/cz/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, List, Tuple
from abc import ABCMeta, abstractmethod
from typing import List, Optional, Tuple

from prompt_toolkit.styles import merge_styles, Style
from prompt_toolkit.styles import Style, merge_styles


class BaseCommitizen(metaclass=ABCMeta):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from commitizen.cz.base import BaseCommitizen

from commitizen import defaults
from commitizen.cz.base import BaseCommitizen

__all__ = ["ConventionalCommitsCz"]


Expand Down
4 changes: 2 additions & 2 deletions commitizen/cz/jira/jira.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from commitizen.cz.base import BaseCommitizen

from commitizen.cz.base import BaseCommitizen

__all__ = ["JiraSmartCz"]

Expand Down Expand Up @@ -67,7 +67,7 @@ def example(self):
)

def schema(self):
return "<ignored text> <ISSUE_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>"
return "<ignored text> <ISSUE_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>" # noqa

def info(self):
dir_path = os.path.dirname(os.path.realpath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion commitizen/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"version": None,
"files": [],
"tag_format": None, # example v$version
"bump_message": None # bumped v$current_version to $new_version
"bump_message": None, # bumped v$current_version to $new_version
}

MAJOR = "MAJOR"
Expand Down
1 change: 0 additions & 1 deletion commitizen/factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from commitizen import BaseCommitizen, out
from commitizen.cz import registry


NO_COMMITIZEN_FOUND = 2


Expand Down
1 change: 1 addition & 0 deletions commitizen/git.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from tempfile import NamedTemporaryFile

from commitizen import cmd


Expand Down
1 change: 1 addition & 0 deletions commitizen/out.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

from termcolor import colored


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ codecov = "^2.0"
mypy = "^0.740"
mkdocs = "^1.0"
mkdocs-material = "^4.1"
isort = "^4.3.21"

[tool.poetry.scripts]
cz = "commitizen.cli:main"
Expand Down
11 changes: 11 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh -e

export PREFIX=""
if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
fi

set -x

${PREFIX}isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --apply commitizen tests
${PREFIX}black commitizen tests
9 changes: 8 additions & 1 deletion scripts/test
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
pytest --cov-report term-missing --cov=commitizen tests/
export PREFIX=""
if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
fi

${PREFIX}pytest --cov-report term-missing --cov=commitizen tests/
${PREFIX}black commitizen tests --check
${PREFIX}flake8 --max-line-length=88 commitizen/ tests/
10 changes: 6 additions & 4 deletions tests/test_bump_command.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os
import shutil
import pytest
import sys
from typing import Optional
from pathlib import Path
from commitizen import git, cmd, cli
import uuid
from pathlib import Path
from typing import Optional

import pytest

from commitizen import cli, cmd, git


@pytest.fixture
Expand Down
11 changes: 3 additions & 8 deletions tests/test_bump_create_commit_message.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import pytest
from packaging.version import Version

from commitizen import bump

conversion = [
(
("1.2.3", "1.3.0", "bump: $current_version -> $new_version [skip ci]"),
"bump: 1.2.3 -> 1.3.0 [skip ci]",
),
(
("1.2.3", "1.3.0", None),
"bump: version 1.2.3 → 1.3.0",
),
(
("1.2.3", "1.3.0", "release $new_version"),
"release 1.3.0",
),
(("1.2.3", "1.3.0", None), "bump: version 1.2.3 → 1.3.0"),
(("1.2.3", "1.3.0", "release $new_version"), "release 1.3.0"),
]


Expand Down
1 change: 1 addition & 0 deletions tests/test_bump_create_tag.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from packaging.version import Version

from commitizen import bump

conversion = [
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bump_find_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"feat(cli): added version",
"docs(README): motivation",
"fix(setup.py): future is now required for every python version",
"BREAKING CHANGE: `extends` key in config file is now used for extending other config files",
"BREAKING CHANGE: `extends` key in config file is now used for extending other config files", # noqa
]

PATCH_INCREMENTS_SVE = ["readme motivation PATCH", "fix setup.py PATCH"]
Expand Down
6 changes: 4 additions & 2 deletions tests/test_bump_find_version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pytest
import itertools
from commitizen.bump import generate_version

import pytest
from packaging.version import Version

from commitizen.bump import generate_version

simple_flow = [
(("0.1.0", "PATCH", None), "0.1.1"),
(("0.1.1", "MINOR", None), "0.2.0"),
Expand Down
2 changes: 2 additions & 0 deletions tests/test_bump_update_version_in_files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

import pytest

from commitizen import bump

PYPROJECT = """
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys

import pytest

from commitizen import cli


Expand Down
5 changes: 3 additions & 2 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import pytest
from unittest import mock

from commitizen import defaults, commands, cmd
import pytest

from commitizen import cmd, commands, defaults

config = {"name": defaults.name}

Expand Down
9 changes: 5 additions & 4 deletions tests/test_conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os

import pytest
from commitizen import config, defaults

from commitizen import config, defaults

PYPROJECT = """
[tool.commitizen]
Expand Down Expand Up @@ -41,7 +42,7 @@
"tag_format": None,
"bump_message": None,
"files": ["commitizen/__version__.py", "pyproject.toml"],
"style": [["pointer", "reverse"], ["question", "underline"]]
"style": [["pointer", "reverse"], ["question", "underline"]],
}

_new_config = {
Expand All @@ -50,14 +51,14 @@
"tag_format": None,
"bump_message": None,
"files": ["commitizen/__version__.py", "pyproject.toml"],
"style": [["pointer", "reverse"], ["question", "underline"]]
"style": [["pointer", "reverse"], ["question", "underline"]],
}

_read_conf = {
"name": "cz_jira",
"version": "1.0.0",
"files": ["commitizen/__version__.py", "pyproject.toml"],
"style": [["pointer", "reverse"], ["question", "underline"]]
"style": [["pointer", "reverse"], ["question", "underline"]],
}


Expand Down
1 change: 1 addition & 0 deletions tests/test_cz_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from commitizen import defaults
from commitizen.cz.base import BaseCommitizen

Expand Down
7 changes: 4 additions & 3 deletions tests/test_cz_conventional_commits.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import pytest

from commitizen import defaults
from commitizen.cz.conventional_commits.conventional_commits import (
ConventionalCommitsCz,
NoSubjectException,
parse_scope,
parse_subject,
NoSubjectException,
ConventionalCommitsCz,
)

config = {"name": defaults.name}
Expand Down Expand Up @@ -82,7 +83,7 @@ def test_long_answer():
message = conventional_commits.message(answers)
assert (
message
== "fix(users): email pattern corrected\n\nBREAKING CHANGE: complete content\n\ncloses #24"
== "fix(users): email pattern corrected\n\nBREAKING CHANGE: complete content\n\ncloses #24" # noqa
)


Expand Down
3 changes: 1 addition & 2 deletions tests/test_cz_jira.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from commitizen.cz.jira import JiraSmartCz
from commitizen import defaults

from commitizen.cz.jira import JiraSmartCz

config = {"name": defaults.name}

Expand Down
3 changes: 2 additions & 1 deletion tests/test_factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from commitizen import factory, defaults, BaseCommitizen

from commitizen import BaseCommitizen, defaults, factory


def test_factory():
Expand Down