Commit 070b250
authored
CHORE: Reduce DevSkim false positives in test and pipeline files (#524)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below
For external contributors: Insert Github Issue number below
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#44031](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/44031)
<!-- External contributors: GitHub Issue -->
> GitHub Issue: #<ISSUE_NUMBER>
-------------------------------------------------------------------
### Summary
<!-- Insert your summary of changes below. Minimum 10 characters
required. -->
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]](diffhunk://#diff-2988adac0021aa3e34b6248a0ed60ae208921fff7c73d3b754c198fae5fa40c4L102-L104)
[[2]](diffhunk://#diff-2988adac0021aa3e34b6248a0ed60ae208921fff7c73d3b754c198fae5fa40c4L122-R119)
[[3]](diffhunk://#diff-2988adac0021aa3e34b6248a0ed60ae208921fff7c73d3b754c198fae5fa40c4L140-R135)
* 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]](diffhunk://#diff-2988adac0021aa3e34b6248a0ed60ae208921fff7c73d3b754c198fae5fa40c4L192-R191)
[[2]](diffhunk://#diff-2988adac0021aa3e34b6248a0ed60ae208921fff7c73d3b754c198fae5fa40c4L239-R240)
<!--
### PR Title Guide
> For feature requests
FEAT: (short-description)
> For non-feature requests like test case updates, config updates ,
dependency updates etc
CHORE: (short-description)
> For Fix requests
FIX: (short-description)
> For doc update requests
DOC: (short-description)
> For Formatting, indentation, or styling update
STYLE: (short-description)
> For Refactor, without any feature changes
REFACTOR: (short-description)
> For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)
### Contribution Guidelines
External contributors:
- Create a GitHub issue first:
https://github.com/microsoft/mssql-python/issues/new
- Link the GitHub issue in the "GitHub Issue" section above
- Follow the PR title format and provide a meaningful summary
mssql-python maintainers:
- Create an ADO Work Item following internal processes
- Link the ADO Work Item in the "ADO Work Item" section above
- Follow the PR title format and provide a meaningful summary
-->1 parent acbe020 commit 070b250
2 files changed
+29
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 102 | | |
106 | 103 | | |
107 | 104 | | |
| |||
119 | 116 | | |
120 | 117 | | |
121 | 118 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
127 | 137 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
131 | 145 | | |
132 | 146 | | |
133 | 147 | | |
| |||
137 | 151 | | |
138 | 152 | | |
139 | 153 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 154 | + | |
146 | 155 | | |
147 | 156 | | |
148 | 157 | | |
| |||
0 commit comments