Comments (5)
@JonoYang @tdruez @Pratikrocks @chinyeungli FYI
from commoncode.
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.
@Pratikrocks I think we likely do not need a root at all
from commoncode.
@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.
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)
- VirtualCodebase Fails to produce the codebase upon scanning file Resources having fingerprint attribute HOT 1
- VirtualCodebase Fails to produce the codebase upon scanning file whose paths have a prefix of "/" HOT 1
- commoncode breaks with click 8.0.1 HOT 4
- VirtualCodebase Fails to produce the codebase upon scanning `Codebases` having different attributes in `Files` and `Directories` HOT 1
- VirtualCodebase recursion error HOT 1
- Commoncode fails with Click < 8 HOT 2
- Refactor how strip_root argument works for Codebase
- Rethinking the relationship between Codebases and Resources
- Test failure with Python 3.10 HOT 3
- Add warnings field to codebase headers HOT 1
- Implement `for_packages_append` on `Resource` HOT 3
- Issue importing a scancode.io JSON results into VirtualCodebase HOT 1
- codebase_attributes are ignored when creating a VirtualCodebase from a scan HOT 1
- Failure of tests/test_paths.py::TestPortablePath::test_safe_path_posix_style_chinese_char HOT 5
- VirtualCodebase walk issue HOT 1
- VirtualCodebase fails with Python 3.9 HOT 1
- Testing in GitHub CI HOT 3
- datetime.datetime.utcfromtimestamp is deprecated in Python 3.12
- Drop support for Python 2 code HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commoncode.