From 0822838a7c76d804bf6ede458d61113990693939 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 6 Jan 2023 13:11:06 -0300 Subject: [PATCH] Add Linguist language override for include files (#1079) Add a `linguist-language` Git attribute that matches the files at `include/gsl` and sets their language to C++. Without this override, these files are not detected as C++ code by [GitHub's Linguist](https://github.com/github/linguist) (likely due to lacking any file extensions). This will cause GitHub.com to count these files correctly as C++ code and do syntax highlighting when browsing the repo. **Linguist breakdown results** Before:
``` $ docker run --rm -v $(pwd):$(pwd) -w $(pwd) -t linguist github-linguist --breakdown 91.57% 152148 C++ 8.43% 14011 CMake CMake: CMakeLists.txt cmake/gsl_functions.cmake cmake/gsl_install.cmake include/CMakeLists.txt tests/CMakeLists.txt C++: tests/algorithm_tests.cpp tests/assertion_tests.cpp tests/at_tests.cpp tests/byte_tests.cpp tests/deathTestCommon.h tests/no_exception_ensure_tests.cpp tests/notnull_tests.cpp tests/owner_tests.cpp tests/span_compatibility_tests.cpp tests/span_ext_tests.cpp tests/span_tests.cpp tests/strict_notnull_tests.cpp tests/utils_tests.cpp ```
After:
``` $ docker run --rm -v $(pwd):$(pwd) -w $(pwd) -t linguist github-linguist --breakdown 94.16% 225699 C++ 5.84% 14011 CMake CMake: CMakeLists.txt cmake/gsl_functions.cmake cmake/gsl_install.cmake include/CMakeLists.txt tests/CMakeLists.txt C++: include/gsl/algorithm include/gsl/assert include/gsl/byte include/gsl/gsl include/gsl/gsl_algorithm include/gsl/gsl_assert include/gsl/gsl_byte include/gsl/gsl_narrow include/gsl/gsl_util include/gsl/narrow include/gsl/pointers include/gsl/span include/gsl/span_ext include/gsl/string_span include/gsl/util tests/algorithm_tests.cpp tests/assertion_tests.cpp tests/at_tests.cpp tests/byte_tests.cpp tests/deathTestCommon.h tests/no_exception_ensure_tests.cpp tests/notnull_tests.cpp tests/owner_tests.cpp tests/span_compatibility_tests.cpp tests/span_ext_tests.cpp tests/span_tests.cpp tests/strict_notnull_tests.cpp tests/utils_tests.cpp ```
--- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3455dc9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +include/gsl/* linguist-language=C++