Skip to content

Commit

Permalink
Provide links to example reports. Closes #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
baron1405 committed Jun 13, 2024
1 parent 0977bf6 commit 6792e8a
Show file tree
Hide file tree
Showing 7 changed files with 518 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ highly accurate algorithm.
* Detects embedded languages (e.g. CSS in HTML)
* Accommodates nested comments
* Ability to associate custom file extensions with languages and remove unwanted associations
* Provides a number of [report formats](#reports) (e.g. JSON, XML)
* Uses the [locc4j](https://github.com/cthing/locc4j) library, which is modeled after the
[tokei](https://github.com/XAMPPRocky/tokei) line counting tool

Expand Down Expand Up @@ -133,14 +134,14 @@ locc {
The plugin is capable of generating a line count report in a number of formats. Note that different formats
provide different amounts of information as described in the following table.

| Format | Project Information | Counts Per Language | Counts Per File | Counts Per Language Per File | Schema |
|--------|---------------------|---------------------|-----------------|------------------------------|--------------------------------------------|
| CSV | | ✅ | | | |
| HTML | ✅ | ✅ | ✅ | | |
| JSON | ✅ | ✅ | ✅ | ✅ | https://www.cthing.com/schemas/locc-1.json |
| Text | ✅ | ✅ | ✅ | | |
| XML | ✅ | ✅ | ✅ | ✅ | https://www.cthing.com/schemas/locc-1.xsd |
| YAML | ✅ | ✅ | ✅ | ✅ | https://www.cthing.com/schemas/locc-1.json |
| Format | Project Information | Counts Per Language | Counts Per File | Counts Per Language Per File | Example | Schema |
|--------|---------------------|---------------------|-----------------|------------------------------|-----------------------------------------|-----------------------------------------------------------|
| CSV | | ✅ | | | [locc.csv](example-reports/locc.csv) | |
| HTML | ✅ | ✅ | ✅ | | [locc.html](example-reports/locc.html) | |
| JSON | ✅ | ✅ | ✅ | ✅ | [locc.json](example-reports/locc.json) | [locc-1.json](https://www.cthing.com/schemas/locc-1.json) |
| Text | ✅ | ✅ | ✅ | | [locc.txt](example-reports/locc.txt) | |
| XML | ✅ | ✅ | ✅ | ✅ | [locc.xml](example-reports/locc.xml) | [locc-1.xsd](https://www.cthing.com/schemas/locc-1.xsd) |
| YAML | ✅ | ✅ | ✅ | ✅ | [locc.yaml](example-reports/locc.yaml) | [locc-1.json](https://www.cthing.com/schemas/locc-1.json) |

The report for each format is generated as `build/reports/locc/locc.{csv, html, json, txt, xml, yaml}`. By default,
the plugin will generate a report in the HTML and XML formats. Configure the task reports to control which file
Expand Down
5 changes: 5 additions & 0 deletions example-reports/locc.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ID,Name,Description,Total Lines,Code Lines,Comment Lines,Blank Lines
ALL,All,All languages,78,40,29,9
Css,CSS,Cascading Style Sheets language,7,7,0,0
Html,HTML,HyperText Markup Language,12,12,0,0
Java,Java,Java programming language,59,21,29,9
204 changes: 204 additions & 0 deletions example-reports/locc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Line Count Report For simple-project</title>
<style>
body {
margin: 40px;
padding: 0;
font-family: sans-serif;
}
table {
border: 1px solid #C3C3C3;
border-collapse: collapse;
}
td, th {
border: 1px solid #C3C3C3;
padding: 5px 15px 5px 15px;
}
.CountCell {
text-align: right;
}
.TotalCell {
font-weight: bold;
}
.Unrecognized {
color: #DC0000;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
</head>
<body>
<h1>Line Count Report For simple-project</h1>

<h2>Summary</h2>
<table>
<tbody>
<tr>
<td>Project</td>
<td>simple-project</td>
</tr>
<tr>
<td>Version</td>
<td>unspecified</td>
</tr>
<tr>
<td>Report date</td>
<td>2024-06-13T12:17:03-07:00</td>
</tr>
<tr>
<td>Number of files</td>
<td>5</td>
</tr>
<tr>
<td>Number of languages</td>
<td>3</td>
</tr>
<tr>
<td>Unrecognized files</td>
<td>0</td>
</tr>
<tr>
<td>Total lines</td>
<td>78</td>
</tr>
<tr>
<td>Code lines</td>
<td>40</td>
</tr>
<tr>
<td>Comment lines</td>
<td>29</td>
</tr>
<tr>
<td>Blank lines</td>
<td>9</td>
</tr>
</tbody>
</table>

<h2>Line Count by Language</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th class="CountCell">Total Lines</th>
<th class="CountCell">Code Lines</th>
<th class="CountCell">Comment Lines</th>
<th class="CountCell">Blank Lines</th>
</tr>
</thead>
<tbody>
<tr>
<td>CSS</td>
<td><a href="https://www.w3.org/Style/CSS/">Cascading Style Sheets language</a></td>
<td class="CountCell">7</td>
<td class="CountCell">7</td>
<td class="CountCell">0</td>
<td class="CountCell">0</td>
</tr>
<tr>
<td>HTML</td>
<td><a href="https://en.wikipedia.org/wiki/HTML">HyperText Markup Language</a></td>
<td class="CountCell">12</td>
<td class="CountCell">12</td>
<td class="CountCell">0</td>
<td class="CountCell">0</td>
</tr>
<tr>
<td>Java</td>
<td><a href="https://en.wikipedia.org/wiki/Java_(programming_language)">Java programming language</a></td>
<td class="CountCell">59</td>
<td class="CountCell">21</td>
<td class="CountCell">29</td>
<td class="CountCell">9</td>
</tr>
<tr>
<td class="TotalCell">Total</td>
<td></td>
<td class="TotalCell CountCell">78</td>
<td class="TotalCell CountCell">40</td>
<td class="TotalCell CountCell">29</td>
<td class="TotalCell CountCell">9</td>
</tr>
</tbody>
</table>

<h2>Line Count by File</h2>
<table>
<thead>
<tr>
<th>Pathname</th>
<th class="CountCell">Total Lines</th>
<th class="CountCell">Code Lines</th>
<th class="CountCell">Comment Lines</th>
<th class="CountCell">Blank Lines</th>
<th>Languages</th>
</tr>
</thead>
<tbody>
<tr>
<td>src/main/java/com/cthing/testproject/HelloWorld.java</td>
<td class="CountCell">32</td>
<td class="CountCell">11</td>
<td class="CountCell">17</td>
<td class="CountCell">4</td>
<td>Java</td>
</tr>
<tr>
<td>src/main/java/com/cthing/testproject/package-info.java</td>
<td class="CountCell">10</td>
<td class="CountCell">1</td>
<td class="CountCell">8</td>
<td class="CountCell">1</td>
<td>Java</td>
</tr>
<tr>
<td>src/main/resources/sample.css</td>
<td class="CountCell">7</td>
<td class="CountCell">7</td>
<td class="CountCell">0</td>
<td class="CountCell">0</td>
<td>CSS</td>
</tr>
<tr>
<td>src/main/resources/sample.html</td>
<td class="CountCell">12</td>
<td class="CountCell">12</td>
<td class="CountCell">0</td>
<td class="CountCell">0</td>
<td>HTML</td>
</tr>
<tr>
<td>src/test/java/com/cthing/testproject/HelloWorldTest.java</td>
<td class="CountCell">17</td>
<td class="CountCell">9</td>
<td class="CountCell">4</td>
<td class="CountCell">4</td>
<td>Java</td>
</tr>
<tr>
<td class="TotalCell">Total</td>
<td class="TotalCell CountCell">78</td>
<td class="TotalCell CountCell">40</td>
<td class="TotalCell CountCell">29</td>
<td class="TotalCell CountCell">9</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
132 changes: 132 additions & 0 deletions example-reports/locc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"formatVersion": 1,
"date": "2024-06-13T12:17:03-07:00",
"projectName": "simple-project",
"projectVersion": "unspecified",
"numFiles": 5,
"numUnrecognized": 0,
"numLanguages": 3,
"totalLines": 78,
"codeLines": 40,
"commentLines": 29,
"blankLines": 9,
"languages": [
{
"name": "Css",
"displayName": "CSS",
"description": "Cascading Style Sheets language",
"website": "https:\/\/www.w3.org\/Style\/CSS\/",
"totalLines": 7,
"codeLines": 7,
"commentLines": 0,
"blankLines": 0
},
{
"name": "Html",
"displayName": "HTML",
"description": "HyperText Markup Language",
"website": "https:\/\/en.wikipedia.org\/wiki\/HTML",
"totalLines": 12,
"codeLines": 12,
"commentLines": 0,
"blankLines": 0
},
{
"name": "Java",
"displayName": "Java",
"description": "Java programming language",
"website": "https:\/\/en.wikipedia.org\/wiki\/Java_(programming_language)",
"totalLines": 59,
"codeLines": 21,
"commentLines": 29,
"blankLines": 9
}
],
"files": [
{
"pathname": "src\/main\/java\/com\/cthing\/testproject\/HelloWorld.java",
"numLanguages": 1,
"totalLines": 32,
"codeLines": 11,
"commentLines": 17,
"blankLines": 4,
"languages": [
{
"name": "Java",
"totalLines": 32,
"codeLines": 11,
"commentLines": 17,
"blankLines": 4
}
]
},
{
"pathname": "src\/main\/java\/com\/cthing\/testproject\/package-info.java",
"numLanguages": 1,
"totalLines": 10,
"codeLines": 1,
"commentLines": 8,
"blankLines": 1,
"languages": [
{
"name": "Java",
"totalLines": 10,
"codeLines": 1,
"commentLines": 8,
"blankLines": 1
}
]
},
{
"pathname": "src\/main\/resources\/sample.css",
"numLanguages": 1,
"totalLines": 7,
"codeLines": 7,
"commentLines": 0,
"blankLines": 0,
"languages": [
{
"name": "Css",
"totalLines": 7,
"codeLines": 7,
"commentLines": 0,
"blankLines": 0
}
]
},
{
"pathname": "src\/main\/resources\/sample.html",
"numLanguages": 1,
"totalLines": 12,
"codeLines": 12,
"commentLines": 0,
"blankLines": 0,
"languages": [
{
"name": "Html",
"totalLines": 12,
"codeLines": 12,
"commentLines": 0,
"blankLines": 0
}
]
},
{
"pathname": "src\/test\/java\/com\/cthing\/testproject\/HelloWorldTest.java",
"numLanguages": 1,
"totalLines": 17,
"codeLines": 9,
"commentLines": 4,
"blankLines": 4,
"languages": [
{
"name": "Java",
"totalLines": 17,
"codeLines": 9,
"commentLines": 4,
"blankLines": 4
}
]
}
]
}
Loading

0 comments on commit 6792e8a

Please sign in to comment.