This feature is available only in Awesome Graphs for Bitbucket Server.
You can exclude:
- selected files
- all files with selected extensions
- all files from selected directories
- everything except files with selected extensions
- everything except files from selected directories
Exclusion of files allows to make lines of code statistics more precise and informative. This feature will be helpful for users, who:
- Include source code from third-party libraries, and don't want to count it towards individual code contributions.
- Want automated code generated files not to be included into lines of code statistics.
- Need to exclude from lines of code statistics files with some extensions.
- Want to count in lines of code statistics only files with selected extensions.
- Demand lines of code statistics on directory basis.
How to Use the Feature
Customization of lines of code statistics is available in the repository settings. Repository administrators can modify these settings.
To exclude files from lines of code statistics of a repository go to Repository settings > Awesome Graphs > Lines of code
By clicking Add pattern you will proceed to the customization page.
Here you may add patterns in .gitignore format telling what files and directories should be excluded from lines of code statistics of the repository.
After you add all patterns you need, press Save. Then Awesome Graphs will start re-indexing the repository. When re-indexing is completed new lines of code statistics will be available in the Contributors and the Code Frequency graphs. During re-indexing it is not possible to update lines of code statistics settings.
Exclude all files with the selected extensions
These patterns will exclude all files with extensions .txt and .json.
Exclude all files from the selected directories
These patterns will exclude all files from directories libraries, logs and third_party.
Exclude everything except files from the selected directory
These patterns will exclude all files except files from the directory src in the repository root. By using this approach you will get lines of code statistics only for the selected directory or list of directories.
Exclude everything except files with the selected extensions
These patterns will exclude all files except files with .js extensions. By using this approach you will get lines of code statistics only for the selected types of files.
Combination of patterns
All files will be excluded from statistics. Files with c, cpp, h extensions will be included into statistics. All files from the directory library will be excluded from statistics (even files with c, cpp, h extensions). Files with with c, cpp, h extensions from the subdirectory library/ownlib will be included into statistics.
You can see more examples of .gitignore patterns here.
We can prepare patterns for you. If you need help, raise a support ticket and describe your use case.