# Path: checkmate/contrib/plugins/python/pylint/analyzer.py
# class PyLintAnalyzer(BaseAnalyzer):
# 
#     def diff(self,results_a,results_b):
#         pass
# 
#     def diff_summary(self,summary_a,summary_b):
#         pass
# 
#     def summarize(self,items):
# 
#         stats = {
#             'average_global_note' : 0,
#             'n_warnings' : 0,
#             'n_errors' : 0,
#         }
#         cnt = 0
#         for item in [item['stats'] for item in items if 'stats' in item]:
#             if 'global_note' in item:
#                 cnt+=1
#                 stats['average_global_note']+=item['global_note']
#             if 'n_warnings' in item:
#                 stats['n_warnings']+=item['n_warnings']
#             if 'n_errors' in item:
#                 stats['n_errors']+=item['n_errors']
# 
#         if cnt > 0:
#             stats['average_global_note']/=float(cnt)
#         else:
#             del stats['average_global_note']
# 
#         return stats
# 
#     def analyze(self,file_revision):
#         try:
#             reporter = Reporter()
#             linter = Linter(reporter = reporter)
#             linter.load_default_plugins()
#             for unsafe_checker in ['logging','stdlib']:
#                 if unsafe_checker in linter._checkers:
#                     del linter._checkers[unsafe_checker]
#             with open(os.devnull,"w") as devnull:
#                 #pylint will print a lot of garbage when it fails, so we redirect all output to dev/null
#                 try:
#                     old_stdout = sys.stdout
#                     old_stderr = sys.stderr
#                     sys.stdout = devnull
#                     sys.stderr = devnull
#                     linter.check(file_revision.get_file_content(),file_revision.path)
#                 finally:
#                     sys.stdout = old_stdout
#                     sys.stderr = old_stderr
#             stats = linter.stats
#             stats['by_msg'] = stats['by_msg'].items()
#             if 'dependencies' in stats:
#                 del stats['dependencies']
#             sanitized_stats = {}
#             for key,value in stats.items():
#                 sanitized_stats[key] = value.items() if isinstance(value,dict) \
#                     else list(value) if isinstance(value,set) else value
#             issues = reporter.get_issues()
#             for issue in issues:
#                 issue['fingerprint'] = self.get_fingerprint_from_code(file_revision,issue['location'], extra_data=issue['data'])
#             return {'stats':sanitized_stats,'issues':issues}
#         except KeyboardInterrupt:
#             raise
#         except ImportError:
#             pass
#         except:
#             raise
# 
# Path: checkmate/contrib/plugins/python/pylint/issues_data.py



from .analyzer import PyLintAnalyzer
from .issues_data import issues_data

analyzers = {
    'pylint' :
        {
            'name' : 'pylint',
            'title' : 'PyLint',

# Path: checkmate/contrib/plugins/python/pylint/analyzer.py
# class PyLintAnalyzer(BaseAnalyzer):
# 
#     def diff(self,results_a,results_b):
#         pass
# 
#     def diff_summary(self,summary_a,summary_b):
#         pass
# 
#     def summarize(self,items):
# 
#         stats = {
#             'average_global_note' : 0,
#             'n_warnings' : 0,
#             'n_errors' : 0,
#         }
#         cnt = 0
#         for item in [item['stats'] for item in items if 'stats' in item]:
#             if 'global_note' in item:
#                 cnt+=1
#                 stats['average_global_note']+=item['global_note']
#             if 'n_warnings' in item:
#                 stats['n_warnings']+=item['n_warnings']
#             if 'n_errors' in item:
#                 stats['n_errors']+=item['n_errors']
# 
#         if cnt > 0:
#             stats['average_global_note']/=float(cnt)
#         else:
#             del stats['average_global_note']
# 
#         return stats
# 
#     def analyze(self,file_revision):
#         try:
#             reporter = Reporter()
#             linter = Linter(reporter = reporter)
#             linter.load_default_plugins()
#             for unsafe_checker in ['logging','stdlib']:
#                 if unsafe_checker in linter._checkers:
#                     del linter._checkers[unsafe_checker]
#             with open(os.devnull,"w") as devnull:
#                 #pylint will print a lot of garbage when it fails, so we redirect all output to dev/null
#                 try:
#                     old_stdout = sys.stdout
#                     old_stderr = sys.stderr
#                     sys.stdout = devnull
#                     sys.stderr = devnull
#                     linter.check(file_revision.get_file_content(),file_revision.path)
#                 finally:
#                     sys.stdout = old_stdout
#                     sys.stderr = old_stderr
#             stats = linter.stats
#             stats['by_msg'] = stats['by_msg'].items()
#             if 'dependencies' in stats:
#                 del stats['dependencies']
#             sanitized_stats = {}
#             for key,value in stats.items():
#                 sanitized_stats[key] = value.items() if isinstance(value,dict) \
#                     else list(value) if isinstance(value,set) else value
#             issues = reporter.get_issues()
#             for issue in issues:
#                 issue['fingerprint'] = self.get_fingerprint_from_code(file_revision,issue['location'], extra_data=issue['data'])
#             return {'stats':sanitized_stats,'issues':issues}
#         except KeyboardInterrupt:
#             raise
#         except ImportError:
#             pass
#         except:
#             raise
# 
# Path: checkmate/contrib/plugins/python/pylint/issues_data.py



# Path: checkmate/contrib/plugins/python/pylint/setup.py
from .analyzer import PyLintAnalyzer
from .issues_data import issues_data


analyzers = {
    'pylint' :
        {
            'name' : 'pylint',
            'title' : 'PyLint',

            'class' : PyLintAnalyzer,