Code analysis on injected instances

2007-10-16
2013-03-15
  • Caffee Latte

    Caffee Latte - 2007-10-16

    Hi,
    code analysis will mark "Log" (which is an object instance) as undefined variable:

    [...]
    import time
    import os

    Log.Write('$ running %s version %s $'%(module, script_version))
    [...]

    "Log" is an injected instance and does not get defined or instantiated anywhere in the py code.

    Adding "Log" to the PyPev Preferences under "consider the following names as globals" will not change code analysis behavior of flagging it as undefined.

    Is there any way to change this and don't have it appear as undefined.
    Thanks
        Bjoern

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2007-10-16
       
    • Caffee Latte

      Caffee Latte - 2007-10-17

      Hi Fabio,
      close but not yet there.

      Unfortunately there is no python module that defines the the class for the instantiated Log that I could add the suggested code analysis directive to.
      We run our python scripts embedded and do pass the log object from the process the python interpreter is embedded in to the executed script.

      Non the less pyDev(ext) have become very handy for writing the code with the one downside that we have all (there are more than just Log) our injected instances as being not defined. Which kind of bloats the problems list.

      Any other hints ?

      Tanks
          Bjoern

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2007-10-17

        Hummm... Ok, understood...

        Actually, it should work when you add it to the preferences as "consider the following names as globals". It does work if you just access 'Log' without any attribute access, but it doesn't when you do 'Log.write' -- so, it's a bug that should be fixed... I'll try to make that for the next release.

        Cheers,

        Fabio

         
        • Caffee Latte

          Caffee Latte - 2007-10-17

          Fabio,

          It's in the preferences and yes it does work with accessing Log directly as in:

          if Log:
              pass

          But not with the attributes as illustrated before.

          Having that in the next release would be great.
          Tanks!
              Bjoern

           
        • Caffee Latte

          Caffee Latte - 2007-11-23

          Hi Fabio,

          I checked this in the current release 1.3.10 and did not find any changes in the behavior.

          Did you make any changes to improve this or has it been pushed back to a later release?
          Should I enter a bug track or feature request entry to keep this in focus?

          Tanks for your efforts.
          Best regards
             Bjoern

           
          • Fabio Zadrozny

            Fabio Zadrozny - 2007-11-25

            It was pushed to a later release... Please report it as a bug (I usually pick what to do from the feature/bug requests).

            Cheers,

            Fabio

             

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks