<commit_before># reference "Witness.coffee"
# reference "../lib/knockout.js"
# reference "../lib/coffee-script.js"
# reference "Event.coffee"

this.Witness.SpecificationFile = class SpecificationFile

	constructor: (manifest) ->
		{@name,@url} = manifest
		@on = Witness.Event.define "downloading", "downloaded", "run", "done", "fail"
		@specifications = []
		@errors = []

	download: () ->
		@errors = []
		@on.downloading.raise()
		$.ajax(
			url: @url
			cache: false
			dataType: 'text'
			success: (script) =>
				if @url.match(/.coffee$/)
					try
						script = CoffeeScript.compile(script)
					catch error
						@errors.push error
						@on.downloaded.raise [error]
						return
				else
					if not JSLINT script
						@errors.push {message: "Line #{error.line}, character #{error.character}: #{error.reason}"} for error in JSLINT.errors when error?<commit_msg>JSLint options: Add all DSL functions. Allow messy whitespace.<commit_after># reference "Witness.coffee"
# reference "../lib/knockout.js"
# reference "../lib/coffee-script.js"
# reference "Event.coffee"

this.Witness.SpecificationFile = class SpecificationFile

	constructor: (manifest) ->
		{@name,@url} = manifest
		@on = Witness.Event.define "downloading", "downloaded", "run", "done", "fail"
		@specifications = []
		@errors = []

	download: () ->
		@errors = []
		@on.downloading.raise()
		$.ajax(
			url: @url
			cache: false
			dataType: 'text'
			success: (script) =>
				if @url.match(/.coffee$/)
					try
						script = CoffeeScript.compile(script)
					catch error
						@errors.push error
						@on.downloaded.raise [error]
						return
				else
					predef = (name for own name of Witness.Dsl::)
					if not JSLINT script, { predef: predef, white: true }
						@errors.push {message: "Line #{error.line}, character #{error.character}: #{error.reason}"} for error in JSLINT.errors when error?
{'fraction_non_alphanumeric': 0.1552, 'fraction_numerical': 0.0, 'mean_word_length': 3.3126436781609194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6340725', 'n_tokens_mistral': 746, 'n_tokens_neox': 604, 'n_words': 152}