Skip to content

Add Rule "Avoid using resource-hungry frameworks" #93

@AMorgaut

Description

@AMorgaut

Similarities

This rule is a variant of one targeting libraries (cf #37 ) and is meant to check the framework being used by the project

Objectives

Even if it can fill like difficult to fix for already existing big projects, raising it during static code analyses can

  • be considered for other upcoming or still young other projects
  • be considered in a micro-front architecture to either transform some of them or become a rule for the next micro fronts
  • educates the developers and managers of the project for any further decisions they will push in any other companies

This issue can still be tagged as accepted in Sonar by project lead

The provided Ecoscore, from Creedengo-dashboard, should still include it in its impact evaluation (harder if the manager removes the rule instead of tagging it as accepted)

Technical solution

A first version could check the dependencies of the package.json

2 contexts can make it harder to detect the framework:

  • the project sonar properties are configured to only scan the src folder or have an equivalent configuration omitting the package.json file.
    • a failover would require to integrate some other signature check like files importing a framework specific module but it means it could raise many issues instead of just one...
  • the project is a monorepo, it can include many package.json files
    • may not be a problem as the issue would be be raised for each inner project using such framework
    • a evolution could integrate a support of the main monorepo solutions (Nx, turborepo) and progressively support more of them (see https://monorepo.tools)

References

RGESN

3.1 Le service numérique repose-t-il sur une architecture, des ressources ou des composants conçus pour réduire leurs propres impacts environnementaux ?

Évaluation des frameworks : Examiner les frameworks utilisés pour le développement du frontend et du backend en termes d'écoconception. L’analyse pourra notamment prendre en compte : l’utilisation efficace des ressources matérielles et énergétiques, l’utilisation de technique de compression efficace, l’optimisation des requêtes client-serveur.

W3C WSG

3.6 Third-party services should be assessed as first parties

Success Criterion: Libraries and frameworks
Large CSS libraries and JavaScript frameworks are only be used if a more performant alternative that achieves the same goal cannot be used instead.

Blog Posts

Measurements

It would be nice to find already existing benchmarks.

Anyway, even it its a small project, I plan to push a POC in Creedengo-dashboard branches to compare them and potentially, if relevant, migrate from Vue to Svelte or native web components (I've got a pure web component project which is interesting)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions