StatLens:Scanning

From MutigerAffe Wiki
Jump to navigation Jump to search

This page explains what Stat Lens scans, how it counts lines and when it scans again.

What is scanned

Only the first folder of the workspace is scanned. In a multi-root workspace the other folders are ignored.

The scan walks through every folder below it and skips:

  • every folder whose name is in projectStats.excludeFolders, on any level. By default these are node_modules, bin, obj, .git, dist, out, .vs and .vscode. See Commands and Settings.
  • everything excluded by the .gitignore file in the root of the folder. Other .gitignore files further down are not used for this step.
  • symbolic links, both to files and to folders

Every file that is left counts towards Files and Size. Every folder that is left counts towards Files as a folder. The root folder itself is not counted.

Lines of code

Which files count

Lines are only counted in files that have a language. The language comes from linguist-js, which uses the rules of GitHub Linguist. It works offline with the language data that ships with the extension.

Files without a language add to Files and Size, but not to the lines of code. This includes:

  • binary files, such as images or archives
  • files that Linguist treats as vendored, for example bundled third-party libraries
  • files Linguist leaves out for other reasons, including files marked with linguist-vendored, linguist-generated or linguist-documentation in .gitattributes, and files excluded by a .gitignore in a subfolder
  • files larger than 20 MB. They are never read line by line.

Programming languages, markup, data and prose formats all count. JSON, YAML, XML or Markdown files therefore add to the lines of code.

How lines are counted

  • A line counts if it contains anything other than spaces or tabs. Blank lines never count.
  • Files are read as UTF-8.
  • Largest File is the file with the most counted lines, not the file with the most bytes.

Ignoring comment lines

With projectStats.ignoreComments set to true, a line also does not count if it starts with one of these, after leading spaces:

// · # · /* · * · -- ·