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

Creates stats file of all repos #35

Closed
sverhoeven opened this issue May 12, 2021 · 11 comments
Closed

Creates stats file of all repos #35

sverhoeven opened this issue May 12, 2021 · 11 comments
Assignees
Milestone

Comments

@sverhoeven
Copy link
Member

sverhoeven commented May 12, 2021

Write a Typescript function that can parse out/*/*/evaluation-result.yml and stores in JSON in index-<timestamp>.json with the following info:

Scanned revision 008552b7266e229bd38553631d7dfe3554df18b2 of Git repository https://github.com/fair-software/howfairis.git
Found 1 files defining 17 unique dependencies within 1 scopes and 2 dependency levels
Detected 12 declared licenses
Completed scan with 9 unresolved policy violations and 0 issues

Would be nice to also include a link to out/*/*/scan-report-web-app.html report for each repo.

The file should also be stored as index-latest.json so Vue app always shows latest stats (#36)

@sverhoeven sverhoeven changed the title Creates stats.json Creates stats file of all repos May 12, 2021
@sverhoeven sverhoeven added this to the 0.2.0 milestone May 17, 2021
@sverhoeven
Copy link
Member Author

sverhoeven commented May 18, 2021

The yaml file can be parsed with https://www.npmjs.com/package/js-yaml which should already be listed as a dep in package.json.

As we are using Typescript we probably also need to add @types/js-yaml to devDependencies

@sverhoeven sverhoeven modified the milestones: 2, 4 May 20, 2021
@sverhoeven
Copy link
Member Author

We should have unit test for different results like

  • failed analyze
  • no deps found
  • multi scope
  • etc.

@jspaaks
Copy link
Member

jspaaks commented Jun 3, 2021

Maybe something like this?

[{
    "fair-software": [{
        "fairtally": {
            "files": 1,
            "dependencies": 17,
            "detected": 12,
            "unresolved": 9,
            "issues": 0
        }
    }, {
        "howfairis": {
            "files": 1,
            "dependencies": 17,
            "detected": 12,
            "unresolved": 9,
            "issues": 0
        }

    }],
    "tortellini-tools": [{
        "action": {
            "files": 1,
            "dependencies": 17,
            "detected": 12,
            "unresolved": 9,
            "issues": 0
        }
    }]
}]

@jspaaks
Copy link
Member

jspaaks commented Jun 8, 2021

Changed my mind, I now prefer to have a flat structure

schema:

{
    "items": {
        "additionalProperties": false,
        "properties": {
            "dependencies": {
                "type": "number"
            },
            "detected": {
                "type": "number"
            },
            "files": {
                "type": "number"
            },
            "issues": {
                "type": "number"
            },
            "owner": {
                "type": "string"
            },
            "repo": {
                "type": "string"
            },
            "report": {
                "type": "string"
            },
            "unresolved": {
                "type": "number"
            },
            "url": {
                "type": "string"
            }
        },
        "type": "object",
        "required": [
            "dependencies",
            "detected",
            "files",
            "issues",
            "owner",
            "repo",
            "unresolved",
            "url",
            "report"
        ]
    },
    "minItems": 1
}

example data:

[{
        "dependencies": 1,
        "detected": 1,
        "files": 4,
        "issues": 4,
        "owner": "afasfa",
        "repo": "afasfasdfadsa",
        "url": "https://234234.com/d",
        "report": "https://tortellini-bkt2-5uk3-fbnr.s3.eu-central-1.amazonaws.com/.tortellini/out/3D-e-Chem/knime-kripodb/scan-report-web-app.html",
        "unresolved": 5
    },
    {
        "dependencies": 1,
        "detected": 1,
        "files": 4,
        "issues": 4,
        "owner": "afasfa",
        "repo": "afasfasdfadsa",
        "url": "https://234234.com/d",
        "report": "https://tortellini-bkt2-5uk3-fbnr.s3.eu-central-1.amazonaws.com/.tortellini/out/3D-e-Chem/knime-kripodb/scan-report-web-app.html",
        "unresolved": 3
    }
]

@fdiblen
Copy link
Member

fdiblen commented Jun 8, 2021

Example node script to use encoded data to get statistics.
test.js

@sverhoeven
Copy link
Member Author

Instead yaml use the html file and parse the blob using some html parsing package and use #35 (comment) snippet to parse blob

@sverhoeven
Copy link
Member Author

@sverhoeven
Copy link
Member Author

The data we decoded from the HTML file looks like evaluated-model.json which can be generated with ... report -f EvaluatedModel ...

We could use https://github.com/oss-review-toolkit/ort/blob/master/reporter/src/funTest/assets/evaluated-model-reporter-test-expected-output.json as input for a unit test.

@sverhoeven
Copy link
Member Author

Changed my mind, I now prefer to have a flat structure

schema:

{
    "items": {
        "additionalProperties": false,
        "properties": {
            "dependencies": {
                "type": "number"
            },
            "detected": {
                "type": "number"
            },
            "files": {
                "type": "number"
            },
            "issues": {
                "type": "number"
            },
            "owner": {
                "type": "string"
            },
            "repo": {
                "type": "string"
            },
            "report": {
                "type": "string"
            },
            "unresolved": {
                "type": "number"
            },
            "url": {
                "type": "string"
            }
        },
        "type": "object",
        "required": [
            "dependencies",
            "detected",
            "files",
            "issues",
            "owner",
            "repo",
            "unresolved",
            "url",
            "report"
        ]
    },
    "minItems": 1
}

example data:

[{
        "dependencies": 1,
        "detected": 1,
        "files": 4,
        "issues": 4,
        "owner": "afasfa",
        "repo": "afasfasdfadsa",
        "url": "https://234234.com/d",
        "report": "https://tortellini-bkt2-5uk3-fbnr.s3.eu-central-1.amazonaws.com/.tortellini/out/3D-e-Chem/knime-kripodb/scan-report-web-app.html",
        "unresolved": 5
    },
    {
        "dependencies": 1,
        "detected": 1,
        "files": 4,
        "issues": 4,
        "owner": "afasfa",
        "repo": "afasfasdfadsa",
        "url": "https://234234.com/d",
        "report": "https://tortellini-bkt2-5uk3-fbnr.s3.eu-central-1.amazonaws.com/.tortellini/out/3D-e-Chem/knime-kripodb/scan-report-web-app.html",
        "unresolved": 3
    }
]

Is the url is the repository url which was given in of the lines of the repositories input file?

The action does not know where its output will be hosted so instead of using a full URL in report value use a relative path like 3D-e-Chem/knime-kripodb/scan-report-web-app.html.

@sverhoeven sverhoeven self-assigned this Jun 8, 2021
sverhoeven added a commit that referenced this issue Jun 8, 2021
@jspaaks
Copy link
Member

jspaaks commented Jun 9, 2021

url: yes it's the full repo url that the user supplied. it gets here via gitrepo:GitRepo
report: yes should be relative url. Note that it includes out/ as well at the moment (but not .tortellini anymore)

@sverhoeven
Copy link
Member Author

The PR #126 has been merged giving a overview page showing statistics (nr of violations, deps, licenses, etc.) for each repo.

However the json files as described in this issue have not been created, because for mvp the index.html with JSON data inside was enough.
Split of #134 and #135 to handle JSON files.

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