Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Test 129 test language #518

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .secureli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ echo:
repo_files:
exclude_file_patterns:
- .idea/
- tests/end-to-end/test-data/
ignored_file_extensions:
- .pyc
- .drawio
Expand Down
152 changes: 135 additions & 17 deletions .secureli/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,136 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
- hooks:
- id: python-use-type-annotations
ambhrin-slalom marked this conversation as resolved.
Show resolved Hide resolved
repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
- hooks:
- args:
- --exclude
- tests/
- --severity-level
- medium
id: bandit
repo: https://github.com/PyCQA/bandit
rev: 1.7.8
- hooks:
- id: black
repo: https://github.com/psf/black
rev: 24.3.0
- hooks:
- entry: dotnet format --include
id: dotnet-format
language: system
name: dotnet-format
types:
- c#
repo: local
- hooks:
- id: golangci-lint
repo: https://github.com/golangci/golangci-lint
rev: v1.57.2
- hooks:
- additional_dependencies:
- eslint@8.42.0
- eslint-plugin-prettier@4.2.1
args:
- --config
- javascript.eslintrc.yaml
- --fix
files: \.[j]sx?$
id: eslint
types:
- file
repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0
- hooks:
- args:
- --single-quote
- --trailing-comma
- all
id: prettier
types_or:
- css
- javascript
repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- hooks:
- id: detekt
repo: https://github.com/quwac/pre-commit-detekt
rev: v1.23.4
- hooks:
- args:
- --autofix
id: pretty-format-kotlin
repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.13.0
- hooks:
- exclude: .xcscheme$
id: detect-secrets
repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
- hooks:
- id: swiftlint
repo: https://github.com/realm/SwiftLint
rev: 0.54.0
- hooks:
- id: detect-secrets
repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
- hooks:
- id: terraform_tflint
repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.4
- hooks:
- additional_dependencies:
- eslint@8.42.0
- '@typescript-eslint/eslint-plugin@5.59.11'
- '@typescript-eslint/parser@5.59.11'
- typescript@5.1.3
- eslint-config-prettier@8.8.0
- eslint-plugin-prettier@4.2.1
args:
- --config
- typescript.eslintrc.yaml
- --fix
files: \.[t]sx?$
id: eslint
types:
- file
repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0
- hooks:
- args:
- --single-quote
- --trailing-comma
- all
id: prettier
repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- hooks:
- id: check-added-large-files
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-toml
- id: check-json
- id: check-xml
- id: check-yaml
- id: debug-statements
- args:
- --allow-missing-credentials
id: detect-aws-credentials
- id: detect-private-key
- args:
- --pytest-test-first
id: name-tests-test
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
- hooks:
- id: detect-secrets
repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
5 changes: 5 additions & 0 deletions tests/end-to-end/test-data/CloudFormation_Sample/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Resources:
HelloWorld:
Type: AWS::S3::Bucket
Properties:
BucketName: "hello-world-bucket"
9 changes: 9 additions & 0 deletions tests/end-to-end/test-data/Csharp_Sample/src/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
7 changes: 7 additions & 0 deletions tests/end-to-end/test-data/Go_Sample/src/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Hello, world!")
}
11 changes: 11 additions & 0 deletions tests/end-to-end/test-data/JavaScript_Sample/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript_Sample</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/JavaScript_Sample/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello, world!");
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Kotlin_Sample/src/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fun main() { println("Hello, world!") }
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Python_Sample/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, world!")
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Swift_Sample/Sources/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, world!")
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/Terraform_Sample/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output "hello_world" { value = "Hello, world!" }
1 change: 1 addition & 0 deletions tests/end-to-end/test-data/TypeScript_Sample/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello, world!");
65 changes: 65 additions & 0 deletions tests/end-to-end/test-language-detect.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
setup() {
load "${BATS_LIBS_ROOT}/bats-support/load"
load "${BATS_LIBS_ROOT}/bats-assert/load"
}

@test "can detect C# language" {
#cd tests/end-to-end/test-data/Csharp_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] The following language(s) support secrets detection: C#'
assert_output --partial '[seCureLI] - C#: 100%'
}

@test "can detect Go language" {
#cd tests/end-to-end/test-data/Go_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Go: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Go.'
}

@test "can detect Javascript language" {
#cd tests/end-to-end/test-data/JavaScript_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - JavaScript: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): JavaScript.'
}

@test "can detect Kotlin language" {
#cd tests/end-to-end/test-data/Kotlin_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Kotlin: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Kotlin.'
}

@test "can detect Python language" {
#cd tests/end-to-end/test-data/Python_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Python: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Python.'
}

@test "can detect Swift language" {
#cd tests/end-to-end/test-data/Swift_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Swift.'
assert_output --partial '[seCureLI] - Swift: 100%'
}

@test "can detect Terraform language" {
#cd tests/end-to-end/test-data/Terraform_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - Terraform: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): Terraform.'
}

@test "can detect Typescript language" {
#cd tests/end-to-end/test-data/Typescript_Sample/
run python secureli/main.py init -ry
assert_output --partial '[seCureLI] - TypeScript: 100%'
assert_output --partial '[seCureLI] seCureLI has been installed successfully for the following language(s): TypeScript.cd ..'
}

@test "can detect Cloudformation language" {
ambhrin-slalom marked this conversation as resolved.
Show resolved Hide resolved
#cd tests/end-to-end/test-data/CloudFormation_Sample/
run python secureli/main.py init -ry
}
Loading