Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust doc comments being miscounted #713

Open
Garmelon opened this issue Feb 9, 2021 · 2 comments
Open

Rust doc comments being miscounted #713

Garmelon opened this issue Feb 9, 2021 · 2 comments

Comments

@Garmelon
Copy link

Garmelon commented Feb 9, 2021

This rust code is being counted weirdly:

/* A */

/// B
struct C;

It results in the output

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Rust                    1            1            1            0            0
 |- Markdown             1            1            0            1            0
 (Total)                              2            1            1            0
===============================================================================
 Total                   1            1            1            0            0
===============================================================================
  1. The file is 4 lines long (wc -l agrees), yet the total reported by tokei is 1.
  2. The total does not include any comments or blanks.
  3. The total disagrees with the total for the rust section.

If I add more empty lines between /* A */ and /// B, they are simply ignored.
If I change /// B to // B, the output is correct.

Similar things happen with this simplified two-liner example:

/// A
struct B;

Tokei output:

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Rust                    1            1            1            0            0
 |- Markdown             1            1            0            1            0
 (Total)                              2            1            1            0
===============================================================================
 Total                   1            1            1            0            0
===============================================================================

Tested on commit fd08c8b (the current master) with a freshly cloned tokei.

@XAMPPRocky
Copy link
Owner

Thank you for your issue! I'll have to investigate further, but you can see what's happening in tokei with tokei -vvv.

@toyboot4e
Copy link

Block docstrings are not counted as markdown.

Source file:

/*!
Module docstring
*/

/**
Item docstring
*/
struct CoolStuff;

tokei output:

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Rust                    1            8            1            6            1
===============================================================================
 Total                   1            8            1            6            1
===============================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants