diff --git a/cover.out b/cover.out index ceedeca..b2ff209 100644 --- a/cover.out +++ b/cover.out @@ -1,8 +1,4 @@ mode: atomic -github.com/george-maroun/tracecheck/internal/stringutil/is.go:6.29,7.22 1 4 -github.com/george-maroun/tracecheck/internal/stringutil/is.go:7.22,8.25 1 9 -github.com/george-maroun/tracecheck/internal/stringutil/is.go:8.25,11.4 1 2 -github.com/george-maroun/tracecheck/internal/stringutil/is.go:14.2,14.13 1 2 github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:9.26,11.3 1 1 github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:14.26,18.2 3 1 github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:20.29,22.2 1 1 @@ -80,36 +76,40 @@ github.com/george-maroun/tracecheck/internal/sets/string.go:43.41,45.13 2 3 github.com/george-maroun/tracecheck/internal/sets/string.go:45.13,48.3 2 1 github.com/george-maroun/tracecheck/internal/sets/string.go:50.2,53.12 4 2 github.com/george-maroun/tracecheck/internal/sets/string.go:57.36,59.2 1 4 +github.com/george-maroun/tracecheck/internal/stringutil/is.go:6.29,7.22 1 4 +github.com/george-maroun/tracecheck/internal/stringutil/is.go:7.22,8.25 1 9 +github.com/george-maroun/tracecheck/internal/stringutil/is.go:8.25,11.4 1 2 +github.com/george-maroun/tracecheck/internal/stringutil/is.go:14.2,14.13 1 2 github.com/george-maroun/tracecheck/loggercheck.go:24.53,34.2 3 2 github.com/george-maroun/tracecheck/loggercheck.go:51.50,66.27 7 2 github.com/george-maroun/tracecheck/loggercheck.go:66.27,68.3 1 0 github.com/george-maroun/tracecheck/loggercheck.go:70.2,70.10 1 2 -github.com/george-maroun/tracecheck/loggercheck.go:73.59,75.2 1 4 -github.com/george-maroun/tracecheck/loggercheck.go:79.42,80.55 1 5 -github.com/george-maroun/tracecheck/loggercheck.go:80.55,82.3 1 4 +github.com/george-maroun/tracecheck/loggercheck.go:73.59,75.2 1 7 +github.com/george-maroun/tracecheck/loggercheck.go:79.42,80.55 1 8 +github.com/george-maroun/tracecheck/loggercheck.go:80.55,82.3 1 7 github.com/george-maroun/tracecheck/loggercheck.go:83.2,83.14 1 1 -github.com/george-maroun/tracecheck/loggercheck.go:86.74,88.16 2 5 +github.com/george-maroun/tracecheck/loggercheck.go:86.74,88.16 2 8 github.com/george-maroun/tracecheck/loggercheck.go:88.16,90.3 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:92.2,95.30 3 5 -github.com/george-maroun/tracecheck/loggercheck.go:95.30,97.35 2 4 +github.com/george-maroun/tracecheck/loggercheck.go:92.2,95.30 3 8 +github.com/george-maroun/tracecheck/loggercheck.go:95.30,97.35 2 7 github.com/george-maroun/tracecheck/loggercheck.go:97.35,99.12 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:103.3,104.53 2 4 -github.com/george-maroun/tracecheck/loggercheck.go:104.53,105.13 1 1 -github.com/george-maroun/tracecheck/loggercheck.go:108.3,108.20 1 3 +github.com/george-maroun/tracecheck/loggercheck.go:103.3,104.53 2 7 +github.com/george-maroun/tracecheck/loggercheck.go:104.53,105.13 1 2 +github.com/george-maroun/tracecheck/loggercheck.go:108.3,108.20 1 5 github.com/george-maroun/tracecheck/loggercheck.go:108.20,109.12 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:112.3,113.21 2 3 -github.com/george-maroun/tracecheck/loggercheck.go:113.21,115.4 1 3 +github.com/george-maroun/tracecheck/loggercheck.go:112.3,113.21 2 5 +github.com/george-maroun/tracecheck/loggercheck.go:113.21,115.4 1 5 github.com/george-maroun/tracecheck/loggercheck.go:116.3,116.17 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:119.2,119.12 1 2 -github.com/george-maroun/tracecheck/loggercheck.go:122.85,124.15 2 13 +github.com/george-maroun/tracecheck/loggercheck.go:119.2,119.12 1 3 +github.com/george-maroun/tracecheck/loggercheck.go:122.85,124.15 2 18 github.com/george-maroun/tracecheck/loggercheck.go:124.15,126.3 1 1 -github.com/george-maroun/tracecheck/loggercheck.go:128.2,129.28 2 12 -github.com/george-maroun/tracecheck/loggercheck.go:129.28,131.3 1 6 -github.com/george-maroun/tracecheck/loggercheck.go:134.2,134.29 1 6 +github.com/george-maroun/tracecheck/loggercheck.go:128.2,129.28 2 17 +github.com/george-maroun/tracecheck/loggercheck.go:129.28,131.3 1 8 +github.com/george-maroun/tracecheck/loggercheck.go:134.2,134.29 1 9 github.com/george-maroun/tracecheck/loggercheck.go:134.29,136.3 1 1 -github.com/george-maroun/tracecheck/loggercheck.go:138.2,139.20 2 5 -github.com/george-maroun/tracecheck/loggercheck.go:139.20,141.3 1 2 -github.com/george-maroun/tracecheck/loggercheck.go:144.2,154.4 2 3 +github.com/george-maroun/tracecheck/loggercheck.go:138.2,139.20 2 8 +github.com/george-maroun/tracecheck/loggercheck.go:139.20,141.3 1 3 +github.com/george-maroun/tracecheck/loggercheck.go:144.2,154.4 2 5 github.com/george-maroun/tracecheck/loggercheck.go:157.45,160.22 3 2 github.com/george-maroun/tracecheck/loggercheck.go:160.22,162.17 2 0 github.com/george-maroun/tracecheck/loggercheck.go:162.17,164.4 1 0 @@ -126,16 +126,16 @@ github.com/george-maroun/tracecheck/loggercheck.go:185.2,187.12 2 2 github.com/george-maroun/tracecheck/loggercheck.go:190.69,192.16 2 2 github.com/george-maroun/tracecheck/loggercheck.go:192.16,194.3 1 0 github.com/george-maroun/tracecheck/loggercheck.go:196.2,200.48 3 2 -github.com/george-maroun/tracecheck/loggercheck.go:200.48,204.21 3 13 +github.com/george-maroun/tracecheck/loggercheck.go:200.48,204.21 3 18 github.com/george-maroun/tracecheck/loggercheck.go:204.21,206.4 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:209.3,210.32 2 13 -github.com/george-maroun/tracecheck/loggercheck.go:210.32,211.42 1 13 -github.com/george-maroun/tracecheck/loggercheck.go:211.42,213.10 2 13 -github.com/george-maroun/tracecheck/loggercheck.go:217.3,217.18 1 13 +github.com/george-maroun/tracecheck/loggercheck.go:209.3,210.32 2 18 +github.com/george-maroun/tracecheck/loggercheck.go:210.32,211.42 1 18 +github.com/george-maroun/tracecheck/loggercheck.go:211.42,213.10 2 18 +github.com/george-maroun/tracecheck/loggercheck.go:217.3,217.18 1 18 github.com/george-maroun/tracecheck/loggercheck.go:217.18,219.4 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:223.3,229.17 5 13 +github.com/george-maroun/tracecheck/loggercheck.go:223.3,229.17 5 18 github.com/george-maroun/tracecheck/loggercheck.go:229.17,232.4 1 0 -github.com/george-maroun/tracecheck/loggercheck.go:234.3,234.37 1 13 +github.com/george-maroun/tracecheck/loggercheck.go:234.3,234.37 1 18 github.com/george-maroun/tracecheck/loggercheck.go:237.2,237.17 1 2 github.com/george-maroun/tracecheck/options.go:9.43,10.30 1 0 github.com/george-maroun/tracecheck/options.go:10.30,12.3 1 0 @@ -153,87 +153,94 @@ github.com/george-maroun/tracecheck/staticrules.go:61.2,61.27 1 5 github.com/george-maroun/tracecheck/staticrules.go:61.27,62.68 1 1 github.com/george-maroun/tracecheck/staticrules.go:65.2,67.16 3 4 github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:9.26,11.3 1 2 -github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:14.26,18.2 3 3 -github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:20.29,22.2 1 3 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:32.83,39.27 6 3 +github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:14.26,18.2 3 5 +github.com/george-maroun/tracecheck/internal/bytebufferpool/pool.go:20.29,22.2 1 5 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:32.83,39.27 6 5 github.com/george-maroun/tracecheck/internal/checkers/checker.go:39.27,41.3 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:43.2,45.31 2 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:43.2,45.31 2 5 github.com/george-maroun/tracecheck/internal/checkers/checker.go:45.31,54.3 3 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:57.2,58.21 2 3 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:58.21,60.3 1 2 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:62.2,63.45 2 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:63.45,66.10 3 2 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:66.10,68.12 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:80.3,80.35 1 2 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:80.35,82.9 2 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:86.2,86.17 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:86.17,98.17 3 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:98.17,106.4 2 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:109.3,119.28 5 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:119.28,121.4 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:123.3,127.37 3 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:127.37,129.4 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:132.3,156.39 7 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:156.39,165.4 2 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:167.3,174.18 2 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:177.2,177.26 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:177.26,179.3 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:181.2,181.22 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:181.22,184.3 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:189.92,190.42 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:190.42,191.24 1 126 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:192.22,193.67 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:193.67,195.5 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:196.21,197.50 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:197.50,199.5 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:201.3,201.14 1 126 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:203.2,203.8 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:208.70,211.35 2 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:211.35,213.29 2 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:213.29,215.4 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:216.3,216.19 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:220.2,220.20 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:224.52,228.32 3 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:228.32,231.58 2 4 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:231.58,233.5 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:234.4,234.26 1 4 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:237.2,237.18 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:241.50,242.27 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:242.27,244.6 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:246.5,246.23 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:249.53,250.27 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:250.27,252.6 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:254.5,254.23 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:260.80,261.20 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:261.20,263.6 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:265.5,265.37 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:265.37,267.16 2 2 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:267.16,268.21 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:272.9,272.40 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:272.40,273.48 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:273.48,275.23 2 3 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:275.23,277.18 1 3 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:281.5,281.28 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:286.66,288.16 2 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:288.16,290.3 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:292.2,292.41 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:292.41,293.56 1 3 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:293.56,295.5 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:298.2,298.26 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:298.26,301.3 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:303.2,303.25 1 0 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:307.70,310.42 2 3 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:310.42,311.15 1 416 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:311.15,313.4 1 208 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:315.3,315.39 1 208 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:315.39,317.41 1 23 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:317.41,319.52 1 4 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:319.52,321.47 1 4 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:321.47,322.54 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:322.54,323.39 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:323.39,325.9 1 1 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:331.3,331.14 1 208 -github.com/george-maroun/tracecheck/internal/checkers/checker.go:333.2,333.15 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:57.2,58.26 2 5 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:58.26,60.3 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:62.2,63.31 2 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:63.31,65.3 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:68.2,69.45 2 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:69.45,72.10 3 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:72.10,74.12 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:86.3,86.35 1 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:86.35,88.9 2 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:92.2,92.17 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:92.17,104.17 3 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:104.17,112.4 2 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:115.3,125.28 5 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:125.28,127.4 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:129.3,133.37 3 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:133.37,135.4 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:138.3,162.39 7 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:162.39,171.4 2 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:173.3,180.18 2 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:183.2,183.26 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:183.26,185.3 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:187.2,187.22 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:187.22,190.3 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:195.71,196.42 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:196.42,197.24 1 672 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:198.22,199.67 1 6 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:199.67,201.5 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:203.3,203.14 1 672 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:205.2,205.8 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:210.70,213.35 2 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:213.35,215.29 2 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:215.29,217.4 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:218.3,218.19 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:222.2,222.20 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:225.62,229.16 2 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:229.16,230.46 1 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:230.46,231.57 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:231.57,232.77 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:232.77,233.39 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:233.39,235.7 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:240.2,240.14 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:245.52,249.32 3 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:249.32,252.58 2 4 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:252.58,254.5 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:255.4,255.26 1 4 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:258.2,258.18 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:262.50,263.27 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:263.27,265.6 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:267.5,267.23 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:270.53,271.27 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:271.27,273.6 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:275.5,275.23 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:281.80,282.20 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:282.20,284.6 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:286.5,286.37 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:286.37,288.16 2 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:288.16,289.21 1 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:293.9,293.40 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:293.40,294.48 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:294.48,296.23 2 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:296.23,298.18 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:302.5,302.28 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:307.66,309.16 2 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:309.16,311.3 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:313.2,313.41 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:313.41,314.56 1 3 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:314.56,316.5 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:319.2,319.26 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:319.26,322.3 1 1 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:324.2,324.25 1 0 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:328.70,331.42 2 5 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:331.42,332.15 1 1060 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:332.15,334.4 1 530 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:336.3,336.39 1 530 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:336.39,338.41 1 39 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:338.41,340.52 1 7 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:340.52,342.47 1 7 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:342.47,343.54 1 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:343.54,344.39 1 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:344.39,346.9 1 2 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:352.3,352.14 1 530 +github.com/george-maroun/tracecheck/internal/checkers/checker.go:354.2,354.15 1 5 github.com/george-maroun/tracecheck/internal/checkers/common.go:21.91,22.55 1 0 github.com/george-maroun/tracecheck/internal/checkers/common.go:22.55,23.113 1 0 github.com/george-maroun/tracecheck/internal/checkers/common.go:23.113,25.4 1 0 @@ -243,7 +250,7 @@ github.com/george-maroun/tracecheck/internal/checkers/common.go:39.40,42.33 2 0 github.com/george-maroun/tracecheck/internal/checkers/common.go:42.33,45.4 2 0 github.com/george-maroun/tracecheck/internal/checkers/common.go:46.3,46.20 1 0 github.com/george-maroun/tracecheck/internal/checkers/common.go:48.2,48.10 1 0 -github.com/george-maroun/tracecheck/internal/checkers/general.go:15.91,17.2 1 3 +github.com/george-maroun/tracecheck/internal/checkers/general.go:15.91,17.2 1 5 github.com/george-maroun/tracecheck/internal/checkers/general.go:19.80,20.44 1 0 github.com/george-maroun/tracecheck/internal/checkers/general.go:20.44,22.60 2 0 github.com/george-maroun/tracecheck/internal/checkers/general.go:22.60,23.33 1 0 @@ -324,31 +331,31 @@ github.com/george-maroun/tracecheck/internal/checkers/printf/printf.go:241.26,24 github.com/george-maroun/tracecheck/internal/checkers/printf/printf.go:245.3,245.10 1 0 github.com/george-maroun/tracecheck/internal/checkers/printf/printf.go:245.10,248.4 2 0 github.com/george-maroun/tracecheck/internal/checkers/printf/printf.go:251.2,251.8 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:26.47,32.9 3 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:26.47,32.9 3 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:32.9,34.3 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:36.2,36.30 1 3 -github.com/george-maroun/tracecheck/internal/rules/rules.go:36.30,38.27 2 3 -github.com/george-maroun/tracecheck/internal/rules/rules.go:38.27,40.4 1 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:36.2,36.30 1 5 +github.com/george-maroun/tracecheck/internal/rules/rules.go:36.30,38.27 2 5 +github.com/george-maroun/tracecheck/internal/rules/rules.go:38.27,40.4 1 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:43.2,43.14 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:46.49,51.37 4 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:46.49,51.37 4 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:52.22,54.53 2 0 github.com/george-maroun/tracecheck/internal/rules/rules.go:54.53,56.4 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:57.20,58.23 1 3 -github.com/george-maroun/tracecheck/internal/rules/rules.go:61.2,61.22 1 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:57.20,58.23 1 5 +github.com/george-maroun/tracecheck/internal/rules/rules.go:61.2,61.22 1 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:61.22,64.3 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:66.2,68.58 3 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:66.2,68.58 3 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:68.58,70.38 2 0 github.com/george-maroun/tracecheck/internal/rules/rules.go:70.38,71.13 1 0 github.com/george-maroun/tracecheck/internal/rules/rules.go:71.13,74.5 1 0 github.com/george-maroun/tracecheck/internal/rules/rules.go:75.4,76.35 2 0 github.com/george-maroun/tracecheck/internal/rules/rules.go:78.3,78.21 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:81.2,81.21 1 3 -github.com/george-maroun/tracecheck/internal/rules/rules.go:84.56,88.32 3 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:81.2,81.21 1 5 +github.com/george-maroun/tracecheck/internal/rules/rules.go:84.56,88.32 3 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:88.32,90.3 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:92.2,92.16 1 3 -github.com/george-maroun/tracecheck/internal/rules/rules.go:92.16,95.37 3 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:92.2,92.16 1 5 +github.com/george-maroun/tracecheck/internal/rules/rules.go:92.16,95.37 3 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:95.37,97.4 1 0 -github.com/george-maroun/tracecheck/internal/rules/rules.go:100.2,100.13 1 3 +github.com/george-maroun/tracecheck/internal/rules/rules.go:100.2,100.13 1 5 github.com/george-maroun/tracecheck/internal/rules/rules.go:109.81,110.59 1 25 github.com/george-maroun/tracecheck/internal/rules/rules.go:110.59,112.3 1 178 github.com/george-maroun/tracecheck/internal/rules/rules.go:113.2,113.43 1 25 @@ -388,7 +395,7 @@ github.com/george-maroun/tracecheck/internal/rules/rules.go:200.2,200.26 1 0 github.com/george-maroun/tracecheck/internal/sets/string.go:12.43,16.2 3 2 github.com/george-maroun/tracecheck/internal/sets/string.go:18.44,19.29 1 2 github.com/george-maroun/tracecheck/internal/sets/string.go:19.29,21.3 1 2 -github.com/george-maroun/tracecheck/internal/sets/string.go:24.42,27.2 2 4 +github.com/george-maroun/tracecheck/internal/sets/string.go:24.42,27.2 2 7 github.com/george-maroun/tracecheck/internal/sets/string.go:29.36,30.17 1 2 github.com/george-maroun/tracecheck/internal/sets/string.go:30.17,32.3 1 0 github.com/george-maroun/tracecheck/internal/sets/string.go:34.2,35.21 2 2 diff --git a/internal/checkers/checker.go b/internal/checkers/checker.go index 3db87b2..bee1a79 100644 --- a/internal/checkers/checker.go +++ b/internal/checkers/checker.go @@ -54,8 +54,13 @@ func ExecuteChecker(c Checker, pass *analysis.Pass, call CallContext, cfg Config } // Return if WithValues is not invoked on NewLogger - result := isWithValuesCallOnNewLogger(call.File, call.Expr.Pos()) - if result == false { + onNewLogger := isWithValuesCallOnNewLogger(call.File, call.Expr.Pos()) + if onNewLogger == false { + return + } + + funcTakesContext := hasContextParameter(call.File, call.Expr.Pos()) + if funcTakesContext == false { return } @@ -186,17 +191,13 @@ func ExecuteChecker(c Checker, pass *analysis.Pass, call CallContext, cfg Config // EnclosingFunc finds the function that encloses the given position. // TODO: Refactor the code to avoid revisiting files -func enclosingFunc(file *ast.File, pos token.Pos) (fun *ast.FuncDecl, funLit *ast.FuncLit) { +func enclosingFunc(file *ast.File, pos token.Pos) (fun *ast.FuncDecl) { ast.Inspect(file, func(n ast.Node) bool { switch v := n.(type) { case *ast.FuncDecl: if v.Body != nil && pos >= v.Body.Pos() && pos <= v.Body.End() { fun = v } - case *ast.FuncLit: - if pos >= v.Body.Pos() && pos <= v.Body.End() { - funLit = v - } } return true }) @@ -206,7 +207,7 @@ func enclosingFunc(file *ast.File, pos token.Pos) (fun *ast.FuncDecl, funLit *as // FindPosOfFuncBody returns the position of the beginning of the function's body // that contains the given call expression. func findPosOfFuncBody(file *ast.File, call *ast.CallExpr) token.Pos { - fun, _ := enclosingFunc(file, call.Pos()) + fun := enclosingFunc(file, call.Pos()) if fun != nil && fun.Body != nil { insertPos := fun.Body.Rbrace @@ -220,6 +221,25 @@ func findPosOfFuncBody(file *ast.File, call *ast.CallExpr) token.Pos { return token.NoPos } +func hasContextParameter(file *ast.File, pos token.Pos) bool { + fun := enclosingFunc(file, pos) + + // Check if the enclosing function declaration has a parameter of type context.Context + if fun != nil { + for _, param := range fun.Type.Params.List { + if selExpr, ok := param.Type.(*ast.SelectorExpr); ok { + if xIdent, ok := selExpr.X.(*ast.Ident); ok && xIdent.Name == "context" { + if selExpr.Sel.Name == "Context" { + return true + } + } + } + } + } + return false +} + + func getArgs(call *ast.CallExpr) ([]string, error) { fset := token.NewFileSet() @@ -331,9 +351,4 @@ func isWithValuesCallOnNewLogger(file *ast.File, pos token.Pos) bool { return true }) return result -} - - - - - +} \ No newline at end of file diff --git a/testdata/src/a/fix_import/example.go b/testdata/src/a/fix_import/example.go index 9b1d990..5a18f5f 100644 --- a/testdata/src/a/fix_import/example.go +++ b/testdata/src/a/fix_import/example.go @@ -11,4 +11,11 @@ func SomeFunc(ctx context.Context, eventType, deliveryID string, payload []byte) log = log.WithValues("eventType", "hello") log.Info("Tracing") return nil +} + +func SomeFunc1(eventType, deliveryID string, payload []byte) error { + log := zapr.NewLogger(zap.L()).WithValues("eventType", eventType, "deliverID", deliveryID) // cannot be detected + log = log.WithValues("eventType", "hello") + log.Info("Tracing") + return nil } \ No newline at end of file diff --git a/testdata/src/a/fix_import/example.go.golden b/testdata/src/a/fix_import/example.go.golden index 3f9c7ed..7021274 100644 --- a/testdata/src/a/fix_import/example.go.golden +++ b/testdata/src/a/fix_import/example.go.golden @@ -13,4 +13,11 @@ func SomeFunc(ctx context.Context, eventType, deliveryID string, payload []byte) log = log.WithValues("eventType", "hello") log.Info("Tracing") return nil +} + +func SomeFunc1(eventType, deliveryID string, payload []byte) error { + log := zapr.NewLogger(zap.L()).WithValues("eventType", eventType, "deliverID", deliveryID) // cannot be detected + log = log.WithValues("eventType", "hello") + log.Info("Tracing") + return nil } \ No newline at end of file