Fix CSS comment syntax as mentioned in #35

This commit is contained in:
alstr 2021-03-28 14:44:48 +01:00
parent 4a70582cd5
commit 48b6982095
5 changed files with 24 additions and 57 deletions

View File

@ -161,7 +161,7 @@ class GitHubClient(object):
class TodoParser(object): class TodoParser(object):
"""Parser for extracting information from a given diff file.""" """Parser for extracting information from a given diff file."""
FILE_HUNK_PATTERN = r'(?<=diff)(.*?)(?=diff\s--git\s)' 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'^.*$' LINE_PATTERN = r'^.*$'
FILENAME_PATTERN = re.compile(r'(?<=a/).+?(?=\sb/)') FILENAME_PATTERN = re.compile(r'(?<=a/).+?(?=\sb/)')
LINE_NUMBERS_PATTERN = re.compile(r'@@[\d\s,\-+]*\s@@.*') LINE_NUMBERS_PATTERN = re.compile(r'@@[\d\s,\-+]*\s@@.*')

View File

@ -222,8 +222,8 @@
{ {
"type": "block", "type": "block",
"pattern": { "pattern": {
"start": "<!--", "start": "/\\*",
"end": "-->" "end": "\\*/"
} }
} }
] ]

View File

@ -17,46 +17,36 @@ index d340f6a..29b54da 100644
- */ - */
} }
\ No newline at end of file \ 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 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 --- a/tests/example-file.php
+++ b/tests/example-file.php +++ /dev/null
@@ -4,19 +4,8 @@ @@ -1,23 +0,0 @@
-<!DOCTYPE html>
<?php -<html>
echo 'Testing 123'; -<body>
-<!-- TODO: Check HTML comments work -->
-<?php
- echo 'Testing 123';
- // TODO: Expand this page - // TODO: Expand this page
- // We aren't doing anything here yet - // We aren't doing anything here yet
- -
echo 'Testing 456'; - echo 'Testing 456';
- # TODO: Definitely expand this - # TODO: Definitely expand this
- # There needs to be some point to this file - # There needs to be some point to this file
- -
echo 'Testing 789' - echo 'Testing 789'
- /* - /*
- * TODO: Echo a greeting instead - * TODO: Echo a greeting instead
- * This should work with or without the asterisk on each line - * This should work with or without the asterisk on each line
- * labels: help wanted - * labels: help wanted
- */ - */
?> -?>
-
</body> -</body>
-</html>
\ No newline at end of file
diff --git a/tests/example_file.py b/tests/example_file.py diff --git a/tests/example_file.py b/tests/example_file.py
index 525e25d..ba4e68d 100644 index 525e25d..ba4e68d 100644
--- a/tests/example_file.py --- a/tests/example_file.py

View File

@ -18,33 +18,16 @@ index 0000000..d340f6a
+ */ + */
+} +}
\ No newline at end of file \ 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 diff --git a/tests/example-file.php b/tests/example-file.php
new file mode 100644 new file mode 100644
index 0000000..d36df2f index 0000000..063bb80
--- /dev/null --- /dev/null
+++ b/tests/example-file.php +++ b/tests/example-file.php
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
+<!DOCTYPE html> +<!DOCTYPE html>
+<html> +<html>
+<body> +<body>
+ +<!-- TODO: Check HTML comments work -->
+<?php +<?php
+ echo 'Testing 123'; + echo 'Testing 123';
+ // TODO: Expand this page + // TODO: Expand this page

View File

@ -23,14 +23,11 @@ class NewIssueTests(unittest.TestCase):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
def test_php_issues(self): 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): def test_java_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2) 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): def test_ruby_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)
@ -48,13 +45,10 @@ class ClosedIssueTests(unittest.TestCase):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
def test_php_issues(self): 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): def test_java_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2) 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): def test_ruby_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3) self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)