Skip to content
New issue

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

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

Already on GitHub? # to your account

Create yaml test file #64

Merged
merged 6 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/analyzer/analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ func TestMatchingFiles(t *testing.T) {
Extension: ".md",
Language: "Markdown",
},
{
FilePath: filepath.Join(codeSamplesDir, "example.yml"),
Extension: ".yml",
Language: "YAML",
},
},
},
{
Expand Down Expand Up @@ -215,6 +220,11 @@ func TestMatchingFiles(t *testing.T) {
Extension: ".md",
Language: "Markdown",
},
{
FilePath: filepath.Join(codeSamplesDir, "example.yml"),
Extension: ".yml",
Language: "YAML",
},
},
},
{
Expand Down Expand Up @@ -302,6 +312,11 @@ func TestMatchingFiles(t *testing.T) {
Extension: ".md",
Language: "Markdown",
},
{
FilePath: filepath.Join(codeSamplesDir, "example.yml"),
Extension: ".yml",
Language: "YAML",
},
},
},
{
Expand Down
12 changes: 12 additions & 0 deletions pkg/scanner/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func TestScan(t *testing.T) {
Extension: ".md",
Language: "Markdown",
},
{
FilePath: filepath.Join(codeSamplesDir, "example.yml"),
Extension: ".yml",
Language: "YAML",
},
}

expected := []scanResult{
Expand Down Expand Up @@ -218,6 +223,13 @@ func TestScan(t *testing.T) {
BlankLines: 6,
Comments: 0,
},
{
Metadata: files[16],
Lines: 28,
CodeLines: 25,
BlankLines: 1,
Comments: 2,
},
}

result, err := scanner.Scan(files)
Expand Down
28 changes: 28 additions & 0 deletions test/fixtures/code_samples/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
spring:
config:
import: optional:configserver:http://localhost:8888/
cloud:
vault:
generic:
enabled: true
profile-separator: '/'
default-context: app
# this is 2 line
# yaml comment
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: validate
application:
name: app-name
liquibase:
change-log: classpath:db/changelog/db.changelog-master.xml
keycloak:
auth-server-url: http://localhost:8080/auth
realm: master
resource: resource-name
server:
port: 0