Skip to content
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

Terminal output #39

Merged
merged 11 commits into from Nov 20, 2019
Merged

Terminal output #39

merged 11 commits into from Nov 20, 2019

Conversation

bjoernricks
Copy link
Member

@bjoernricks bjoernricks commented Nov 20, 2019

Improve console output formatting.

  • Add Terminal class for console output
  • Allow for indentation of following output
  • Display message status at the right end of the current console line

E.g. hook output is now:

autohooks => pre-commit
    Running autohooks.plugins.black                                 
        Running black pre-commit hook
        No staged files for black available                                        [ ok ]                                                                                                                                                                                                  
    Running autohooks.plugins.pylint                                 
        Running pylint pre-commit hook
        No files to lint                                                           [ ok ]                                                                                                                                                                                

Checklist:

The Terminal class will improve the formatting. It allows for
indentation and displaying the status at the right end of the current
terminal line.
Mocking Terminal from blessings was very difficult because properties
are added during runtime like the color methods. Therefore auto mocking
doesn't work.
Use the terminal class instead of the function in the hooks API.
Also improve the output by adding indentation.
The functionality is provided by the Terminal class now.
The hooks plugins should use the current terminal instance for their
output to use the actual indentation.
Mock.assert_called() doesn't exist before Python 3.6.
@codecov
Copy link

codecov bot commented Nov 20, 2019

Codecov Report

Merging #39 into master will increase coverage by 1.34%.
The diff coverage is 31.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   42.17%   43.51%   +1.34%     
==========================================
  Files          13       13              
  Lines         524      563      +39     
==========================================
+ Hits          221      245      +24     
- Misses        303      318      +15
Impacted Files Coverage Δ
autohooks/cli/check.py 0% <0%> (ø) ⬆️
autohooks/cli/activate.py 0% <0%> (ø) ⬆️
autohooks/precommit/run.py 0% <0%> (ø) ⬆️
autohooks/terminal.py 94.59% <94.44%> (+25.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91bba97...f4c55a4. Read the comment docs.

@bjoernricks bjoernricks merged commit 18a043d into greenbone:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants