Skip to content

Commit

Permalink
Ignore files now not counted by default
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Apr 30, 2024
1 parent 0f24b24 commit f248fe0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 75 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ Flags:
--ci enable CI output settings where stdout is ASCII
--cocomo-project-type string change COCOMO model type [organic, semi-detached, embedded, "custom,1,1,1,1"] (default "organic")
--count-as string count extension as language [e.g. jsp:htm,chead:"C Header" maps extension jsp to html and chead to C Header]
--count-ignore set to allow .gitignore and .ignore files to be counted
--currency-symbol string set currency symbol (default "$")
--debug enable debug output
--eaf float the effort adjustment factor derived from the cost drivers (1.0 if rated nominal) (default 1)
Expand Down
114 changes: 39 additions & 75 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<tbody><tr>
<th>Go</th>
<th>40</th>
<th>9572</th>
<th>1509</th>
<th>451</th>
<th>7612</th>
<th>1546</th>
<th>398391</th>
<th>9590</th>
<th>1511</th>
<th>452</th>
<th>7627</th>
<th>1552</th>
<th>398741</th>
</tr><tr>
<th>Java</th>
<th>24</th>
Expand All @@ -39,12 +39,12 @@
</tr><tr>
<th>Markdown</th>
<th>11</th>
<th>1498</th>
<th>1499</th>
<th>362</th>
<th>0</th>
<th>1136</th>
<th>1137</th>
<th>0</th>
<th>60408</th>
<th>60501</th>
</tr><tr>
<th>Python</th>
<th>11</th>
Expand All @@ -56,13 +56,13 @@
<th>18844</th>
</tr><tr>
<th>YAML</th>
<th>9</th>
<th>930</th>
<th>8</th>
<th>394</th>
<th>66</th>
<th>62</th>
<th>802</th>
<th>61</th>
<th>267</th>
<th>0</th>
<th>18996</th>
<th>12132</th>
</tr><tr>
<th>CSS</th>
<th>5</th>
Expand All @@ -81,15 +81,6 @@
<th>43</th>
<th>0</th>
<th>3425</th>
</tr><tr>
<th>gitignore</th>
<th>5</th>
<th>45</th>
<th>10</th>
<th>8</th>
<th>27</th>
<th>0</th>
<th>719</th>
</tr><tr>
<th>Makefile</th>
<th>3</th>
Expand Down Expand Up @@ -126,24 +117,6 @@
<th>12</th>
<th>0</th>
<th>268</th>
</tr><tr>
<th>HTML</th>
<th>2</th>
<th>1612</th>
<th>0</th>
<th>0</th>
<th>1612</th>
<th>0</th>
<th>23396</th>
</tr><tr>
<th>JSON</th>
<th>2</th>
<th>9043</th>
<th>0</th>
<th>0</th>
<th>9043</th>
<th>0</th>
<th>139859</th>
</tr><tr>
<th>JavaServer Pages</th>
<th>2</th>
Expand Down Expand Up @@ -180,15 +153,6 @@
<th>46</th>
<th>8</th>
<th>14131</th>
</tr><tr>
<th>ignore</th>
<th>2</th>
<th>3</th>
<th>0</th>
<th>0</th>
<th>3</th>
<th>0</th>
<th>55</th>
</tr><tr>
<th>Alchemist</th>
<th>1</th>
Expand Down Expand Up @@ -297,15 +261,6 @@
<th>3</th>
<th>0</th>
<th>76</th>
</tr><tr>
<th>CSV</th>
<th>1</th>
<th>88</th>
<th>0</th>
<th>0</th>
<th>88</th>
<th>0</th>
<th>2351</th>
</tr><tr>
<th>Cairo</th>
<th>1</th>
Expand Down Expand Up @@ -504,6 +459,15 @@
<th>10</th>
<th>0</th>
<th>245</th>
</tr><tr>
<th>HTML</th>
<th>1</th>
<th>833</th>
<th>0</th>
<th>0</th>
<th>833</th>
<th>0</th>
<th>12073</th>
</tr><tr>
<th>Hare</th>
<th>1</th>
Expand All @@ -522,6 +486,15 @@
<th>7</th>
<th>0</th>
<th>226</th>
</tr><tr>
<th>JSON</th>
<th>1</th>
<th>9042</th>
<th>0</th>
<th>0</th>
<th>9042</th>
<th>0</th>
<th>126854</th>
</tr><tr>
<th>JSONC</th>
<th>1</th>
Expand Down Expand Up @@ -666,15 +639,6 @@
<th>0</th>
<th>0</th>
<th>0</th>
</tr><tr>
<th>SQL</th>
<th>1</th>
<th>229</th>
<th>0</th>
<th>0</th>
<th>229</th>
<th>0</th>
<th>27013</th>
</tr><tr>
<th>Sieve</th>
<th>1</th>
Expand Down Expand Up @@ -822,12 +786,12 @@
</tr></tbody>
<tfoot><tr>
<th>Total</th>
<th>215</th>
<th>96087</th>
<th>4635</th>
<th>5952</th>
<th>85500</th>
<th>2932</th>
<th>3205861</th>
<th>203</th>
<th>94425</th>
<th>4627</th>
<th>5944</th>
<th>83854</th>
<th>2938</th>
<th>3144974</th>
</tr></tfoot>
</table></body></html>
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func main() {
false,
"disables .gitignore file logic",
)
flags.BoolVar(
&processor.CountIgnore,
"count-ignore",
false,
"set to allow .gitignore and .ignore files to be counted",
)
flags.BoolVar(
&processor.Debug,
"debug",
Expand Down
8 changes: 8 additions & 0 deletions processor/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ func newFileJob(path, name string, fileInfo os.FileInfo) *FileJob {
LoadLanguageFeature(l)
}

if !CountIgnore {
for _, l := range language {
if l == "ignore" || l == "gitignore" {
return nil
}
}
}

return &FileJob{
Location: path,
Symlocation: symPath,
Expand Down
1 change: 1 addition & 0 deletions processor/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func TestNewFileJob(t *testing.T) {
func TestNewFileJobGitIgnore(t *testing.T) {
AllowListExtensions = []string{}
ProcessConstants()
CountIgnore = true

fi, _ := os.Stat("../examples/issue114/.gitignore")
job := newFileJob("../examples/issue114/", ".gitignore", fi)
Expand Down
3 changes: 3 additions & 0 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ var GitIgnore = false
// Ignore disables ignore file checks
var Ignore = false

// CountIgnore should we count ignore files?
var CountIgnore = false

// DisableCheckBinary toggles checking for binary files using NUL bytes
var DisableCheckBinary = false

Expand Down

0 comments on commit f248fe0

Please sign in to comment.