<commit_before>from imhotep.tools import Tool
from collections import defaultdict
import json
import os


class RubyLintLinter(Tool):

    def invoke(self, dirname, filenames=set()):
        retval = defaultdict(lambda: defaultdict(list))

        # I have to use -exec cus reasons.
        cmd = "find %s -name '*.rb' | xargs rubocop -f j" % dirname
        try:
            output = json.loads(self.executor(cmd))
            for linted_file in output['files']:
                file_name = os.path.abspath(linted_file['path'])
                file_name = file_name.replace(dirname, "")[1:]
                for offence in linted_file['offences']:
                    line_number = str(offence['location']['line'])
                    retval[str(file_name)][line_number].append(
                        str(offence['message']))
        except:
            pass
        print retval
        return retval<commit_msg>lol debug<commit_after>from imhotep.tools import Tool
from collections import defaultdict
import json
import os


class RubyLintLinter(Tool):

    def invoke(self, dirname, filenames=set()):
        retval = defaultdict(lambda: defaultdict(list))

        # I have to use -exec cus reasons.
        cmd = "find %s -name '*.rb' | xargs rubocop -f j" % dirname
        try:
            output = json.loads(self.executor(cmd))
            for linted_file in output['files']:
                file_name = os.path.abspath(linted_file['path'])
                file_name = file_name.replace(dirname, "")[1:]
                for offence in linted_file['offences']:
                    line_number = str(offence['location']['line'])
                    retval[str(file_name)][line_number].append(
                        str(offence['message']))
        except:
            pass
        return retval
{'fraction_non_alphanumeric': 0.11080332409972299, 'fraction_numerical': 0.00110803324099723, 'mean_word_length': 2.0924657534246576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2100506', 'n_tokens_mistral': 523, 'n_tokens_neox': 505, 'n_words': 126}