Skip to content

feat/IDE-1066_new-sast-scanner #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bastiandoetsch
Copy link
Contributor

No description provided.

This commit implements a code scanner that provides comprehensive, type-safe, and flexible handling of code scanning results.

Key features implemented:

1. Core Scanner Implementation:
   - Support for multiple input formats (SARIF and local findings)
   - Robust error handling with proper context through error wrapping
   - Null-safety through careful nil reference checking
   - Consistent processing of various payload types
   - Safe logger access with robust nil detection

2. Issue Wrapper Implementation:
   - Comprehensive FindingIssueWrapper to convert local findings to types.Issue
   - Support for all required Issue interface methods
   - Proper severity mapping from finding ratings to standard severities
   - Handling for CWE information extraction
   - Flexible metadata access through GetAdditionalData

3. Test Coverage and Validation:
   - Comprehensive test suite with ~80% code coverage
   - Tests for all edge cases including empty results, nil payloads, and malformed data
   - Tests for severity mapping across all possible levels
   - Validation of error propagation and context preservation
   - Mock logger implementation for testing log output

4. Code Quality Enhancements:
   - Documentation for all public functions and methods
   - Consistent coding style with standardized naming
   - Clear separation of concerns for data conversion
   - Proper resource cleanup and error handling
   - Fully compliant with project linting standards

This implementation provides a complete code scanning solution that efficiently converts both local findings and SARIF data into a standardized issue format while maintaining high standards for error handling, type safety, and code quality.
- Fix nil reference handling with robust isNilInterface helper function
- Replace deprecated configuration.NewInMemory() with recommended NewWithOpts approach
- Improve error handling by treating empty results as normal rather than errors
- Add proper error wrapping with context using fmt.Errorf and %w verb
- Fix potential nil pointer dereferences in GetRuleID
- Add tests for previously untested code paths
- Improve test coverage from 79.9% to 83.9%
- Fix all linting issues identified by gofmt and golangci-lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant