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

Abierto
#1,183 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c, rust
Área
data, tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
469
Forks
74
Merge medio
17 h 16 min
PR fusionados (30 d)
10

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de mozilla/rust-code-analysis

Todos los issues de mozilla/rust-code-analysis

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.