Skip to content

Commit

Permalink
Fix CSS comment syntax as mentioned in #35
Browse files Browse the repository at this point in the history
  • Loading branch information
alstr committed Mar 28, 2021
1 parent 4a70582 commit 48b6982
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 57 deletions.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def close_issue(self, issue):
class TodoParser(object):
"""Parser for extracting information from a given diff file."""
FILE_HUNK_PATTERN = r'(?<=diff)(.*?)(?=diff\s--git\s)'
HEADER_PATTERN = r'(?<=--git).*?(?=$\n(index|new))'
HEADER_PATTERN = r'(?<=--git).*?(?=$\n(index|new|deleted))'
LINE_PATTERN = r'^.*$'
FILENAME_PATTERN = re.compile(r'(?<=a/).+?(?=\sb/)')
LINE_NUMBERS_PATTERN = re.compile(r'@@[\d\s,\-+]*\s@@.*')
Expand Down
4 changes: 2 additions & 2 deletions syntax.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@
{
"type": "block",
"pattern": {
"start": "<!--",
"end": "-->"
"start": "/\\*",
"end": "\\*/"
}
}
]
Expand Down
44 changes: 17 additions & 27 deletions tests/test_closed.diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,36 @@ index d340f6a..29b54da 100644
- */
}
\ No newline at end of file
diff --git a/tests/example-file.css b/tests/example-file.css
index 344fe46..0519500 100644
--- a/tests/example-file.css
+++ b/tests/example-file.css
@@ -1,10 +1,4 @@
body {
- <!-- TODO: This is too bright -->
background: red;
- <!--
- TODO: Insufficient contrast
- Use another colour for the text
- labels: UI
- -->
color: deeppink;
}
\ No newline at end of file
diff --git a/tests/example-file.php b/tests/example-file.php
index d36df2f..e77f4bb 100644
deleted file mode 100644
index 063bb80..0000000
--- a/tests/example-file.php
+++ b/tests/example-file.php
@@ -4,19 +4,8 @@

<?php
echo 'Testing 123';
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<!-- TODO: Check HTML comments work -->
-<?php
- echo 'Testing 123';
- // TODO: Expand this page
- // We aren't doing anything here yet
-
echo 'Testing 456';
- echo 'Testing 456';
- # TODO: Definitely expand this
- # There needs to be some point to this file
-
echo 'Testing 789'
- echo 'Testing 789'
- /*
- * TODO: Echo a greeting instead
- * This should work with or without the asterisk on each line
- * labels: help wanted
- */
?>

</body>
-?>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/tests/example_file.py b/tests/example_file.py
index 525e25d..ba4e68d 100644
--- a/tests/example_file.py
Expand Down
21 changes: 2 additions & 19 deletions tests/test_new.diff
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,16 @@ index 0000000..d340f6a
+ */
+}
\ No newline at end of file
diff --git a/tests/example-file.css b/tests/example-file.css
new file mode 100644
index 0000000..344fe46
--- /dev/null
+++ b/tests/example-file.css
@@ -0,0 +1,10 @@
+body {
+ <!-- TODO: This is too bright -->
+ background: red;
+ <!--
+ TODO: Insufficient contrast
+ Use another colour for the text
+ labels: UI
+ -->
+ color: deeppink;
+}
\ No newline at end of file
diff --git a/tests/example-file.php b/tests/example-file.php
new file mode 100644
index 0000000..d36df2f
index 0000000..063bb80
--- /dev/null
+++ b/tests/example-file.php
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<!-- TODO: Check HTML comments work -->
+<?php
+ echo 'Testing 123';
+ // TODO: Expand this page
Expand Down
10 changes: 2 additions & 8 deletions tests/test_todo_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ def test_yaml_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)

def test_php_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 3)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 4)

def test_java_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)

def test_css_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'css'), 2)

def test_ruby_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)

Expand All @@ -48,13 +45,10 @@ def test_yaml_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)

def test_php_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 3)
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 4)

def test_java_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)

def test_css_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'css'), 2)

def test_ruby_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)

0 comments on commit 48b6982

Please sign in to comment.