mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-02-24 08:53:07 +00:00
feat: detect permissions from actions (#137)
* feat: detect permissions from actions * refactor(test): fix 25 SonarCloud issues by extracting test constants Resolved all SonarCloud code quality issues for PR #137: - Fixed 12 string duplication issues (S1192) - Fixed 13 naming convention issues (S100) Changes: - Centralized test constants in appconstants/test_constants.go * Added 9 parser test constants for YAML templates * Added 3 template test constants for paths and versions - Updated parser_test.go to use shared constants - Updated template_test.go to use shared constants - Renamed 13 test functions to camelCase (removed underscores) * chore: reduce code duplication * fix: implement cr fixes * chore: deduplication
This commit is contained in:
@@ -80,3 +80,23 @@ const (
|
||||
TestYAMLNested = "name: nested"
|
||||
TestYAMLSub = "name: sub"
|
||||
)
|
||||
|
||||
// Test YAML template strings for parser tests.
|
||||
const (
|
||||
TestActionFilePattern = "action-*.yml"
|
||||
TestPermissionsHeader = "# permissions:\n"
|
||||
TestActionNameLine = "name: Test Action\n"
|
||||
TestDescriptionLine = "description: Test\n"
|
||||
TestRunsLine = "runs:\n"
|
||||
TestCompositeUsing = " using: composite\n"
|
||||
TestStepsEmpty = " steps: []\n"
|
||||
TestErrorFormat = "ParseActionYML() error = %v"
|
||||
TestContentsRead = "# contents: read\n"
|
||||
)
|
||||
|
||||
// Test path constants for template tests.
|
||||
const (
|
||||
TestRepoActionPath = "/repo/action.yml"
|
||||
TestRepoBuildActionPath = "/repo/build/action.yml"
|
||||
TestVersionV123 = "@v1.2.3"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user