Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
improves rules path
Browse files Browse the repository at this point in the history
  • Loading branch information
FeeiCN committed Aug 11, 2017
1 parent 6f6e4e0 commit 3b169cd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cobra/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .dependencies import Dependencies
from .log import logger
from pip.req import parse_requirements

from .config import rules_path

file_type = []

Expand Down Expand Up @@ -59,7 +59,7 @@ def language(self):
language=tmp_language))
self.lang = tmp_language
logger.debug('[DETECTION] [LANGUAGE] main language({main_language}), tmp language({tmp_language})'.format(tmp_language=tmp_language,
main_language=self.lang))
main_language=self.lang))
return self.lang

@property
Expand Down Expand Up @@ -143,9 +143,8 @@ def parse_xml(self, root, frame_data, language_data, frame_name=None):

@staticmethod
def rule():
project_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
rules_path = os.path.join(project_directory, 'cobra/rules/frameworks.xml')
tree = eT.ElementTree(file=rules_path)
framework_path = os.path.join(rules_path, 'frameworks.xml')
tree = eT.ElementTree(file=framework_path)
return tree

@staticmethod
Expand Down Expand Up @@ -440,7 +439,7 @@ def cloc(self):
x.add_row([lang, type_num[lang]['files'], type_num[lang]['blank'], type_num[lang]['pound'],
type_num[lang]['code']])
except KeyError:
logger.warning('There is no such file type -->'+lang + ',please add it to the whitelist')
logger.warning('There is no such file type -->' + lang + ',please add it to the whitelist')
x.add_row(["SUM", total_file, total_blank_line, total_pound_line, total_code_line])
logger.info('\n' + str(x))
return True

0 comments on commit 3b169cd

Please sign in to comment.