fix/lint backlog#3
Merged
Merged
Conversation
Owner
fortifyde
commented
May 6, 2026
- fix(lint): Phase 1 - quick wins (unused, ineffassign, goconst, staticcheck)
- fix(lint): Phase 2 - errcheck (23 issues)
- fix(lint): Phase 3 - gosec security findings (31+ issues)
- fix(lint): Phase 5 - empty branches (SA9003)
- fix(lint): Phase 4a - reduce cyclomatic complexity (6 functions)
- fix(lint): Phase 4b - reduce cyclomatic complexity (4 more functions)
- fix(lint): Phase 4c - reduce cyclomatic complexity (4 more functions)
- fix(lint): Phase 4d - reduce cyclomatic complexity (3 more functions)
- chore: remove accidentally committed binary
…check) - Remove unused cleanPath (fileserver) and updateDisplay (output viewer) - Fix ineffassign in parsers.go consolidated title builder - Extract string constants for sslscan, open, default, router, severity levels, switch subtype, and UI color/category strings - Apply De Morgan's law (QF1001) in config.go and mac_table.go - Convert if-else chains to tagged switches (QF1003) - Replace WriteString(Sprintf(...)) with Fprintf (QF1012) throughout - Use struct conversion for PhysicalLink (S1016) - Fix error return ordering in StreamingResult.GetFinal (ST1008) Reduces lint issues from 102 to 78 (24 fixed).
- Wrap deferred file.Close with explicit error discard pattern - Handle explicit Close/Kill/Stop errors with logging or discard - Check os.Setenv, os.Remove, filepath.Walk return values - Explicitly discard w.Write and fmt.Scanln returns - Handle test code errcheck with explicit discards All 23 errcheck issues resolved.
- Tighten file/directory permissions (0777/0755→0750, 0644→0666→0600) - Add HTTP server timeouts (ReadTimeout, WriteTimeout, IdleTimeout) - Add log injection sanitization with sanitizeLogString helper - Add io.LimitReader guards against decompression bombs in tests - Add bounds check for integer overflow in concurrency test - Add //nolint:gosec directives for accepted G304/G702/G118/G122/G602 risks - Fix G602 slice bounds checks in tui.go All 31+ gosec issues resolved. Many additional issues surfaced during fixing (test files, deeper analysis) — all addressed.
- Replace empty if branches in packet capture parser with TODO comments - Add explicit continue for informational script skip path All 3 SA9003 staticcheck issues resolved.
- Extract parsePortLine helper from parsePortScan (22→18) - Refactor parseNiktoXMLResult into 4 helpers (26→6) - Extract SSL vulnerability detectors from parseSSLScanXML (22→≤20) - Extract openScreenshotExternally from showScreenshotModal (21→20) - Extract handleGlobalCtrlShortcuts from handleGlobalKeys (21→18) - Extract buildMergedCaptureTasks from mergeCaptureAnalysisTasks (23→≤20) Reduces gocyclo from 19 to 13 issues.
- Extract categorizeHosts/copyScreenshotsToDir from GenerateDistributionPackage (24→≤15) - Extract write sections from updateDetailsPanel (29→3) - Extract CLI helpers from run (26→18) - Extract OS detection and port processing from parseNmapXML (25→11) Reduces gocyclo from 13 to 9 issues.
- Extract helpers from correlateHost (23→6) - Extract readTarEntries from TestGenerateDistributionPackage (27→16) - Extract render helpers from showHostDetailsModal (34→≤15) - Extract detection helpers from determineScanType (34→4+14+11+6+3) Reduces gocyclo from 9 to 5 issues.
- Extract protocol/cipher/cert parsers from parseSSLScanResult (33→≤10) - Extract test helpers from TestParseSSLScanResult (26→≤15) - Refactor startSearch into searchState with 11 methods (33→2) Reduces gocyclo from 5 to 2 issues (calculateRiskScore 41, inferHostSubtype 65 remain — extremely complex functions deferred to follow-up PR).
Remove fileserver binary and add to .gitignore.
Reduce cyclomatic complexity below gocyclo threshold by extracting independent scoring and inference logic into focused helpers: - scoreVulnerabilities, scoreSSLIssues, scoreServiceExposure, scoreOpenPorts - inferWindowsSubtype, inferNetworkDeviceSubtype, inferLinuxSubtype - inferDeviceBySysDesc, inferDeviceByOS, inferDeviceByPorts Result: 0 golangci-lint issues (from 2 remaining gocyclo warnings).
Replace 21 occurrences of the string literal "critical" with severityCritical across correlator.go, parsers.go, and compliance_checks.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.