Added category exclusion filters for LOC calculation (UI and Badges)#163
Open
cookieukw wants to merge 12 commits into
Open
Added category exclusion filters for LOC calculation (UI and Badges)#163cookieukw wants to merge 12 commits into
cookieukw wants to merge 12 commits into
Conversation
…set files from LOC counts
…t configuration files
…upport granular path filtering
…ray for badge and og-image endpoints
|
@cookieukw is attempting to deploy a commit to the pajecawav's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new feature that allows users to exclude specific file categories (like Lockfiles, Configs, Build Scripts, etc.) from the overall Lines of Code (LOC) calculation. This provides a much more accurate representation of the actual source code written by developers
Key Changes:
?activeFilters=...) so that the exact state can be easily sharedactiveFiltersparameter is fully supported by the badge (/badge) and Open Graph image (/og-image) API endpoints, meaning users can now generate shields.io badges that exclude lockfiles/configs using?activeFilters=jsonConfigs,lockfilessrc/lib/ghloc/api.ts). It traverses the returned JSON, strips out the ignored files, and automatically recalculates the totallocandlocByLangsdictionary before passing it to the frontendREADME.mdwith an example of how to use this parameter for badgesFilter Categories Added:
jsonConfigs(e.g. package.json, tsconfig.json)lockfiles(e.g. pnpm-lock.yaml, go.sum)buildScripts(e.g. Makefile, webpack.config.js)environment(e.g. Dockerfile, .env)editorGit(e.g. .gitignore, .prettierrc)cachesAndBinaries(e.g. .png, .zip)How I tested this:
shields.ioserverexclude option
exclude menu
total lines (without exclude options)
with only three first exclude options
but is the badge (buildScripts, Clockfiles, jsonConfigs)
with only three last exclude options
but is the badge (cachesAndBinaries, editorGit, environment)
with all exclude options
but is the badge (buildScripts, Clockfiles, jsonConfigs, cachesAndBinaries, editorGit, environment)