M
Michael Yanowitz
Hello:
I ran the new pylint and my code and I had a few questions on why those
are warnings or what I can do to fix them:
1) W: 0: Too many lines in module (1587)
Why is 1587 considered too many lines? Would there be necessarily be an
advantage to split it up into 2 or 3 files? Can I up the limit?
2) C: 0: Missing required attribute "__revision__"
What is this? Is that for CVS? I don't use CVS (we use SVN). I have not
seen any sample code which includes this tag yet. But if I include
__revision 1.0 somewhere in the code it will remove that warning?
3) W:230:readDiscreteData: Using the global statement
What is wrong with using the global statement? I know the use of Globals
should be discouraged, but often they can't be avoided.
Suppose I have a constant. In C or C++, I could just use a #define and
it would be known throughout the whole file. In Python, there isn't a
similar construct, so rather than creating a large parameter list, of
constants, I like to use globals.
4) W:261:getDiscreteData: Catch "Exception"
What is wrong with that?
5) R:547:readDiscreteData: Too many branches (28/12)
Python doesn't have the switch/case statements that C/C++ have. So I
could have a large block if/elif/else statements.
Is there any way to avoid that?
6) R:722:waitDiscretes: Too many local variables (38/15)
That's new to me. What is wrong with too many local variables?
Can anything be done to improve that besides having too many globals?
7) W:933:sendStringToSocket: Redefining name 'nPortNumber' from outer scope
(line
What is wrong with using the same variable name in a function that is
used by its caller?
8) W:995:sendStringToSocket: Used builtin function 'map'
Is that a problem?
Plus many other warnings about my naming convention or unused variables
which I will ignore
at this time.
I did find it to be a very useful too any how in cleaning up my code.
I raised my code rate from about -8 to about +7.
Thanks:
Michael Yanowitz
I ran the new pylint and my code and I had a few questions on why those
are warnings or what I can do to fix them:
1) W: 0: Too many lines in module (1587)
Why is 1587 considered too many lines? Would there be necessarily be an
advantage to split it up into 2 or 3 files? Can I up the limit?
2) C: 0: Missing required attribute "__revision__"
What is this? Is that for CVS? I don't use CVS (we use SVN). I have not
seen any sample code which includes this tag yet. But if I include
__revision 1.0 somewhere in the code it will remove that warning?
3) W:230:readDiscreteData: Using the global statement
What is wrong with using the global statement? I know the use of Globals
should be discouraged, but often they can't be avoided.
Suppose I have a constant. In C or C++, I could just use a #define and
it would be known throughout the whole file. In Python, there isn't a
similar construct, so rather than creating a large parameter list, of
constants, I like to use globals.
4) W:261:getDiscreteData: Catch "Exception"
What is wrong with that?
5) R:547:readDiscreteData: Too many branches (28/12)
Python doesn't have the switch/case statements that C/C++ have. So I
could have a large block if/elif/else statements.
Is there any way to avoid that?
6) R:722:waitDiscretes: Too many local variables (38/15)
That's new to me. What is wrong with too many local variables?
Can anything be done to improve that besides having too many globals?
7) W:933:sendStringToSocket: Redefining name 'nPortNumber' from outer scope
(line
What is wrong with using the same variable name in a function that is
used by its caller?
8) W:995:sendStringToSocket: Used builtin function 'map'
Is that a problem?
Plus many other warnings about my naming convention or unused variables
which I will ignore
at this time.
I did find it to be a very useful too any how in cleaning up my code.
I raised my code rate from about -8 to about +7.
Thanks:
Michael Yanowitz