shtab icon indicating copy to clipboard operation
shtab copied to clipboard

Fix subcommand/choices completion in bash

Open brentyi opened this issue 3 years ago • 1 comments

  1. The choices list was formerly not being expanded correctly.
  2. Removing local IFS=$'\\n' fixed some issues as well. Wasn't totally following why this was needed.

brentyi avatar Sep 09 '22 13:09 brentyi

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 47.11 ⛔ 47.11 ⛔ 0.00
Method Length 136.70 😞 136.70 😞 0.00
Working memory 1.67 ⭐ 1.67 ⭐ 0.00
Quality 25.93% 😞 25.93% 😞 0.00%
Other metrics Before After Change
Lines 763 764 1
Changed files Quality Before Quality After Quality Change
shtab/init.py 25.93% 😞 25.93% 😞 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
shtab/init.py get_bash_commands 78 ⛔ 589 ⛔ 1.22% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
shtab/init.py complete_zsh 62 ⛔ 909 ⛔ 2.38% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
shtab/init.py complete_tcsh 53 ⛔ 470 ⛔ 4.99% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
shtab/init.py complete_bash 2 ⭐ 106 🙂 11 😞 64.30% 🙂 Extract out complex expressions
shtab/init.py add_argument_to 4 ⭐ 89 🙂 11 😞 64.67% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

sourcery-ai[bot] avatar Sep 09 '22 13:09 sourcery-ai[bot]

Codecov Report

Base: 74.46% // Head: 74.46% // No change to project coverage :thumbsup:

Coverage data is based on head (9bfda44) compared to base (13de419). Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #106   +/-   ##
=======================================
  Coverage   74.46%   74.46%           
=======================================
  Files           2        2           
  Lines          47       47           
=======================================
  Hits           35       35           
  Misses         12       12           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Oct 29 '22 14:10 codecov-commenter

/tag v1.5.6 f8203d9

casperdcl avatar Oct 29 '22 14:10 casperdcl

Thanks @casperdcl!!

brentyi avatar Oct 29 '22 16:10 brentyi

Ah, unsetting IFS in between did the trick! Thanks for fixing this!

NiklasReisser avatar Oct 29 '22 18:10 NiklasReisser

Yep was unreasonably hard to figure out. Can't tell what's worse about shells - the language itself, or the (lack of) good documentation. 🤺😅

casperdcl avatar Oct 29 '22 19:10 casperdcl