Skip to content
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
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ install:
script:
- pytest test/ -v
- pycodestyle *.py
after_script:
- py.test --cov-report term --cov=.
- codeclimate-test-reporter
- coverage xml
- python-codacy-coverage -r coverage.xml
notification:
email: false
1 change: 1 addition & 0 deletions conventions/symphony_cmf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
def symphony_convention(tag, msg):
tag = tag.capitalize()
composed = "[%s] %s\n" % (tag, msg)
return composed
14 changes: 7 additions & 7 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ def main(debug_mode=False):
convention = 'none'

if convention == 'none':
print('You are not using a convention')
commit_message = just_message()

else:
print('You are using the %s convention' % convention)
tag, msg = get_text()
if convention == 'angular' or convention == 'karma':
print('You are using the %s convention' % convention)
context = get_context()
commit_message = angular_convention(tag, msg, context)
elif convention == 'changelog':
print('You are using the %s convention' % convention)
commit_message = changelog_convention(tag, msg)
elif convention == 'symphony':
print('You are using the %s convention' % convention)
commit_message = symphony_convention(tag, msg)

commit_message += gen_co_author(args.co_author)
Expand Down Expand Up @@ -88,7 +87,8 @@ def main(debug_mode=False):
parser.print_help()


parser = parser_cli()
args = parser.parse_args()
debug('args variable', args, args.debug)
main(args.debug)
if __name__ == '__main__':
parser = parser_cli()
args = parser.parse_args()
debug('args variable', args, args.debug)
main(args.debug)
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ pyyaml==3.13
pytest==3.8.1
pycodestyle==2.4.0
argparse==1.4.0
coverage==4.3
pytest-cov==2.0.0
codeclimate-test-reporter
codacy-coverage==1.3
7 changes: 1 addition & 6 deletions test/test_conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,36 @@

def test_angular_convention_with_context():
message = angular.angular_convention('TAG', 'message', 'context')

if not ('tag(context): message\n'):
raise AssertionError()


def test_angular_convention_without_context():
message = angular.angular_convention('tag', 'message', '')

if not ('tag: message\n'):
raise AssertionError()


def test_changelog_convention():
message = changelog.changelog_convention('tag', 'message')

if not ('TAG: message\n'):
raise AssertionError()


def test_symphony_convention():
message = symphony.symphony_convention('tag', 'message')

if not ('[Tag] message\n'):
raise AssertionError()


def test_no_convention():
inputs = [
"message",
"message",
]

def mock_input(s):
return inputs.pop(0)
no_convention.input = mock_input

message = no_convention.just_message()
if not message == 'Message\n':
raise AssertionError()
1 change: 1 addition & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_get_text():

def mock_input(s):
return inputs.pop(0)

utils.input = mock_input
a, b = utils.get_text()
if not a == 'tag':
Expand Down