<commit_before>#!/usr/bin/python
#
# Copyright 2016 Google Inc.  All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This is used to validate that the library is correct.

This checks:
 * All files in lib/ appear when compiling +@complete
 * Runs a compiler pass over the test code to check for type errors
 * Run the linter to check for style violations.
"""

import os
import re
import subprocess
import sys

import build
import shakaBuildHelpers


def get_lint_files():
  """Returns the absolute paths to all the files to run the linter over."""
  match = re.compile(r'.*\.js$')
  base = shakaBuildHelpers.get_source_base()
  def get(arg):
    return shakaBuildHelpers.get_all_files(os.path.join(base, arg), match)
  return get('test') + get('lib') + get('externs') + get('demo')


def check_lint():
  """Runs the linter over the library files."""
  print 'Running Closure linter...'

  jsdoc3_tags = ','.join([
      'static', 'summary', 'namespace', 'event', 'description', 'property',
      'fires', 'listens', 'example', 'exportDoc'])
  args = ['--nobeep', '--custom_jsdoc_tags', jsdoc3_tags, '--strict']
  base = shakaBuildHelpers.get_source_base()
  cmd = os.path.join(base, 'third_party', 'gjslint', 'gjslint')

  # Even though this is python, don't import and execute since gjslint expects
  # command-line arguments using argv.  Have to explicitly execute python so
  # it works on Windows.
  cmd_line = [sys.executable or 'python', cmd] + args + get_lint_files()<commit_msg>Fix linter error (tutorial tag)<commit_after>#!/usr/bin/python
#
# Copyright 2016 Google Inc.  All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This is used to validate that the library is correct.

This checks:
 * All files in lib/ appear when compiling +@complete
 * Runs a compiler pass over the test code to check for type errors
 * Run the linter to check for style violations.
"""

import os
import re
import subprocess
import sys

import build
import shakaBuildHelpers


def get_lint_files():
  """Returns the absolute paths to all the files to run the linter over."""
  match = re.compile(r'.*\.js$')
  base = shakaBuildHelpers.get_source_base()
  def get(arg):
    return shakaBuildHelpers.get_all_files(os.path.join(base, arg), match)
  return get('test') + get('lib') + get('externs') + get('demo')


def check_lint():
  """Runs the linter over the library files."""
  print 'Running Closure linter...'

  jsdoc3_tags = ','.join([
      'static', 'summary', 'namespace', 'event', 'description', 'property',
      'fires', 'listens', 'example', 'exportDoc', 'tutorial'])
  args = ['--nobeep', '--custom_jsdoc_tags', jsdoc3_tags, '--strict']
  base = shakaBuildHelpers.get_source_base()
  cmd = os.path.join(base, 'third_party', 'gjslint', 'gjslint')

  # Even though this is python, don't import and execute since gjslint expects
  # command-line arguments using argv.  Have to explicitly execute python so
  # it works on Windows.
  cmd_line = [sys.executable or 'python', cmd] + args + get_lint_files()
{'fraction_non_alphanumeric': 0.11355764473033152, 'fraction_numerical': 0.004948045522018802, 'mean_word_length': 4.237046632124352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7340375', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1183, 'n_words': 482}