Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

ExcludeFromCodeCoverage for interface with default implementations

Abierto
#143 0 comentarios 1 reacción 1 asignado Ver en GitHub

@fhnaseer ya está trabajando en esto.

Desde el 18/11/2024.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

enhancement

Currently the ExcludeFromCodeCoverage attribute can only be placed on classes, constructors, methods, structs, properties, events and assemblies. However, now that C# 8.0 introduced interfaces with default implementations it could be useful to be able to be able to use the attribute on these as well.

As an example, in the visitor pattern I'm using an interface with default implementation so that visitors don't have to override every method:

public interface IVisitor
{
    void Visit(FullName fullName) => throw new NotImplementedException();
    void Visit(Address address) => throw new NotImplementedException();
    void Visit(PhoneInfo phoneInfo) => throw new NotImplementedException();
}

Since testing these concrete methods (in my case) is not necessary, I would like to tag the interface with the ExcludeFromCodeCoverage attribute which is currently not possible. While I've got a few workarounds (adding the ExcludeFromCodeCoverage attribute to every single method declaration in the interface or using an abstract class and tagging the class itself) it might be worth letting the attribute be placed directly on interfaces.

Lenguaje dominante
C#
Estrellas
125
Forks
17
Merge medio
1 h 32 min
PR fusionados (30 d)
1

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. 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 microsoft/codecoverage

Todos los issues de microsoft/codecoverage

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.