<commit_before>// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library fasta.messages;

import 'package:kernel/ast.dart' show Location, Program;

import 'util/relativize.dart' show relativizeUri;

import 'compiler_context.dart' show CompilerContext;

import 'errors.dart' show InputError;

import 'colors.dart' show cyan, magenta;

const bool hideNits = false;

const bool hideWarnings = false;

bool get errorsAreFatal => CompilerContext.current.options.errorsAreFatal;

bool get nitsAreFatal => CompilerContext.current.options.nitsAreFatal;

bool get warningsAreFatal => CompilerContext.current.options.warningsAreFatal;

bool get isVerbose => CompilerContext.current.options.verbose;

void warning(Uri uri, int charOffset, String message) {
  if (hideWarnings) return;
  print(format(uri, charOffset, colorWarning("Warning: $message")));
  if (warningsAreFatal) {
    if (isVerbose) print(StackTrace.current);
    throw new InputError(
        uri, charOffset, "Compilation aborted due to fatal warnings.");
  }
}

void nit(Uri uri, int charOffset, String message) {
  if (hideNits) return;
  print(format(uri, charOffset, colorNit("Nit: $message")));
  if (nitsAreFatal) {
    if (isVerbose) print(StackTrace.current);
    throw new InputError(
        uri, charOffset, "Compilation aborted due to fatal nits.");
  }
}<commit_msg>Only display 'nits' in verbose mode.<commit_after>// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library fasta.messages;

import 'package:kernel/ast.dart' show Location, Program;

import 'util/relativize.dart' show relativizeUri;

import 'compiler_context.dart' show CompilerContext;

import 'errors.dart' show InputError;

import 'colors.dart' show cyan, magenta;

const bool hideWarnings = false;

bool get errorsAreFatal => CompilerContext.current.options.errorsAreFatal;

bool get nitsAreFatal => CompilerContext.current.options.nitsAreFatal;

bool get warningsAreFatal => CompilerContext.current.options.warningsAreFatal;

bool get isVerbose => CompilerContext.current.options.verbose;

bool get hideNits => !isVerbose;

void warning(Uri uri, int charOffset, String message) {
  if (hideWarnings) return;
  print(format(uri, charOffset, colorWarning("Warning: $message")));
  if (warningsAreFatal) {
    if (isVerbose) print(StackTrace.current);
    throw new InputError(
        uri, charOffset, "Compilation aborted due to fatal warnings.");
  }
}

void nit(Uri uri, int charOffset, String message) {
  if (hideNits) return;
  print(format(uri, charOffset, colorNit("Nit: $message")));
  if (nitsAreFatal) {
    if (isVerbose) print(StackTrace.current);
    throw new InputError(
        uri, charOffset, "Compilation aborted due to fatal nits.");
  }
}
{'fraction_non_alphanumeric': 0.10187932739861523, 'fraction_numerical': 0.002637652489284537, 'mean_word_length': 4.801147227533461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '811623', 'n_tokens_mistral': 940, 'n_tokens_neox': 917, 'n_words': 295}