Skip to content

Commit

Permalink
Exclude certain file types and folders from linguist detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bud-primordium committed Oct 10, 2024
1 parent e95f96e commit 63b82d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
24 changes: 12 additions & 12 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# 排除语言统计的文件夹
Assignment_1\Problem_2\doxygen_output/** linguist-vendored
Assignment_1\Problem_2\ford_output/** linguist-vendored
Assignment_2\Problem_1\doxygen_output/** linguist-vendored
Assignment_2\Problem_2\doxygen_output/** linguist-vendored
Assignment_3\Problem_2\doxygen_output/** linguist-vendored
Assignment_3\Problem_3\src\documenter_output/** linguist-vendored
Assignment_1/Problem_2/doxygen_output/** linguist-vendored
Assignment_1/Problem_2/ford_output/** linguist-vendored
Assignment_2/Problem_1/doxygen_output/** linguist-vendored
Assignment_2/Problem_2/doxygen_output/** linguist-vendored
Assignment_3/Problem_2/doxygen_output/** linguist-vendored
Assignment_3/Problem_3/src/documenter_output/** linguist-vendored

# 排除语言统计的HTML文件
Assignment_1\Problem_2\Doxygen.html linguist-generated
Assignment_1\Problem_2\Ford.html linguist-generated
Assignment_2\Problem_1\Doxygen.html linguist-generated
Assignment_2\Problem_2\Doxygen.html linguist-generated
Assignment_3\Problem_2\Doxygen.html linguist-generated
Assignment_3\Problem_3\Documenter.html linguist-generated
Assignment_1/Problem_2/Doxygen.html linguist-generated
Assignment_1/Problem_2/Ford.html linguist-generated
Assignment_2/Problem_1/Doxygen.html linguist-generated
Assignment_2/Problem_2/Doxygen.html linguist-generated
Assignment_3/Problem_2/Doxygen.html linguist-generated
Assignment_3/Problem_3/Documenter.html linguist-generated

# Generated by linguist_updater
6 changes: 4 additions & 2 deletions .utils/linguist_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def get_vendored_paths(root_dir, vendored_dirs):
continue
for folder in vendored_dirs:
if folder in dirs:
# 转换路径分隔符为正斜杠
relative_path = os.path.relpath(
os.path.join(root, folder), start=root_dir
)
).replace("\\", "/")
vendored_paths.append(f"{relative_path}/** linguist-vendored\n")
return vendored_paths

Expand All @@ -33,9 +34,10 @@ def get_generated_file_paths(root_dir, generated_files):
continue
for file in files:
if file in generated_files:
# 转换路径分隔符为正斜杠
relative_path = os.path.relpath(
os.path.join(root, file), start=root_dir
)
).replace("\\", "/")
generated_paths.append(f"{relative_path} linguist-generated\n")
return generated_paths

Expand Down

0 comments on commit 63b82d5

Please sign in to comment.