Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No class names generated? #59

Open
Bambofy opened this issue Jul 27, 2020 · 11 comments
Open

No class names generated? #59

Bambofy opened this issue Jul 27, 2020 · 11 comments

Comments

@Bambofy
Copy link

Bambofy commented Jul 27, 2020

##Description
When running the tool, the output code is incomplete, missing the class name.

  • Type: Bug

Bug

debian 10 64bit.
node version v10.21.0
version 0.1.0

.puml file:

@startuml

class Test

@enduml

puml2code command:
puml2code -i class_diagram.puml -o ./src/ -l cpp

puml2code output

Handlebars: Access has been denied to resolve the property "getFullName" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getExtends" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getPrivateFields" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getFields" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getConstructorArgs" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getMethods" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

C++ code output 'Test.h':

/**
 * \file .h
 */

#ifndef _h
#define _h




class  {
  private:
  protected:
  public:

  public:
    ()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // _h

@jupe
Copy link
Owner

jupe commented Jul 28, 2020

Looks a clear bug. probably there is no proper handling when class definition is empy. What happens if you add more content to class? Does example work for you? I’m on holiday so fix is coming a bit later. PR is also welcome :)

@Bambofy
Copy link
Author

Bambofy commented Jul 28, 2020

Ok thanks!

If i try the example this is the output (it doesn't save to a file):

Handlebars: Access has been denied to resolve the property "getFullName" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getExtends" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getPrivateFields" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getFields" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getConstructorArgs" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getMethods" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

/**
 * \file .h
 */

#ifndef _h
#define _h




class  {
  private:
  protected:
  public:

  public:
    ()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // _h

/**
 * \file .h
 */

#ifndef _h
#define _h




class  {
  private:
  protected:
  public:

  public:
    ()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // _h

/**
 * \file .h
 */

#ifndef _h
#define _h




class  {
  private:
  protected:
  public:

  public:
    ()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // _h

@Bambofy
Copy link
Author

Bambofy commented Jul 28, 2020

Just tested on my macbook, it doesn't work here their, exactly the same results, device details:

Catalina 10.15.6
Node version: 12.18.1

@Bambofy
Copy link
Author

Bambofy commented Jul 28, 2020

Works on my PC 64bit win10
Node v10.15.2

@jupe
Copy link
Owner

jupe commented Jul 29, 2020

so it didn’t work with node v12 but works with node v10 ? I don’t think that OS causes this..

@jupe
Copy link
Owner

jupe commented Jul 29, 2020

note that CI doesn’t validate currently node v12.. have to add it there as well

@jupe
Copy link
Owner

jupe commented Jul 30, 2020

I was not able to reproduce this issue yet with any node version. I added also node v12 to CI and same puml file you mention without luck. output looks correct to me: https://app.circleci.com/pipelines/github/jupe/puml2code/255/workflows/8573a73d-1c03-41a3-86ea-38bc13f2d4ea/jobs/778

/**
 * \file Test.h
 */

#ifndef Test_h
#define Test_h




class Test {
  private:
  protected:
  public:

  public:
    Test()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // Test_h

Tried also with Mac. CI are running with linux. How did you install tool ? via npm or git clone.. ?

@Bambofy
Copy link
Author

Bambofy commented Jul 30, 2020

I was not able to reproduce this issue yet with any node version. I added also node v12 to CI and same puml file you mention without luck. output looks correct to me: https://app.circleci.com/pipelines/github/jupe/puml2code/255/workflows/8573a73d-1c03-41a3-86ea-38bc13f2d4ea/jobs/778

/**
 * \file Test.h
 */

#ifndef Test_h
#define Test_h




class Test {
  private:
  protected:
  public:

  public:
    Test()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // Test_h

Tried also with Mac. CI are running with linux. How did you install tool ? via npm or git clone.. ?

I installed puml2code by git cloning the repository and then npm -i -g within the directory

@Bambofy
Copy link
Author

Bambofy commented Jul 31, 2020

I have setup the puml2code project on my macbook, it runs correctly when ran in the development environment (VS Code). It must be something to do with the installation commands.

edit 1:
It looks like this is a security feature of Handlebars see: https://stackoverflow.com/a/61346190/1322654

edit 2:
In the package.json file, Handlebars is set to ^4.1.1 which means the latest handlebars is being installed, this is probably why it installs 4.6.0/latest handlebars instead of 4.1.1

edit 3:
I think that at (https://github.com/jupe/puml2code/blob/master/src/index.js#L144) this line, you need to supply the template with template({element: element}) to fix the security error but i'm not certain, this change will mean you have to add prefixes to the handlebar templates

@jupe jupe mentioned this issue May 8, 2021
@jupe
Copy link
Owner

jupe commented May 9, 2021

@Bambofy thanks for investigation help. Unfortunately I haven’t had time to test this more but thanks for you, I’ve now idea’s what to try next..

@cTatu
Copy link

cTatu commented Apr 6, 2022

For me it gives the exact same error "Handlebars: Access has been denied" on 2 separate environments.
The first one:

OS: Windows 11
Node: v16.13.2
NPM: v8.1.2
puml2code: v0.7.0

The second one:

OS: Ubuntu 20
Node: v14.18.3
NPM: v8.3.2
puml2code: v0.7.0

I also tried installing it with npm -g install puml2code and by cloning the repo but the result is exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants