Check out our Cloud apps to improve your experience in Jira and Confluence Cloud.
Skip to end of metadata
Go to start of metadata

This feature is available only in Awesome Graphs for Bitbucket Server.

Awesome Graphs shows lines of code statistics in the Contributors graph and the Code Frequency graph. It is possible to exclude files from statistics on the repository level.

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.

Pattern Examples

Exclude all files with the selected extensions

*.txt
*.json

These patterns will exclude all files with extensions .txt and .json.

Exclude all files from the selected directories

libraries/
logs/
third_party/

These patterns will exclude all files from directories libraries, logs and third_party.

Exclude everything except files from the selected directory

*
!/src/

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

*
!*.js

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

*
!*.c
!*.cpp
!*.h
library/
!library/ownlib/**/*.c
!library/ownlib/**/*.cpp
!library/ownlib/**/*.h

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.

More examples

You can see more examples of .gitignore patterns here.

Need help?

We can prepare patterns for you. If you need help, raise a support ticket and describe your use case.

  • No labels