<commit_before>#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by <NAME>
# Copyright (c) 2013 <NAME>
#
# License: MIT
#

"""This module exports the Perl plugin class."""

import shlex
from SublimeLinter.lint import Linter, util


class Perl(Linter):

    """Provides an interface to perl -c."""

    syntax = ('modernperl', 'perl')
    executable = 'perl'

    regex = r'(?P<message>.+?) at .+?(?P<file>[^\\\/]+?) line (?P<line>\d+)(, near "(?P<near>.+?)")?'
    error_stream = util.STREAM_STDERR

    def cmd(self):
        """
        Return the command line to execute.

        Overridden so we can add include paths based on the 'include_dirs'
        settings.

        """

        command = [self.executable_path, '-c']

        include_dirs = self.get_view_settings().get('include_dirs', [])

        for e in include_dirs:
            command.append('-I')
            command.append(shlex.quote(e))

        return command

    def split_match(self, match):
        """
        Return the components of the match.

        We override this because perl lints all referenced files,
        and we only want errors from the linted file.

        """

        if match:
            matchObj = re.match(
                r'^.+?(?P<filename>[^\\\/]+?)$', self.filename, re.M | re.I)
            if matchObj:
                if match.group('file') != matchObj.group('filename'):
                    match = None

        return super().split_match(match)<commit_msg>Fixed breakage in 1.2. Fixes #6.<commit_after>#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by <NAME>
# Copyright (c) 2013 <NAME>
#
# License: MIT
#

"""This module exports the Perl plugin class."""

import shlex
from SublimeLinter.lint import Linter, util


class Perl(Linter):

    """Provides an interface to perl -c."""

    syntax = ('modernperl', 'perl')
    executable = 'perl'

    regex = r'(?P<message>.+?) at - line (?P<line>\d+)(, near "(?P<near>.+?)")?'
    error_stream = util.STREAM_STDERR

    def cmd(self):
        """
        Return the command line to execute.

        Overridden so we can add include paths based on the 'include_dirs'
        settings.

        """

        command = [self.executable_path, '-c']

        include_dirs = self.get_view_settings().get('include_dirs', [])

        for e in include_dirs:
            command.append('-I')
            command.append(shlex.quote(e))

        return command
{'fraction_non_alphanumeric': 0.13956262425447316, 'fraction_numerical': 0.005964214711729622, 'mean_word_length': 2.3908355795148246, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3537619', 'n_tokens_mistral': 835, 'n_tokens_neox': 769, 'n_words': 231}