Skip to content

Should fully skipped files be marked as 100% covered or 0% covered? #565

Closed

Description

@PragTob

We are treating files that are fully irrelevant (just comments for instance) different from files that are skipped through # :nocov: as a whole. A file with just irrelevant lines gets 100% coverage, one where all lines are skipped (or some are irrelevant) gets 0% coverage:

selection_062

selection_063

Question is: Does that sound right? I feel like skipped lines should mostly be like non relevant lines (as the user decided they are not relevant) and it feels weird that a file is 0% covered, but the whole project still has 100% coverage. Removing that distinction would also simplify the code :)

Stumbled on this while investigating #563 (fix in #564 )I stumbled across - e.g. the difference (as apparent in the fix) that mostly caused it was the difference that no_lines? is different from relevant_lines.zero?as no_lines? only triggers if all lines are irrelevant (such as comments only).

Activity

  1. PragTob commented on Mar 18, 2017

    @PragTob
    CollaboratorAuthor

    @colszowka would love to get your input here, as I might be missing something :)

  2. krtschmr commented on Sep 4, 2019

    @krtschmr

    came here since i we have same issue.

    some rake tasks, like annotate_models or generate_erd_diagram are sitting at 0% because it's nocov

    doesn't make any sense at all.

    i checked but can't find a filter or exclude method to just exclude them from the coverage at all.
    like

    excluded_files.include(current_file)

    seems. to not exist.

  3. PragTob commented on Dec 3, 2019

    @PragTob
    CollaboratorAuthor

    If no one stops me I'll change it to be 100% :)

    bunnies

  4. PragTob commented on Jan 25, 2020

    @PragTob
    CollaboratorAuthor

    No one stopped me 🤷‍♂️

  5. added theissue type on May 6, 2026
  6. added a commit that references this issue on May 11, 2026
  7. added a commit that references this issue on May 14, 2026
  8. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions