git-afsantos / haros

H(igh) A(ssurance) ROS - Static analysis of ROS application code.
MIT License
191 stars 37 forks source link

Multi-project Analysis #13

Closed git-afsantos closed 7 years ago

git-afsantos commented 7 years ago

Sometimes it may be useful to organise packages into projects and analyse a whole project at a time.

Index files kind of solve this issue, by defining an index file for each project, but the analysis results overlap. Haros always uses the same analysis database file. Adding an option to load a different file could also solve this, at the expense of making the command-line a little more cumbersome.

In any case, the visualiser is not adapted for this concept, so multiple visualisers would have to be exported, one for each project. This requires launching multiple viz servers (when hosting), or creating a top-level index.html with links to open the individual projects, which is not ideal.

My proposal is to add a new Project data structure.

class Project(object):
    def __init__(self, name, packages = None):
        self.name = name
        self.packages = packages if not packages is None else []

Index files could define a name for a project, or default to the file name minus extension. The AnalysisManager could store the history for each project separately, or simply create one analysis database for each project. The exported viz files and directory structure would have to change. Instead of data/packages.json, etc., it would have to go one level deeper, data/project/packages.json. Viz itself would have to be changed as well.