Skip to content

Conversation

@cclauss
Copy link

@cclauss cclauss commented Nov 18, 2018

Fore and Back are used on line 128 but they are never defined or imported. That means that they are undefined names which have the potential to raise NameError at runtime.

flake8 testing of https://github.com/python-cmd2/cmd2 on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./examples/plumbum_colors.py:127:21: F821 undefined name 'Fore'
        color_off = Fore.RESET + Back.RESET
                    ^
./examples/plumbum_colors.py:127:34: F821 undefined name 'Back'
        color_off = Fore.RESET + Back.RESET
                                 ^

__Fore__ and __Back__ are used on line 128 but they are never defined or imported.  That means that they are _undefined names_  which have the potential to raise NameError at runtime.

[flake8](http://flake8.pycqa.org) testing of https://github.com/python-cmd2/cmd2 on Python 3.7.1

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./examples/plumbum_colors.py:127:21: F821 undefined name 'Fore'
        color_off = Fore.RESET + Back.RESET
                    ^
./examples/plumbum_colors.py:127:34: F821 undefined name 'Back'
        color_off = Fore.RESET + Back.RESET
                                 ^
```
@cclauss cclauss requested a review from tleonhardt as a code owner November 18, 2018 00:56
@codecov
Copy link

codecov bot commented Nov 18, 2018

Codecov Report

Merging #599 into master will increase coverage by 1.16%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
+ Coverage   92.15%   93.31%   +1.16%     
==========================================
  Files          11       11              
  Lines        3185     3185              
==========================================
+ Hits         2935     2972      +37     
+ Misses        250      213      -37
Impacted Files Coverage Δ
cmd2/cmd2.py 94.42% <0%> (+0.91%) ⬆️
cmd2/clipboard.py 94.44% <0%> (+22.22%) ⬆️
cmd2/rl_utils.py 97.43% <0%> (+43.58%) ⬆️

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 fc0ce00...bb369d9. Read the comment docs.

@tleonhardt tleonhardt self-assigned this Nov 18, 2018
@tleonhardt tleonhardt added the bug label Nov 18, 2018
@tleonhardt tleonhardt added this to the 0.9.7 milestone Nov 18, 2018
@tleonhardt
Copy link
Member

@cclauss Thanks for the PR.

It looks like we accidentally have a cut-and-paste error from when we copied this example from another one. The intent is that this example should purely use plumbum instead of colorama. So the Fore and Back shouldn't be used at all. But we can fix that in another PR.

Thanks for finding and fixing this bug!

@tleonhardt tleonhardt merged commit 874c126 into python-cmd2:master Nov 18, 2018
@cclauss cclauss deleted the patch-1 branch November 18, 2018 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants