<commit_before>from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear


class CSSAutoPrefixBear(Lint, LocalBear):
    executable = "postcss"
    arguments = "--use autoprefixer {filename}"
    prerequisite_command = ['postcss', '--use', 'autoprefixer']
    prerequisite_fail_msg = "Autoprefixer is not installed."
    diff_message = "Add vendor prefixes to CSS rules."
    gives_corrected = True
    LANGUAGES = "CSS"

    def run(self, filename, file):
        '''
        This bear adds vendor prefixes to CSS rules using ``autoprefixer``
        utility.
        '''
        return self.lint(filename, file)<commit_msg>CSSAutoPrefixBear: Refactor to Linter v2 API<commit_after>from coalib.bearlib.abstractions.Linter import linter


@linter(executable='postcss',
        output_format='corrected',
        diff_message='Add vendor prefixes to CSS rules.',
        prerequisite_check_command=('postcss', '--use', 'autoprefixer'),
        prerequisite_check_fail_message='Autoprefixer is not installed.')
class CSSAutoPrefixBear:
    """
    This bear adds vendor prefixes to CSS rules using ``autoprefixer`` utility.
    """
    LANGUAGES = "CSS"

    @staticmethod
    def create_arguments(filename, file, config_file):
        return '--use', 'autoprefixer', filename
{'fraction_non_alphanumeric': 0.10450038138825324, 'fraction_numerical': 0.0007627765064836003, 'mean_word_length': 3.7025089605734767, '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': '6587884', 'n_tokens_mistral': 409, 'n_tokens_neox': 401, 'n_words': 102}