Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 73 additions & 73 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<tbody><tr>
<th>Go</th>
<th>34</th>
<th>27374</th>
<th>1796</th>
<th>614</th>
<th>24964</th>
<th>2018</th>
<th>558764</th>
<th>8190</th>
<th>27608</th>
<th>1829</th>
<th>633</th>
<th>25146</th>
<th>2080</th>
<th>564680</th>
<th>8285</th>
</tr><tr>
<td>processor/constants.go</td>
<td></td>
Expand Down Expand Up @@ -63,33 +63,33 @@
</tr><tr>
<td>main_test.go</td>
<td></td>
<td>890</td>
<td>70</td>
<td>15</td>
<td>805</td>
<td>228</td>
<td>21740</td>
<td>471</td>
<td>943</td>
<td>76</td>
<td>17</td>
<td>850</td>
<td>250</td>
<td>23270</td>
<td>493</td>
</tr><tr>
<td>processor/workers.go</td>
<td></td>
<td>866</td>
<td>128</td>
<td>92</td>
<td>646</td>
<td>213</td>
<td>26343</td>
<td>505</td>
<td>212</td>
<td>26321</td>
<td>504</td>
</tr><tr>
<td>processor/processor.go</td>
<td></td>
<td>749</td>
<td>750</td>
<td>159</td>
<td>123</td>
<td>467</td>
<td>468</td>
<td>89</td>
<td>21834</td>
<td>495</td>
<td>21855</td>
<td>496</td>
</tr><tr>
<td>cmd/badges/main.go</td>
<td></td>
Expand Down Expand Up @@ -130,6 +130,16 @@
<td>57</td>
<td>12733</td>
<td>293</td>
</tr><tr>
<td>processor/file_test.go</td>
<td></td>
<td>335</td>
<td>66</td>
<td>13</td>
<td>256</td>
<td>67</td>
<td>7741</td>
<td>154</td>
</tr><tr>
<td>cmd/badges/main_test.go</td>
<td></td>
Expand All @@ -150,6 +160,16 @@
<td>68</td>
<td>7503</td>
<td>131</td>
</tr><tr>
<td>processor/workers_regression_test.go</td>
<td></td>
<td>249</td>
<td>49</td>
<td>7</td>
<td>193</td>
<td>50</td>
<td>4794</td>
<td>121</td>
</tr><tr>
<td>processor/workers_tokei_test.go</td>
<td></td>
Expand Down Expand Up @@ -180,26 +200,6 @@
<td>53</td>
<td>6269</td>
<td>151</td>
</tr><tr>
<td>processor/file_test.go</td>
<td></td>
<td>213</td>
<td>50</td>
<td>1</td>
<td>162</td>
<td>37</td>
<td>4585</td>
<td>97</td>
</tr><tr>
<td>processor/workers_regression_test.go</td>
<td></td>
<td>212</td>
<td>42</td>
<td>5</td>
<td>165</td>
<td>42</td>
<td>4015</td>
<td>105</td>
</tr><tr>
<td>processor/similar_flags_test.go</td>
<td></td>
Expand All @@ -210,6 +210,16 @@
<td>5</td>
<td>3105</td>
<td>78</td>
</tr><tr>
<td>processor/file.go</td>
<td></td>
<td>173</td>
<td>27</td>
<td>19</td>
<td>127</td>
<td>46</td>
<td>3958</td>
<td>106</td>
</tr><tr>
<td>processor/locomo.go</td>
<td></td>
Expand All @@ -230,16 +240,6 @@
<td>22</td>
<td>2741</td>
<td>70</td>
</tr><tr>
<td>processor/file.go</td>
<td></td>
<td>153</td>
<td>23</td>
<td>16</td>
<td>114</td>
<td>43</td>
<td>3527</td>
<td>94</td>
</tr><tr>
<td>processor/structs_test.go</td>
<td></td>
Expand All @@ -253,13 +253,13 @@
</tr><tr>
<td>processor/result.go</td>
<td></td>
<td>136</td>
<td>137</td>
<td>24</td>
<td>3</td>
<td>109</td>
<td>110</td>
<td>31</td>
<td>3226</td>
<td>91</td>
<td>3247</td>
<td>92</td>
</tr><tr>
<td>processor/trace_test.go</td>
<td></td>
Expand Down Expand Up @@ -320,16 +320,6 @@
<td>0</td>
<td>2209</td>
<td>35</td>
</tr><tr>
<td>processor/cocomo_test.go</td>
<td></td>
<td>37</td>
<td>8</td>
<td>4</td>
<td>25</td>
<td>6</td>
<td>686</td>
<td>23</td>
</tr><tr>
<td>processor/bloom.go</td>
<td></td>
Expand All @@ -340,6 +330,16 @@
<td>2</td>
<td>1062</td>
<td>29</td>
</tr><tr>
<td>processor/cocomo_test.go</td>
<td></td>
<td>37</td>
<td>8</td>
<td>4</td>
<td>25</td>
<td>6</td>
<td>686</td>
<td>23</td>
</tr><tr>
<td>processor/helpers_test.go</td>
<td></td>
Expand All @@ -364,15 +364,15 @@
<tfoot><tr>
<th>Total</th>
<th>34</th>
<th>27374</th>
<th>1796</th>
<th>614</th>
<th>24964</th>
<th>2018</th>
<th>558764</th>
<th>8190</th>
<th>27608</th>
<th>1829</th>
<th>633</th>
<th>25146</th>
<th>2080</th>
<th>564680</th>
<th>8285</th>
</tr>
<tr>
<th colspan="9">Estimated Cost to Develop (organic) $792,091<br>Estimated Schedule Effort (organic) 12.59 months<br>Estimated People Required (organic) 5.59<br></th>
<th colspan="9">Estimated Cost to Develop (organic) $798,155<br>Estimated Schedule Effort (organic) 12.62 months<br>Estimated People Required (organic) 5.62<br></th>
</tr></tfoot>
</table></body></html>
1 change: 0 additions & 1 deletion examples/symlink/link.py

This file was deleted.

1 change: 0 additions & 1 deletion examples/symlink/link2.py

This file was deleted.

1 change: 0 additions & 1 deletion examples/symlink/link3.py

This file was deleted.

1 change: 0 additions & 1 deletion examples/symlink/link4.py

This file was deleted.

7 changes: 0 additions & 7 deletions examples/symlink/test.py

This file was deleted.

53 changes: 53 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"runtime"
"slices"
"strconv"
"strings"
Expand Down Expand Up @@ -721,6 +722,58 @@ func TestFileGCCount(t *testing.T) {
}
}

func TestIncludeSymlinks(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("skipping symlink test on Windows due to privilege requirements")
}

tmpDir, err := filepath.EvalSymlinks(t.TempDir())
if err != nil {
t.Fatal(err)
}

dirA := filepath.Join(tmpDir, "a")
dirB := filepath.Join(tmpDir, "b")
if err := os.Mkdir(dirA, 0755); err != nil {
t.Fatal(err)
}
if err := os.Mkdir(dirB, 0755); err != nil {
t.Fatal(err)
}

const fileName = "source.go"
if err := os.WriteFile(filepath.Join(dirA, fileName), []byte("package main\n"), 0644); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(dirB, fileName), []byte("package main\n"), 0644); err != nil {
t.Fatal(err)
}
// link to another dir, should be counted under --include-symlinks
if err := os.Symlink(filepath.Join(dirB, fileName), filepath.Join(dirA, "link1.go")); err != nil {
t.Fatal(err)
}
// link to the same dir, this should be ignored in all times
if err := os.Symlink(filepath.Join(dirA, fileName), filepath.Join(dirA, "link2.go")); err != nil {
t.Fatal(err)
}

output, err := runSCC("-f", "json", "--no-scc-ignore", dirA)
if err != nil {
t.Fatal(err)
}
if !strings.Contains(output, `"Count":1`) {
t.Errorf("count without symlink failed, output:\n%s", output)
}

output, err = runSCC("-f", "json", "--no-scc-ignore", "--include-symlinks", dirA)
if err != nil {
t.Fatal(err)
}
if !strings.Contains(output, `"Count":2`) {
t.Errorf("count includes symlink failed, output:\n%s", output)
}
}

func TestLanguageNameTruncate(t *testing.T) {
output, err := runSCC("examples/language")
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions processor/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func getExtension(name string) string {
return extension.(string)
}

func cleanVisitedPaths() {
visitedPaths.Clear()
}

func newFileJob(path, name string, fileInfo os.FileInfo) *FileJob {
if NoLarge {
if fileInfo.Size() >= LargeByteCount {
Expand Down
Loading
Loading