discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Static Code Analysis for OpenSCAD

A
adrianv
Sat, Nov 21, 2020 6:52 PM

julianstirling wrote

While you need to do quite a number of commands to
accomplish tasks, there is nothing stopping you breaking these up into
variable, smaller functions and modules.

Actually I feel like there is a trade-off here that I struggle with.  If I
have a computation that I would like to embed in a function but it returns 5
values then I have to return the five values as a list without any semantic
tags about what the list entries mean.  This creates a different kind of
complexity.  Do I want to have my code littered with confusing references
like return[3] and return[4]?  Do I unpack the return with

radius=return[0],
length=return[1],
scale=return[2],
etc

Or do I just give up on modularity and embed the calculation?  I tend to
find that I'm unlikely to embed a calculation unless it's actually used
multiple places because the extra mess and complexity of doing so isn't
worth it.

--
Sent from: http://forum.openscad.org/

julianstirling wrote > While you need to do quite a number of commands to > accomplish tasks, there is nothing stopping you breaking these up into > variable, smaller functions and modules. Actually I feel like there is a trade-off here that I struggle with. If I have a computation that I would like to embed in a function but it returns 5 values then I have to return the five values as a list without any semantic tags about what the list entries mean. This creates a different kind of complexity. Do I want to have my code littered with confusing references like return[3] and return[4]? Do I unpack the return with radius=return[0], length=return[1], scale=return[2], etc Or do I just give up on modularity and embed the calculation? I tend to find that I'm unlikely to embed a calculation unless it's actually used multiple places because the extra mess and complexity of doing so isn't worth it. -- Sent from: http://forum.openscad.org/
D
David
Sat, Nov 21, 2020 7:10 PM

I don't know if my original post on this topic got through the mill or
not but I wanted to say the code analyzer is a GREAT addition to our
toolboxes!  I'm so appreciative that the author did this.  I've only
been coding since 1977 (both professionally and for fun!) so I don't
have a lot of experience.  :)

Lexical analyzers are a BEAR to write, especially for such a niche
tool.  OpenSCAD is a marvelous program fhat fills a pressing need, esp
for those of us with no artistic talent like me...  A parametric
programmer that can turn ideas and equations into graphical concepts
that can then actually then be realized in the physical world, via 3D
printing or other methods, is the stuff of science fiction!  And now a
tool that helps us write our "programs" better - just leaves me
speechless (evidence to the contrary notwithstanding...)

Thanks for this wonderful tool!

David Merchant

On 11/21/20 12:52 PM, adrianv wrote:

julianstirling wrote

While you need to do quite a number of commands to
accomplish tasks, there is nothing stopping you breaking these up into
variable, smaller functions and modules.

Actually I feel like there is a trade-off here that I struggle with.  If I
have a computation that I would like to embed in a function but it returns 5
values then I have to return the five values as a list without any semantic
tags about what the list entries mean.  This creates a different kind of
complexity.  Do I want to have my code littered with confusing references
like return[3] and return[4]?  Do I unpack the return with

radius=return[0],
length=return[1],
scale=return[2],
etc

Or do I just give up on modularity and embed the calculation?  I tend to
find that I'm unlikely to embed a calculation unless it's actually used
multiple places because the extra mess and complexity of doing so isn't
worth it.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I don't know if my original post on this topic got through the mill or not but I wanted to say the code analyzer is a GREAT addition to our toolboxes!  I'm so appreciative that the author did this.  I've only been coding since 1977 (both professionally and for fun!) so I don't have a lot of experience.  :) Lexical analyzers are a BEAR to write, especially for such a niche tool.  OpenSCAD is a marvelous program fhat fills a pressing need, esp for those of us with no artistic talent like me...  A parametric programmer that can turn ideas and equations into graphical concepts that can then actually then be realized in the physical world, via 3D printing or other methods, is the stuff of science fiction!  And now a tool that helps us write our "programs" better - just leaves me speechless (evidence to the contrary notwithstanding...) Thanks for this wonderful tool! David Merchant On 11/21/20 12:52 PM, adrianv wrote: > julianstirling wrote >> While you need to do quite a number of commands to >> accomplish tasks, there is nothing stopping you breaking these up into >> variable, smaller functions and modules. > Actually I feel like there is a trade-off here that I struggle with. If I > have a computation that I would like to embed in a function but it returns 5 > values then I have to return the five values as a list without any semantic > tags about what the list entries mean. This creates a different kind of > complexity. Do I want to have my code littered with confusing references > like return[3] and return[4]? Do I unpack the return with > > radius=return[0], > length=return[1], > scale=return[2], > etc > > Or do I just give up on modularity and embed the calculation? I tend to > find that I'm unlikely to embed a calculation unless it's actually used > multiple places because the extra mess and complexity of doing so isn't > worth it. > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
J
julianstirling
Sun, Nov 22, 2020 3:30 PM

Thanks to the wonderful example that @lar3ry and @nophead I have found a
number of issues and fixed them. SCA2D now parses NopSCADlib/libtest.scad
without problems (but it takes a while!!). The only caveat to that is that
list comprehensions are lexed and parsed, but not analysed yet.

It took me a while to finally get the logic correct for include/use. There
are a number of different ways to interpret the website when it says:

OpenSCAD executes nested calls to include and use. There is one caveat to
this, that use brings functions and modules only into the local file
context. As a result, nested calls to use have no effect on the
environment of the base file; the child use call works in the parent use
context, but the modules and functions so imported fall out of context
before they are seen by the base context.

Mostly, about what happens when your chain of imports flicks back from use
to import to use to import a few times. I think I have it right now!

You can try the newest version with:
pip install sca2d --upgrade

"adrianv wrote: wrote

Actually I feel like there is a trade-off here that I struggle with.  If I
have a computation that I would like to embed in a function but it returns
5
values then I have to return the five values as a list without any
semantic
tags about what the list entries mean.  This creates a different kind of
complexity.  Do I want to have my code littered with confusing references
like return[3] and return[4]?

There are always trade off. The inability of C-style languages to do named
variable returns does make things confusing. A static code analyser flags
things that it thinks might be confusing. It is up to the author to decide
what is clearest. To paraphrase Guido van Rossum - Foolishly following
everything a code analyser tells you is the Hobgoblin of Little Minds.

skypuppy wrote

Lexical analyzers are a BEAR to write, especially for such a niche
tool.

Ha! I am starting to realise this! If I had started with these damn list
comprehensions I might have just given up! Thanks for the encouragement.

Does anyone know what the exact regex is that OpenSCAD uses for variable
names? I have been doing this by trial and error. Perhaps because I don't
understand GNU Bison.

--
Sent from: http://forum.openscad.org/

Thanks to the wonderful example that @lar3ry and @nophead I have found a number of issues and fixed them. SCA2D now parses NopSCADlib/libtest.scad without problems (but it takes a while!!). The only caveat to that is that list comprehensions are lexed and parsed, but not analysed yet. It took me a while to finally get the logic correct for include/use. There are a number of different ways to interpret the website when it says: > OpenSCAD executes nested calls to include and use. There is one caveat to > this, that use brings functions and modules only into the local file > context. As a result, nested calls to use have no effect on the > environment of the base file; the child use call works in the parent use > context, but the modules and functions so imported fall out of context > before they are seen by the base context. Mostly, about what happens when your chain of imports flicks back from use to import to use to import a few times. I think I have it right now! You can try the newest version with: pip install sca2d --upgrade "adrianv wrote: wrote > Actually I feel like there is a trade-off here that I struggle with. If I > have a computation that I would like to embed in a function but it returns > 5 > values then I have to return the five values as a list without any > semantic > tags about what the list entries mean. This creates a different kind of > complexity. Do I want to have my code littered with confusing references > like return[3] and return[4]? There are always trade off. The inability of C-style languages to do named variable returns does make things confusing. A static code analyser flags things that it thinks might be confusing. It is up to the author to decide what is clearest. To paraphrase Guido van Rossum - Foolishly following everything a code analyser tells you is the Hobgoblin of Little Minds. skypuppy wrote > Lexical analyzers are a BEAR to write, especially for such a niche > tool. Ha! I am starting to realise this! If I had started with these damn list comprehensions I might have just given up! Thanks for the encouragement. Does anyone know what the exact regex is that OpenSCAD uses for variable names? I have been doing this by trial and error. Perhaps because I don't understand GNU Bison. -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Sun, Nov 22, 2020 5:36 PM

On 22.11.20 16:30, julianstirling wrote:

Does anyone know what the exact regex is that OpenSCAD uses
for variable names? I have been doing this by trial and error.
Perhaps because I don't understand GNU Bison.

Possible names are defined in the lexer file (TOK_ID):

https://github.com/openscad/openscad/blob/master/src/lexer.l#L256

ciao,
Torsten.

On 22.11.20 16:30, julianstirling wrote: > Does anyone know what the exact regex is that OpenSCAD uses > for variable names? I have been doing this by trial and error. > Perhaps because I don't understand GNU Bison. Possible names are defined in the lexer file (TOK_ID): https://github.com/openscad/openscad/blob/master/src/lexer.l#L256 ciao, Torsten.
NH
nop head
Sun, Nov 22, 2020 5:54 PM

I ran the latest version on my library test file, that invokes nearly all
my library and got this.

sca2d libtest.scad
libtest.scad passed all checks!

Does that mean it finds nothing controversial in my entire library or is it
not testing used modules? I.e. all the tests are fairly simple code but
they call into the rest of the library.

On Sun, 22 Nov 2020 at 17:36, Torsten Paul Torsten.Paul@gmx.de wrote:

On 22.11.20 16:30, julianstirling wrote:

Does anyone know what the exact regex is that OpenSCAD uses
for variable names? I have been doing this by trial and error.
Perhaps because I don't understand GNU Bison.

I ran the latest version on my library test file, that invokes nearly all my library and got this. sca2d libtest.scad libtest.scad passed all checks! Does that mean it finds nothing controversial in my entire library or is it not testing used modules? I.e. all the tests are fairly simple code but they call into the rest of the library. On Sun, 22 Nov 2020 at 17:36, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 22.11.20 16:30, julianstirling wrote: > > Does anyone know what the exact regex is that OpenSCAD uses > > for variable names? I have been doing this by trial and error. > > Perhaps because I don't understand GNU Bison. > > Possible names are defined in the lexer file (TOK_ID): > > https://github.com/openscad/openscad/blob/master/src/lexer.l#L256 > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
J
julianstirling
Sun, Nov 22, 2020 6:00 PM

Great. If I can ask a silly question? If the match is:
"$"?[a-zA-Z0-9_]+
what stops you naming a variable 99? Is it only priority of it deciding that
is a number? What about 2() as a function? Both seem disallowed for obvious
reasons. I have handled this explicitly, but I think I come to the same
result in the end.

--
Sent from: http://forum.openscad.org/

Great. If I can ask a silly question? If the match is: "$"?[a-zA-Z0-9_]+ what stops you naming a variable 99? Is it only priority of it deciding that is a number? What about 2() as a function? Both seem disallowed for obvious reasons. I have handled this explicitly, but I think I come to the same result in the end. -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Sun, Nov 22, 2020 7:58 PM

On 22.11.20 19:00, julianstirling wrote:

Great. If I can ask a silly question? If the match is:
"$"?[a-zA-Z0-9_]+
what stops you naming a variable 99? Is it only priority of
it deciding that is a number? What about 2() as a function?

Main rule is to return the longest match, tie breaker is the
rule listed first in the lexer file:

https://www.cs.virginia.edu/~cr4bd/flex-manual/Matching.html#Matching

I believe the TOK_ID rule is an accident (that names can start
with a digit), but probably not possible to change anymore.

ciao,
Torsten.

On 22.11.20 19:00, julianstirling wrote: > Great. If I can ask a silly question? If the match is: > "$"?[a-zA-Z0-9_]+ > what stops you naming a variable 99? Is it only priority of > it deciding that is a number? What about 2() as a function? Main rule is to return the longest match, tie breaker is the rule listed first in the lexer file: https://www.cs.virginia.edu/~cr4bd/flex-manual/Matching.html#Matching I believe the TOK_ID rule is an accident (that names can start with a digit), but probably not possible to change anymore. ciao, Torsten.
J
julianstirling
Sun, Nov 22, 2020 8:11 PM

@nophead: "Does that mean it finds nothing controversial in my entire library
or is it not testing used modules"

No. so I am using the philosophy that if you ask it to check a file then it
checks just that file. It just needs to parse everything else to understand
it. I am not even testing included files. I need to think about whether this
is a good idea. My main thought is if I include someone else's library I
can't change the code so getting tonnes of warnings is not helpful.

Currently I am using bash to loop through different files in a project. This
uses a lot of overhead as you reparse the files. In the next version I will
make a way to loop over all files without reparsing them.

--
Sent from: http://forum.openscad.org/

@nophead: "Does that mean it finds nothing controversial in my entire library or is it not testing used modules" No. so I am using the philosophy that if you ask it to check a file then it checks just that file. It just needs to parse everything else to understand it. I am not even testing included files. I need to think about whether this is a good idea. My main thought is if I include someone else's library I can't change the code so getting tonnes of warnings is not helpful. Currently I am using bash to loop through different files in a project. This uses a lot of overhead as you reparse the files. In the next version I will make a way to loop over all files without reparsing them. -- Sent from: http://forum.openscad.org/
NH
nop head
Sun, Nov 22, 2020 9:03 PM

I get this running on the main file of a large project.

WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
WARNING:root:Unexpected args sent to warning E3002. This is a problem with
SCA2D not with your scad code.
Traceback (most recent call last):
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\runpy.py",
line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\runpy.py",
line 85, in run_code
exec(code, run_globals)
File
"C:\Users\ChrisP\AppData\Local\Programs\Python\Python38-32\Scripts\sca2d.exe_main
.py",
line 7, in <module>
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d_main
.py",
line 37, in main
parsed = analyser.analyse_file(args.filename,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\sca2d.py",
line 83, in analyse_file
scope.analyse_tree(self)
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 71, in analyse_tree
self._check_defintions(analyser)
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 81, in _check_defintions
defs_and_msgs = self.get_external_defintions(analyser,count_own=False)
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 124, in get_external_defintions
defs = _loop_over_external_files(self._included_files,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 197, in _loop_over_external_files
defs_and_msgs = file_scope.get_external_defintions(analyser,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 116, in get_external_defintions
defs = _loop_over_external_files(self._used_files,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 197, in _loop_over_external_files
defs_and_msgs = file_scope.get_external_defintions(analyser,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 124, in get_external_defintions
defs = _loop_over_external_files(self._included_files,
File
"c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py",
line 200, in _loop_over_external_files
for message in defs_and_msgs[3]:
TypeError: 'Message' object is not iterable

On Sun, 22 Nov 2020 at 20:11, julianstirling julian@julianstirling.co.uk
wrote:

@nophead: "Does that mean it finds nothing controversial in my entire
library
or is it not testing used modules"

No. so I am using the philosophy that if you ask it to check a file then it
checks just that file. It just needs to parse everything else to understand
it. I am not even testing included files. I need to think about whether
this
is a good idea. My main thought is if I include someone else's library I
can't change the code so getting tonnes of warnings is not helpful.

Currently I am using bash to loop through different files in a project.
This
uses a lot of overhead as you reparse the files. In the next version I will
make a way to loop over all files without reparsing them.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I get this running on the main file of a large project. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. WARNING:root:Unexpected args sent to warning E3002. This is a problem with SCA2D not with your scad code. Traceback (most recent call last): File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\ChrisP\AppData\Local\Programs\Python\Python38-32\Scripts\sca2d.exe\__main__.py", line 7, in <module> File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\__main__.py", line 37, in main parsed = analyser.analyse_file(args.filename, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\sca2d.py", line 83, in analyse_file scope.analyse_tree(self) File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 71, in analyse_tree self._check_defintions(analyser) File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 81, in _check_defintions defs_and_msgs = self.get_external_defintions(analyser,count_own=False) File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 124, in get_external_defintions defs = _loop_over_external_files(self._included_files, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 197, in _loop_over_external_files defs_and_msgs = file_scope.get_external_defintions(analyser, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 116, in get_external_defintions defs = _loop_over_external_files(self._used_files, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 197, in _loop_over_external_files defs_and_msgs = file_scope.get_external_defintions(analyser, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 124, in get_external_defintions defs = _loop_over_external_files(self._included_files, File "c:\users\chrisp\appdata\local\programs\python\python38-32\lib\site-packages\sca2d\outerscope.py", line 200, in _loop_over_external_files for message in defs_and_msgs[3]: TypeError: 'Message' object is not iterable On Sun, 22 Nov 2020 at 20:11, julianstirling <julian@julianstirling.co.uk> wrote: > @nophead: "Does that mean it finds nothing controversial in my entire > library > or is it not testing used modules" > > No. so I am using the philosophy that if you ask it to check a file then it > checks just that file. It just needs to parse everything else to understand > it. I am not even testing included files. I need to think about whether > this > is a good idea. My main thought is if I include someone else's library I > can't change the code so getting tonnes of warnings is not helpful. > > Currently I am using bash to loop through different files in a project. > This > uses a lot of overhead as you reparse the files. In the next version I will > make a way to loop over all files without reparsing them. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
J
julianstirling
Sun, Nov 22, 2020 9:19 PM

Ah man. I need to do some unit tests on the file importing! Seems to be the
biggest issue so far!

So while that message is pretty unhelpful what it is saying is that it can't
open the file because it cannot find the file. Are you using a library path
somehow rather than a relative link? I need to get an extensive list of
where OpenSCAD looks and also make a way to pass in the library file.

I'll patch this bug tomorrow.

--
Sent from: http://forum.openscad.org/

Ah man. I need to do some unit tests on the file importing! Seems to be the biggest issue so far! So while that message is pretty unhelpful what it is saying is that it can't open the file because it cannot find the file. Are you using a library path somehow rather than a relative link? I need to get an extensive list of where OpenSCAD looks and also make a way to pass in the library file. I'll patch this bug tomorrow. -- Sent from: http://forum.openscad.org/