Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed problem including the config file in Sublime

Also fixed small problem when syntax error
  • Loading branch information...
commit f4e1fac0086c4525a21d1dd232a092b86c9c47f5 1 parent 0f19044
Patrick Brosset authored
View
6 cleanjs_cmdline.py
@@ -27,7 +27,11 @@
# Gather data about the file to be reviewed
from parsers import fileparser
-file_data = fileparser.get_file_data_from_file(file_name)
+try:
+ file_data = fileparser.get_file_data_from_file(file_name)
+except Exception as error:
+ print error
+ exit()
# Review the file
from reviewers import reviewer
View
2  parsers/jsparser.py
@@ -83,7 +83,7 @@ def visit(self):
self._walk_node()
self.exec_postprocess_visitors(self.source)
else:
- raise self.parser.error
+ raise self.parser.parsing_error
def _look_for_childen(self, node):
for attr in self.CHILD_ATTRS:
View
9 reviewers/reviewer.py
@@ -4,10 +4,17 @@
from messagebag import MessageBag
from config.reader import ReviewerConfigReader
+def _get_config_file_path():
+ root_dir = os.getcwd()
+ if root_dir[-7:] != "cleanjs" and root_dir[-8:] != "cleanjs" + os.sep:
+ root_dir = root_dir + os.sep + "cleanjs"
+
+ return root_dir + os.sep + "reviewers" + os.sep + "config" + os.sep + "messages.cfg"
+
def review(file_data):
"""Takes in a FileData instance, runs all reviewers on it, and returns a reviewers.reviewer.ReviewedFile instance"""
- config_reader = ReviewerConfigReader("reviewers" + os.sep + "config" + os.sep + "messages.cfg")
+ config_reader = ReviewerConfigReader(_get_config_file_path())
message_bag = MessageBag()
Please sign in to comment.
Something went wrong with that request. Please try again.