Skip to content

Commit f248fe0

Browse files
committed
Ignore files now not counted by default
1 parent 0f24b24 commit f248fe0

File tree

6 files changed

+58
-75
lines changed

6 files changed

+58
-75
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ Flags:
247247
--ci enable CI output settings where stdout is ASCII
248248
--cocomo-project-type string change COCOMO model type [organic, semi-detached, embedded, "custom,1,1,1,1"] (default "organic")
249249
--count-as string count extension as language [e.g. jsp:htm,chead:"C Header" maps extension jsp to html and chead to C Header]
250+
--count-ignore set to allow .gitignore and .ignore files to be counted
250251
--currency-symbol string set currency symbol (default "$")
251252
--debug enable debug output
252253
--eaf float the effort adjustment factor derived from the cost drivers (1.0 if rated nominal) (default 1)

SCC-OUTPUT-REPORT.html

+39-75
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<tbody><tr>
1313
<th>Go</th>
1414
<th>40</th>
15-
<th>9572</th>
16-
<th>1509</th>
17-
<th>451</th>
18-
<th>7612</th>
19-
<th>1546</th>
20-
<th>398391</th>
15+
<th>9590</th>
16+
<th>1511</th>
17+
<th>452</th>
18+
<th>7627</th>
19+
<th>1552</th>
20+
<th>398741</th>
2121
</tr><tr>
2222
<th>Java</th>
2323
<th>24</th>
@@ -39,12 +39,12 @@
3939
</tr><tr>
4040
<th>Markdown</th>
4141
<th>11</th>
42-
<th>1498</th>
42+
<th>1499</th>
4343
<th>362</th>
4444
<th>0</th>
45-
<th>1136</th>
45+
<th>1137</th>
4646
<th>0</th>
47-
<th>60408</th>
47+
<th>60501</th>
4848
</tr><tr>
4949
<th>Python</th>
5050
<th>11</th>
@@ -56,13 +56,13 @@
5656
<th>18844</th>
5757
</tr><tr>
5858
<th>YAML</th>
59-
<th>9</th>
60-
<th>930</th>
59+
<th>8</th>
60+
<th>394</th>
6161
<th>66</th>
62-
<th>62</th>
63-
<th>802</th>
62+
<th>61</th>
63+
<th>267</th>
6464
<th>0</th>
65-
<th>18996</th>
65+
<th>12132</th>
6666
</tr><tr>
6767
<th>CSS</th>
6868
<th>5</th>
@@ -81,15 +81,6 @@
8181
<th>43</th>
8282
<th>0</th>
8383
<th>3425</th>
84-
</tr><tr>
85-
<th>gitignore</th>
86-
<th>5</th>
87-
<th>45</th>
88-
<th>10</th>
89-
<th>8</th>
90-
<th>27</th>
91-
<th>0</th>
92-
<th>719</th>
9384
</tr><tr>
9485
<th>Makefile</th>
9586
<th>3</th>
@@ -126,24 +117,6 @@
126117
<th>12</th>
127118
<th>0</th>
128119
<th>268</th>
129-
</tr><tr>
130-
<th>HTML</th>
131-
<th>2</th>
132-
<th>1612</th>
133-
<th>0</th>
134-
<th>0</th>
135-
<th>1612</th>
136-
<th>0</th>
137-
<th>23396</th>
138-
</tr><tr>
139-
<th>JSON</th>
140-
<th>2</th>
141-
<th>9043</th>
142-
<th>0</th>
143-
<th>0</th>
144-
<th>9043</th>
145-
<th>0</th>
146-
<th>139859</th>
147120
</tr><tr>
148121
<th>JavaServer Pages</th>
149122
<th>2</th>
@@ -180,15 +153,6 @@
180153
<th>46</th>
181154
<th>8</th>
182155
<th>14131</th>
183-
</tr><tr>
184-
<th>ignore</th>
185-
<th>2</th>
186-
<th>3</th>
187-
<th>0</th>
188-
<th>0</th>
189-
<th>3</th>
190-
<th>0</th>
191-
<th>55</th>
192156
</tr><tr>
193157
<th>Alchemist</th>
194158
<th>1</th>
@@ -297,15 +261,6 @@
297261
<th>3</th>
298262
<th>0</th>
299263
<th>76</th>
300-
</tr><tr>
301-
<th>CSV</th>
302-
<th>1</th>
303-
<th>88</th>
304-
<th>0</th>
305-
<th>0</th>
306-
<th>88</th>
307-
<th>0</th>
308-
<th>2351</th>
309264
</tr><tr>
310265
<th>Cairo</th>
311266
<th>1</th>
@@ -504,6 +459,15 @@
504459
<th>10</th>
505460
<th>0</th>
506461
<th>245</th>
462+
</tr><tr>
463+
<th>HTML</th>
464+
<th>1</th>
465+
<th>833</th>
466+
<th>0</th>
467+
<th>0</th>
468+
<th>833</th>
469+
<th>0</th>
470+
<th>12073</th>
507471
</tr><tr>
508472
<th>Hare</th>
509473
<th>1</th>
@@ -522,6 +486,15 @@
522486
<th>7</th>
523487
<th>0</th>
524488
<th>226</th>
489+
</tr><tr>
490+
<th>JSON</th>
491+
<th>1</th>
492+
<th>9042</th>
493+
<th>0</th>
494+
<th>0</th>
495+
<th>9042</th>
496+
<th>0</th>
497+
<th>126854</th>
525498
</tr><tr>
526499
<th>JSONC</th>
527500
<th>1</th>
@@ -666,15 +639,6 @@
666639
<th>0</th>
667640
<th>0</th>
668641
<th>0</th>
669-
</tr><tr>
670-
<th>SQL</th>
671-
<th>1</th>
672-
<th>229</th>
673-
<th>0</th>
674-
<th>0</th>
675-
<th>229</th>
676-
<th>0</th>
677-
<th>27013</th>
678642
</tr><tr>
679643
<th>Sieve</th>
680644
<th>1</th>
@@ -822,12 +786,12 @@
822786
</tr></tbody>
823787
<tfoot><tr>
824788
<th>Total</th>
825-
<th>215</th>
826-
<th>96087</th>
827-
<th>4635</th>
828-
<th>5952</th>
829-
<th>85500</th>
830-
<th>2932</th>
831-
<th>3205861</th>
789+
<th>203</th>
790+
<th>94425</th>
791+
<th>4627</th>
792+
<th>5944</th>
793+
<th>83854</th>
794+
<th>2938</th>
795+
<th>3144974</th>
832796
</tr></tfoot>
833797
</table></body></html>

main.go

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ func main() {
8282
false,
8383
"disables .gitignore file logic",
8484
)
85+
flags.BoolVar(
86+
&processor.CountIgnore,
87+
"count-ignore",
88+
false,
89+
"set to allow .gitignore and .ignore files to be counted",
90+
)
8591
flags.BoolVar(
8692
&processor.Debug,
8793
"debug",

processor/file.go

+8
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ func newFileJob(path, name string, fileInfo os.FileInfo) *FileJob {
143143
LoadLanguageFeature(l)
144144
}
145145

146+
if !CountIgnore {
147+
for _, l := range language {
148+
if l == "ignore" || l == "gitignore" {
149+
return nil
150+
}
151+
}
152+
}
153+
146154
return &FileJob{
147155
Location: path,
148156
Symlocation: symPath,

processor/file_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func TestNewFileJob(t *testing.T) {
9898
func TestNewFileJobGitIgnore(t *testing.T) {
9999
AllowListExtensions = []string{}
100100
ProcessConstants()
101+
CountIgnore = true
101102

102103
fi, _ := os.Stat("../examples/issue114/.gitignore")
103104
job := newFileJob("../examples/issue114/", ".gitignore", fi)

processor/processor.go

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ var GitIgnore = false
9696
// Ignore disables ignore file checks
9797
var Ignore = false
9898

99+
// CountIgnore should we count ignore files?
100+
var CountIgnore = false
101+
99102
// DisableCheckBinary toggles checking for binary files using NUL bytes
100103
var DisableCheckBinary = false
101104

0 commit comments

Comments
 (0)