(Bug) Halstead Metrics and Ops Output are inconsistent to each other

Ouverte
#1,183 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
c, rust
Domaine
data, tooling

Piste de recherche

Start by tracing how the CLI produces Halstead n1 values and the --ops output for function and module scopes, then compare the C and Rust results described in the issue. Check how operators such as uint8_t, u8, and else are collected at each scope; done means the operator lists and n1 values agree consistently across both languages and scopes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

I'm currently using the CLI variant to analyze C and Rust code. However, I spotted, that n1 in the Halstead metrics is not corresponding to the operations list generated by the --ops output.
To my understanding the length of the list of operators should correspond with the n1 value in Halstead. This is however using this tool not always the case; neither in a function space nor on the module level.
In our current setup, we actually have on a global space a difference by 4 operators and for multiple functions a difference of 1.

Furthermore, I spotted, that in the list of operators, if one calculates the union of all sets of all operators of all function - spaces, it misses some in the module space. (In my case the 'uint8_t' was used in a function, but is missing from the module space in case of my C analysis. Comparing it to the Rust Version, u8 is present on the module space and on the function space; However, in Rust 'else' is missing from the operator list in the module space, but is present in the function space; Comparing this to the C analysis, 'else' is present there in the module space and in the function space)

Since this bug in my opinion effects the Halstead metrics fundamentally, I wanted to check with you if this bug is known and if there is a fix available.

Langage dominant
Rust
Étoiles
469
Forks
74
Merge moyen
17 h 16 min
PR mergées (30 j)
10

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de mozilla/rust-code-analysis

Toutes les issues de mozilla/rust-code-analysis

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.