<commit_before>#ifndef BANDIT_REPORTERS_COLORIZER_H
#define BANDIT_REPORTERS_COLORIZER_H

#ifdef _WIN32
  #ifndef MINGW32
    #define NOMINMAX
  #endif

  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
#endif

namespace bandit { namespace detail {

#ifdef _WIN32
  struct colorizer
  {
    colorizer(bool colors_enabled = true)
      : colors_enabled_(colors_enabled),
		stdout_handle_(GetStdHandle(STD_OUTPUT_HANDLE))
    {
		original_color_ = get_console_color();
	}

    const char* green() const
    {
      if(colors_enabled_)
	  {
		  set_console_color(FOREGROUND_GREEN);
	  }
	  return "";
    }

    const char* red() const
    {
      if(colors_enabled_)
	  {
		  set_console_color(FOREGROUND_RED);
	  }
	  return "";
    }

    const char* reset() const
    {
      if(colors_enabled_)
	  {
		  set_console_color(original_color_);
	  }
	  return "";
    }

  private:
	  WORD get_console_color() const
	  {
		  CONSOLE_SCREEN_BUFFER_INFO info = {0};
		  GetConsoleScreenBufferInfo(stdout_handle_, &info);
		  return info.wAttributes;
	  }

	  void set_console_color(WORD color) const
	  {
		  SetConsoleTextAttribute(stdout_handle_, color);
	  }

    private:
    bool colors_enabled_;
	HANDLE stdout_handle_;
	WORD original_color_;
  };

#else
  struct colorizer
  {
    colorizer(bool colors_enabled = true)
      : colors_enabled_(colors_enabled)
    {}

    const char* green() const
    {
      return colors_enabled_ ? "\033[1;32m" : "";
    }

    const char* red() const
    {
      return colors_enabled_ ? "\033[1;31m" : "";
    }

    const char* reset() const
    {
      return colors_enabled_ ? "\033[0m" : "";
    }

    private:
    bool colors_enabled_;
  };
#endif
}}

#endif
<commit_msg>fix(windows): prevent redefinition of NOMINMAX<commit_after>#ifndef BANDIT_REPORTERS_COLORIZER_H
#define BANDIT_REPORTERS_COLORIZER_H

#ifdef _WIN32
  #ifndef NOMINMAX
    #define NOMINMAX
  #endif

  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
#endif

namespace bandit { namespace detail {

#ifdef _WIN32
  struct colorizer
  {
    colorizer(bool colors_enabled = true)
      : colors_enabled_(colors_enabled),
		stdout_handle_(GetStdHandle(STD_OUTPUT_HANDLE))
    {
		original_color_ = get_console_color();
	}

    const char* green() const
    {
      if(colors_enabled_)
	  {
		  set_console_color(FOREGROUND_GREEN);
	  }
	  return "";
    }

    const char* red() const
    {
      if(colors_enabled_)
	  {
		  set_console_color(FOREGROUND_RED);
	  }
	  return "";
    }

    const char* reset() const
    {
      if(colors_enabled_)
	  {
		  set_console_color(original_color_);
	  }
	  return "";
    }

  private:
	  WORD get_console_color() const
	  {
		  CONSOLE_SCREEN_BUFFER_INFO info = {0};
		  GetConsoleScreenBufferInfo(stdout_handle_, &info);
		  return info.wAttributes;
	  }

	  void set_console_color(WORD color) const
	  {
		  SetConsoleTextAttribute(stdout_handle_, color);
	  }

    private:
    bool colors_enabled_;
	HANDLE stdout_handle_;
	WORD original_color_;
  };

#else
  struct colorizer
  {
    colorizer(bool colors_enabled = true)
      : colors_enabled_(colors_enabled)
    {}

    const char* green() const
    {
      return colors_enabled_ ? "\033[1;32m" : "";
    }

    const char* red() const
    {
      return colors_enabled_ ? "\033[1;31m" : "";
    }

    const char* reset() const
    {
      return colors_enabled_ ? "\033[0m" : "";
    }

    private:
    bool colors_enabled_;
  };
#endif
}}

#endif

{'fraction_non_alphanumeric': 0.10046056419113414, 'fraction_numerical': 0.013816925734024179, 'mean_word_length': 2.9443813847900113, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2333434', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1189, 'n_words': 222}