Skip to content

In Vue files // comments are not recognized #368

@crystalfp

Description

@crystalfp

Describe the bug
In .vue files // comments are not counted, only /* */ and <!-- --> ones are.

To Reproduce

  1. Create test.vue with the following content:
<script setup lang="ts">

// Comment slash-slash
const b = 3 + 5;

/* Comment slash-star */
const qq = b + 4;

</script>

<template>
  <!-- Comment html -->
  <button class="one">Push me!</button>
</template>

<style lang="scss" scoped>
/* stylelint-disable selector-class-pattern */
.one {
    background: red;
    color: blue; // Example
}
</style>
  1. on the command line do: scc --ci --no-cocomo test.vue
  2. The result is:
-------------------------------------------------------------------------------
Language                 Files     Lines   Blanks  Comments     Code Complexity
-------------------------------------------------------------------------------
Vue                          1        22        5         3       14          0
-------------------------------------------------------------------------------
Total                        1        22        5         3       14          0
-------------------------------------------------------------------------------
Processed 373 bytes, 0.000 megabytes (SI)
-------------------------------------------------------------------------------

Expected behavior
Expect comment count to be 5.

Desktop (please complete the following information):

  • OS: Windows 11 64 bits
  • scc version 3.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions