File tree 4 files changed +78
-0
lines changed
4 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Container image that runs your code
2
+ FROM ubuntu
3
+
4
+ # Copies your code file from your action repository to the filesystem path `/` of the container
5
+ COPY entrypoint.sh /entrypoint.sh
6
+
7
+ # Code file to execute when the docker container starts up (`entrypoint.sh`)
8
+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change
1
+ ## Check for TODO and commented out code
2
+
3
+ Check that looks for existing TODO's and commented out code in a repo
4
+
5
+ TODO's are considered:
6
+ - ` todo `
7
+ - ` TODO `
8
+ - ` to-do `
9
+ - ` FIXME `
10
+ - ` fix-me `
11
+ - ` fixme `
12
+ - ` fix me `
13
+ - ` to do `
14
+ - ` FIX ME `
15
+ - ` TO DO `
16
+ - ` XXX `
17
+ - ` xxx `
18
+ - ` FILLME `
19
+ - ` fillme `
20
+
21
+ Commented out code is any single comment in a ` .py ` file that could be considered code
22
+ E.x.:
23
+ ```
24
+ for item in list:
25
+ #print(item)
26
+ otherlist.append(item)
27
+ ```
28
+ Where the print statement would be considered commented out code
29
+
30
+ E.x.:
31
+ ```
32
+ for item in list:
33
+ # Add item to the other list
34
+ otherlist.append(item)
35
+ ```
36
+ Where the comment here is not considered commented out code
Original file line number Diff line number Diff line change
1
+ # action.yml
2
+ name : ' TODO and Commented out code status check'
3
+ description : " Checks for all TODO's and commented out code"
4
+ runs :
5
+ using : ' docker'
6
+ image : ' Dockerfile'
Original file line number Diff line number Diff line change
1
+ #! /bin/sh -l
2
+
3
+ # default passed is true, if fails checks then passed is false
4
+ passed=1
5
+
6
+
7
+ todos=$( egrep -rn " XXX|fillme|FILLME|xxx|TODO|todo|to-do|FIXME|fix-me|fixme|fix me|to do|FIX ME|TO DO" * )
8
+ case $? in
9
+ 0) echo $todos && passed=0;;
10
+ * ) echo " No TODO's found" ;;
11
+ esac
12
+
13
+
14
+ commented_code=$( egrep -rn " # " * .py > a && egrep -rn " #" * .py > b && diff -c a b | grep " +" && rm a && rm b)
15
+ # 2 is no .py # 1 is no commented code 0 is commented code
16
+
17
+ case $? in
18
+ 1) echo " No commented out code found" ;;
19
+ 2) echo " No .py files to check in project" ;;
20
+ 0) echo $commented_code && passed=0 ;;
21
+ esac
22
+
23
+ case $passed in
24
+ 0) exit 1;;
25
+ 1) exit 0;;
26
+ esac
27
+
28
+
You can’t perform that action at this time.
0 commit comments