You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bumps npm dependencies and DevSkim .NET dependencies, Fix#697 (#698)
* Bumps npm dependencies
* Update Changelog.md
* Fix#697
Populate the Description or Recommendation fields in the markdown description since that is what ends up rendered when used in github code scanning per report in #697 of inability to customize message with custom rules.
* Clean up and changelog update
* Add unit tests for SarifWriter help field logic
Introduces SarifWriterTests to verify SARIF help field population for rules with various combinations of recommendation, description, and rule info. Tests cover fallback logic, markdown formatting, and edge cases such as empty or whitespace recommendations.
* Update DevSkim-DotNet/Microsoft.DevSkim.CLI/Writers/SarifWriter.cs
Co-authored-by: Copilot <[email protected]>
* Refactor SARIF rule markdown description logic
Extracted markdown description building into a new BuildMarkdownDescription method for improved readability and maintainability. The logic for constructing the SARIF rule's Help.Markdown field is now encapsulated in a dedicated helper function.
* Refactor SarifWriterTests to use local writers
Replaces class-level StringWriter and SarifWriter fields with local variables in each test method. This improves test isolation and resource management by using 'using' statements for disposable objects.
* Refactor SARIF output parsing in tests
Replaced calls to the ParseSarifOutput helper with direct usage of JObject.Parse in SarifWriterTests. Removed the now-unused ParseSarifOutput method for simplification.
* Rename SarifWriter test methods for clarity
Test method names in SarifWriterTests.cs were updated to use descriptive, behavior-driven naming. This improves readability and makes test purposes clearer for future maintenance.
* Remove unused Patterns property in SarifWriterTests
Eliminated the Patterns property from the test case object initialization in SarifWriterTests.cs, as it was not required for the test.
* Refactor SARIF rule text description logic
Moved the logic for building SARIF rule text descriptions into a dedicated BuildTextDescription method for improved readability and maintainability.
* Add test for empty markdown in SARIF rule help
Introduces a unit test to verify that when a rule has no recommendation and no rule info, the SARIF 'help.markdown' field is empty or null, while 'help.text' falls back to the rule description.
* Update changelog for v1.0.63 with fixes and tests
Added details for version 1.0.63 including a fix for Sarif Markdown recommendation value population (#697), new test cases for SarifWriter, and updated dependencies. Fixed some section header levels to improve formatting.
* Remove redundant test for SARIF markdown help content
Deleted the test 'When_rule_has_recommendation_and_rule_info_then_markdown_includes_both' from SarifWriterTests.cs as it was redundant with `When_rule_has_recommendation_and_rule_info_then_markdown_is_properly_formatted`
* Dependencies in checked in package-lock file should use npmjs repository
The internal repository is substituted during pipeline build to allow for external contributor use
* Refactor SARIF help URI construction and update tests
Introduced a CreateHelpUri method in SarifWriter to safely construct help URIs for DevSkim rules, handling null or empty RuleInfo values. Updated related unit tests to use the new baseHelpUri constant for consistency and maintainability.
* Update tests to use SarifWriter.CreateHelpUri
Replaces references to SarifWriter.baseHelpUri with SarifWriter.CreateHelpUri in SarifWriterTests to ensure help URIs are generated consistently. This improves test accuracy and future-proofs against changes in URI construction.
* Rename baseHelpUri to BaseHelpUri in SarifWriter
Updated the constant baseHelpUri to use PascalCase (BaseHelpUri) for consistency with naming conventions. Adjusted references to the constant accordingly.
* Update SarifWriterTests to use exact string assertions
Changed tests to use Assert.AreEqual with expected markdown and help text strings instead of Assert.IsTrue with Contains. This ensures stricter validation of the output format.
* Update Changelog.md
* Refactor SarifWriterTests to reuse helpUri variable
Replaces repeated calls to SarifWriter.CreateHelpUri with a local helpUri variable in test assertions for expectedMarkdown. This improves readability and reduces redundant method calls.
* Change BaseHelpUri to private constant
Updated the visibility of the BaseHelpUri constant from public to private in SarifWriter.cs to restrict its access within the class.
* Change CreateHelpUri to internal access modifier
The CreateHelpUri method in SarifWriter was changed from public to internal to restrict its visibility within the assembly. This helps encapsulate implementation details and limits external usage.
* Update SarifWriter.cs
* Expose internals to test project and update method visibility
Added InternalsVisibleTo for Microsoft.DevSkim.Tests in the CLI project file to allow unit testing of internal members. Changed CreateHelpUri from public to internal in SarifWriter to restrict its visibility to within the assembly.
* Remove unused variable in AnalyzeTest.cs
Deleted the unused 'oneUpPath' variable from the test setup to clean up the code.
* Remove unused variable in SuppressionsTest
Deleted the unused 'oneUpPath' variable from the test method to clean up the code.
* Remove unused exception variable in regex creation
Eliminated the unused exception variable in the catch block of the regex creation method. Added a TODO comment noting the need to refactor for logging since the logger is not accessible in the static context.
---------
Co-authored-by: Copilot <[email protected]>
0 commit comments