Giter Club home page Giter Club logo

gitcommit's Introduction

Designer and Engineer, Product Development at Mytos

Current experience... Javascript, Typescript, React, Node.js, Heroku, AWS, Docker, MQTT (PubSub), Raspberry Pi

Past experience... Python, C/C++, Java

LinkedIn

gitcommit's People

Contributors

nebbles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

merc1031 adityaj7

gitcommit's Issues

Improve colour scheme

Update the colour palette of the tool. Colour support, compatibility and 'fallbacks' need to be checked then doing this.

Add history for the extra args field

Many fields save history to allow up arrow key to reuse recently used commands.

This would be useful to be extended to the "Extra args" field for adding to the commit command.

Support for co-authors

To support co-authors on GitHub, the following trailer needs to be added to the commit

Co-authored-by: Firstname Lastname <[email protected]>
  • There must be at least one blank line between this line and the previous lines of the commit (two is recommended)

Additional features:

  • It would be useful if gitcommit can cache these authors and save them in a global config since typing them out every time would become a pain.
  • It would be very useful if you could type in a GitHub username e.g. nebbles@gh and gitcommit automatically detects and attempts to resolve the public email from the GitHub profile page (and possibly full name?)

Retry commit

Often find I missed --no-verify

Would be good if a commit could be reattempted but with the flag added

History for composer fields

Each composer should hold a history to the previous entries into that particular composer. That way aborted commits can be recalled and partially restored easier.

Callable from `git cc` (custom git command)

This tool should be callable by using the command git cc

This is possible by simply adding an executable to your path such as git-refresh to create git refresh. See these articles for reference [1] [2]

Solution

Modify pyproject.toml as follows

[tool.poetry.scripts]
gitcommit = "gitcommit.gitcommit:main"
+ git-cz = "gitcommit.gitcommit:main"

Needs tests

The tool is building to the level that it desperately needs tests to be able to ensure things don't break when adding new features.

Unsure on how to handle prompt input though.

Issue with FuzzyCompleter import

From @PA17

Traceback (most recent call last):
  File "/usr/local/bin/gitcommit", line 6, in <module>
    from gitcommit.gitcommit import main
  File "/usr/local/lib/python3.7/site-packages/gitcommit/gitcommit.py", line 39, in <module>
    from .completers import TypeCompleter, FooterCompleter
  File "/usr/local/lib/python3.7/site-packages/gitcommit/completers.py", line 1, in <module>
    from prompt_toolkit.completion import (  # pylint: disable=no-name-in-module
ImportError: cannot import name 'FuzzyCompleter' from 'prompt_toolkit.completion' (/usr/local/lib/python3.7/site-packages/prompt_toolkit/completion/__init__.py)

Update accepted types

Accepted types have been updated in the company guidelines. Perhaps this should be externalised to the tool so templates can be built for a company/worflow specific person or repository?

Version checks with erroneous calculation

When checking current version against latest fetch-able version, it incorrectly evaluates which version takes precedence.

Example

Commit has been made to conventional commits standards!
There is an update available for conventional-commit.
Version 0.3.0 โ†’ 0.2.8
Added to your clipboard: pip install --upgrade conventional-commit

Update readme

The readme needs to be updated with better information on the features available.

Scopes config

There should be a per project config to define acceptable scopes. Without this, as observed in some company repos, they become random and sporadic. Defining scopes is a sensible step towards ensuring they are used properly.

Review CI

Currently use Travis. Should review whether CircleCI or GitHub actions are better options.

Recommend that user expands window size

If the current terminal window is less that 80 characters, a reminder should pop up to suggest that the user expands it to at least 80 characters (to show line wrapping properly).

Network error catching refactor

Network exception was thrown when checking for updates. This should be refactored to show more useful errors related to networking.

Note that this was already emergency patched in 6f426d1.

Traceback below (submitted by @PA17)

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 588, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 248, in _get_conn
    return conn or self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 826, in _new_conn
    raise SSLError("Can't connect to HTTPS URL because the SSL "
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/nebbles/gitcommit/tags (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/gitcommit", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/gitcommit/gitcommit.py", line 396, in main
    run()
  File "/usr/local/lib/python3.7/site-packages/gitcommit/gitcommit.py", line 391, in run
    check_for_update()
  File "/usr/local/lib/python3.7/site-packages/gitcommit/updater.py", line 37, in check_for_update
    tags = get_github_tags()
  File "/usr/local/lib/python3.7/site-packages/gitcommit/updater.py", line 12, in get_github_tags
    resp = requests.get("https://api.github.com/repos/nebbles/gitcommit/tags")
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/nebbles/gitcommit/tags (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

Update notification

Tool should recognise when it is out of date and suggest an update pip upgrade conventional-commit

Print staged changes for commit

Would be useful to print just the files staged for commit at the start of the commit process.

Probably should be toggle-able in the future in a preferences file.

Shortcut to enter new lines

Alternative means to entering new lines in a multi-line text entry (currently Enter, preceded by Esc if you want to submit).

Option 1 (closest to current):

  • If the field is empty, Enter will submit the field as empty. [existing]
  • Enter will add a new line return. [existing]
  • Esc immediately preceding Enter will mean field is submitted. [existing]
  • Cmd+Enter shortcut will submit the field without need for Esc key. [new]
  • Shift+Enter shortcut will submit the field too? [new]

Option 2:

  • Enter key will always submit the field.
  • Shift+Enter to add new line return.

Configuration file could allow setting preference for this behaviour.

Crash on windows

Salavat, on Windows:

9  wip       Any code changes that are work in progress; they may not build                  (use these sparingly!)
Traceback (most recent call last):
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\eventloop\context.py", line 89, in get
   return self._storage[ctx]
KeyError: 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\output\defaults.py", line 58, in get_default_output
   value = _default_output.get()
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\eventloop\context.py", line 91, in get
   raise TaskLocalNotSetError
prompt_toolkit.eventloop.context.TaskLocalNotSetError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "c:\users\user1\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
   "__main__", mod_spec)
 File "c:\users\user1\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
   exec(code, run_globals)
 File "C:\Users\User1\AppData\Local\Programs\Python\Python37\Scripts\gitcommit.exe\__main__.py", line 7, in <module>
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\gitcommit\gitcommit.py", line 396, in main
   run()
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\gitcommit\gitcommit.py", line 352, in run
   commit_msg = add_type(commit_msg)
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\gitcommit\gitcommit.py", line 143, in add_type
   ANSI(text), completer=TypeCompleter(), validator=TypeValidator(valid_inputs),
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 903, in prompt
   session = PromptSession(input=input, output=output, history=history)
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 344, in __init__
   output = output or get_default_output()
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\output\defaults.py", line 67, in get_default_output
   return create_output()
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\output\defaults.py", line 41, in create_output
   return Win32Output(stdout)
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\output\win32.py", line 99, in __init__
   info = self.get_win32_screen_buffer_info()
 File "c:\users\user1\appdata\local\programs\python\python37\lib\site-packages\prompt_toolkit\output\win32.py", line 194, in get_win32_screen_buffer_info
   raise NoConsoleScreenBufferError
prompt_toolkit.output.win32.NoConsoleScreenBufferError: Found xterm, while expecting a Windows console. Maybe try to run this program using "winpty" or run it in cmd.exe instead. Or otherwise, in case of Cygwin, use the Python executable that is compiled for Cygwin.

Version bumping

Depending on project language, there may be various places where a version bump would be desired. In the first instance this should be configured in a config file unique to this tool.

Perhaps there is scope to add options for integrating the config into native config files such as pyproject.toml for Python projects.

New name

The tool needs a new independent (of gitcommit) name

Improved CLI

Overview

CLI control should be enhanced. The current proposal is to introduce a number of flags to customise the visual experience of the tool (such as verbose / minimal), and to implement larger additional features as commands.

Example

An example can be seen from woile/commitizen

$ cz --help
usage: cz [-h] [--debug] [-n NAME] [--version]
        {ls,commit,c,example,info,schema,bump} ...

Commitizen is a cli tool to generate conventional commits.
For more information about the topic go to https://conventionalcommits.org/

optional arguments:
-h, --help            show this help message and exit
--debug               use debug mode
-n NAME, --name NAME  use the given commitizen
--version             get the version of the installed commitizen

commands:
{ls,commit,c,example,info,schema,bump}
    ls                  show available commitizens
    commit (c)          create new commit
    example             show commit example
    info                show information about the cz
    schema              show commit schema
    bump                bump semantic version based on the git log

Proposed Commands

  • config used to generate, possibly modify repo specific configuration
  • version <major|minor|patch> allows single command to increase version numbers
  • example shows some examples of the output of the tool
  • help provides guidance on the use of the tool
  • check (#18) lints the input string to see if it adheres to standards
  • format takes a string as input and does its best to auto format to standards

Proposed Flags

  • help shows help message
  • version shows version of package
  • verbose more contextual information given to the committer
  • minimal reduce interface to bare minimum
  • no-colour removes colour component from formatted text
  • spell-check would open message in editor at end to allow for spell checking

Support for skip ci

Add support for skip ci in git commit messages.

Will need to check how different tools (Travis, Circle, etc) work to skip ci. Hopefully they do not require it to be in the first line, and will accept it being in the footer where it should be.

URLs in the body are broken by new lines

URLs if they cause a line to exceed its maximum length should be moved onto their own line. The URL on that line should remain unbroken (it may exceed the line limit).

Refactor overhaul

A major overhaul is needed. Currently the approach is functional, but already it is getting messy and the need for globals is pressing. Moving to a class based system could be a way out. Or a major revamp of the functional approach is necessary.

Important changes needed as part of this rework:

  • Revamp functional or move to class based approach
  • Test written for new functions/methods
  • New history object for storing history for input fields to files

Sanitise inputs properly

Update to cleanse input and format to company standards. Examples:

  • " cannot be used anywhere in message as it will break message when sent to command line.
  • there should not be leading or trailing white space
  • Capitalisation should occur in the right place
  • There should be no period at the end of the description

Consequent sentences drop capitalised letter in body composer

The following input

Tool will now check for updates posted as tag to the GitHub repository against the 
current version of the tool. This check runs every time the tool completes the final 
confirmation question.

was reformatted to

Tool will now check for updates posted as tag to the github repository
against the current version of the tool. this check runs every time the
tool completes the final confirmation question.

Tidy up prompts after stage complete

Aim

It would be good to tidy up the prompt after each input stage. Long lists explanations etc wouldn't be shown and a formatted result of what you input would be shown.

Progress

Check questionary source to see how they implemented it.

Support for bulleted list in body

Support for the bulleted list (of markdown variety using * or -) should be added to the body input stage.

Requirements for this enhancement are

  • Multiline text input needs to be supported in the body input.
  • Extraneous white space more than a single line break, should be removed, such that the body has no 'separation' in it.
  • * or - must be recognised as bullet point characters if they are at the start of a new line. The character must be converted to one of the two as standard (which is yet to be determined).
  • The string following this character should be wrapped and indented properly, w.r.t. the bullet point, up until a new line break.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.