Skip to content

CHORE: Reduce DevSkim false positives in test and pipeline files#524

Open
bewithgaurav wants to merge 1 commit intomainfrom
bewithgaurav/devskim-exclude-tests
Open

CHORE: Reduce DevSkim false positives in test and pipeline files#524
bewithgaurav wants to merge 1 commit intomainfrom
bewithgaurav/devskim-exclude-tests

Conversation

@bewithgaurav
Copy link
Copy Markdown
Collaborator

@bewithgaurav bewithgaurav commented Apr 15, 2026

Work Item / Issue Reference

AB#44031

GitHub Issue: #<ISSUE_NUMBER>


Summary

This pull request makes improvements to the DevSkim workflow configuration and refines the bulk copy test logic in test_019_bulkcopy.py. The main focus is on enhancing test reliability and accuracy when handling database parameters and improving DevSkim scan efficiency.

DevSkim workflow configuration:

  • Updated .github/workflows/devskim.yml to ignore test and benchmark files during security scans, and to suppress a specific non-security rule related to TODO comments. This helps reduce noise in scan results and focuses attention on relevant security issues.

Bulk copy test improvements:

  • Refactored test_bulkcopy_without_database_parameter in test_019_bulkcopy.py to always use the actual current database (as determined after connecting) for bulk copy operations, rather than relying on the original database from the connection string. This ensures the test is robust even if the default database differs from the original one and eliminates unnecessary switching between databases. [1] [2] [3]
  • Improved SQL execution style in test_bulkcopy_with_server_synonyms by switching from multi-line f-strings to the preferred cursor.execute with triple-quoted strings, enhancing readability and consistency. [1] [2]

Copilot AI review requested due to automatic review settings April 15, 2026 06:56
@bewithgaurav bewithgaurav force-pushed the bewithgaurav/devskim-exclude-tests branch from 3422a00 to ce4ecbf Compare April 15, 2026 07:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the DevSkim GitHub Actions workflow configuration to reduce false positives and speed up scanning by excluding certain paths and rules from analysis.

Changes:

  • Configure DevSkim to skip scanning archives.
  • Exclude tests/**, benchmarks/**, and test_*.py from scanning via ignore globs.
  • Globally suppress DevSkim rules DS176209 (TODO comments) and DS137138 (localhost usage).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bewithgaurav bewithgaurav force-pushed the bewithgaurav/devskim-exclude-tests branch from ce4ecbf to db5d72b Compare April 15, 2026 07:06
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 15, 2026

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

79%


📈 Total Lines Covered: 6677 out of 8449
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 67.8%
mssql_python.row.py: 70.5%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 74.2%
mssql_python.pybind.connection.connection.cpp: 75.8%
mssql_python.__init__.py: 77.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 85.2%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@github-actions github-actions bot added the pr-size: small Minimal code update label Apr 15, 2026
@bewithgaurav bewithgaurav force-pushed the bewithgaurav/devskim-exclude-tests branch 5 times, most recently from 852afee to 2c1f0ee Compare April 15, 2026 12:03
- Exclude tests/, **/test_*.py, and benchmarks/ from DevSkim scanning
  (localhost in test connection strings is not debug code)
- Suppress DS176209 (TODO comments) — informational, not a security concern
- DS137138 (localhost) left enabled — path exclusions handle test files,
  keeps coverage for accidental localhost in production code
- Fix test_bulkcopy_without_database_parameter: remove USE statement
  which is not supported on Azure SQL Database, use fully qualified
  table names with the default database instead
@bewithgaurav bewithgaurav force-pushed the bewithgaurav/devskim-exclude-tests branch from 2c1f0ee to 0794968 Compare April 15, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants