Giter VIP home page Giter VIP logo

Comments (5)

pombredanne avatar pombredanne commented on June 27, 2024

@JonoYang @tdruez @Pratikrocks @chinyeungli FYI

from commoncode.

Pratikrocks avatar Pratikrocks commented on June 27, 2024

Generally when we are having a single root the rid of 0 is assigned to the first resource and we are treating it as a root

from commoncode.

pombredanne avatar pombredanne commented on June 27, 2024

@Pratikrocks I think we likely do not need a root at all

from commoncode.

Pratikrocks avatar Pratikrocks commented on June 27, 2024

@pombredanne I believe we are leveraging to some extent upon the root when we are walking the codebase then basically it is the root we visit first .

from commoncode.

JonoYang avatar JonoYang commented on June 27, 2024

As stated above, we need to align commoncode's Codebase/VirtualCodebase class and Resource class with scancode.io's Project and CodebaseResource model. I would like this done such that code written to work with commoncode's Codebase and Resource classes can work on scancode.io's Project and CodebaseResource model. This is important in the case of fingerprinting Package Resources using the matchcode-toolkit fingerprinting functions (https://github.com/nexB/purldb/blob/main/matchcode-toolkit/src/matchcode_toolkit/fingerprinting.py#L69) because the fingerprints depend on the order of Resources when we walk a codebase. We want the codebase walk to be the same across both classes.

One of the issues is that we need to reconcile is that commoncode creates a root resource for a Codebase where scancode.io does not create one for a Project. The root is used to determine where the root of the codebase is and helps us perform depth-first traversal into the Codebase.

An idea would be to treat the Codebase/VirtualCodebase class as the root resource, since the Codebase represents the entirety of the codebase being scanned. This would involve adding the Resource class fields to the Codebase/VirtualCodebase class, so we can return the Codebase like a Resource when we are walking a Codebase or Resource. Resources that are in the root of the project would have the Codebase as the parent Resource.

Some issues:

  • In scancode, the Resource model is created at runtime, where fields from active plugins are added to either the Codebase or Resource model. How would we add these fields to the Codebase? Would we have to do something similar to what we do with Codebase.attributes?, maybe a specific Resource object created as an attribute on Codebase?

from commoncode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.